SBAA804 April 2026 ADC168M102R-SEP
F28377D-SEP integrates with high-speed synchronous SPI that allows a serial bit stream of programmed length (1 to 16 bits) to be shifted into and out of the device, furthermore, it supports a 16-level receive and transmit FIFO.
In this interfacing scheme, the SPI port is configured as a slave device with 4-wire mode operation. For compatibility with ADC168M102R-SEP timing diagram, the SPI port is set to output data on rising edge and input data on falling edge with non-delayed clock.
In the source code, the character length of the SPI port is set as 11 bits, a buffer is employed in the transmission and reception, the next word in the buffer is transferred immediately upon completion of transmission of the previous one, thus combining two SPI transmissions into one ADC168M102R-SEP conversion cycle; the following several lines of code shows the translation between them. Table 4-2 lists the key register settings of the SPI port previously described.
|
|
| Register | Setting | Comments |
|---|---|---|
| SPICTL.all | 0x0002 | As a slave, normal SPI clocking scheme without delay |
| SPIPRI.bit.TRIWIRE | 0 | Normal 4-wire SPI mode |
| SPIFFCT | 0x0000 | The next word in buffer is transferred immediately upon completion of transmission of previous one |
| SPICCR.all | 0x008A | 11 bits; data output on rising edge, input on falling edge |
The two ePWM modules used is set to clock at the same rate and counter mode, with different counter period so that they could be used as RD/CONVST signal or clock signal. The counter value of ePWM2 module is synchronized to be zero when the counter value of ePWM1 module reaches to zero. Key register setting for ePWM module is shown in Table 4-3.
| Register | ePWM1 Settings | PWM2 Settings | Comments |
|---|---|---|---|
| TBCTL.bit.HSPCLKDIV | 1 | 1 | Set the time base clock rate |
| TBCTL.bit.CLKDIV | 1 | 1 | |
| TBCTL.bit.CTRMODE | 0 | 0 | Set the counter mode as up-count mode |
| TBPRD | 219 | 9 | Set the period of the time-base counter |
| AQCTLA.bit.ZRO | 2 | 2 | Set the ePWM module output action |
| AQCTLA.bit.CAU | 1 | 1 | |
| CMPA.half.CMPA | 10 | 5 | Set compare register to control duty cycle |
| TBCTL.bit.PHSEN | 0 | 1 | Synchronization control, ePWM1 as master, ePWM2 as slave |
| TBCTL.bit.SYNCOSEL | 1 | 0 | |
| TBPHS.half.TBPHS | 0 | 0 | Set the counter value after synchronization |