6.2.1 Initialization

The firmware execution starts with the initialization of the microcontroller and its peripherals. The Phase Sequence Detector application uses microcontroller peripherals such as SPI, Timer, UART, ADCC, GPIO and ZCD. The system is initialized in the following configurations:
Table 6-1. Microcontroller Peripherals Configuration Details
PeripheralsSPI1UART2ADCCTMR2TMR4ZCD1 and ZCD2
ConfigurationsSPI Clock (6 MHz)Baud rate (230400)Resolution (10 bits)Timer Clock (500 kHz)Timer Clock (16 MHz)ZCD enable
SPI Host mode Parity bit (‘0’)ADC Clock (2 MHz)Timer Mode (Roll Over Pulse)Timer Mode (Roll Over Pulse)ZCD Interrupt (Rising Edge)
Data Mode 2 Stop bit (‘1’)Sampling Frequency (1 kHz)Timer Period (20 ms)Timer Period (1 ms)Logic Output Polarity (not inverted)