SBAA804 April   2026 ADC168M102R-SEP

 

  1.   1
  2.   Abstract
  3. 1Introduction
  4. 2Hardware Platform
  5. 3Hardware Interfaces
    1. 3.1 Communication via McBSP
      1. 3.1.1 Using McBSP1
      2. 3.1.2 Channel Identification
    2. 3.2 Communication via SPI and ePWM
      1. 3.2.1 Using SPI and ePWM
      2. 3.2.2 SPI Peripheral Requirement
  6. 4Software Interface
    1. 4.1 McBSP Settings
    2. 4.2 SPI and ePWM Settings
    3. 4.3 Software Flow
  7. 5Summary
  8. 6References

SPI and ePWM Settings

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.

1.One ADC168M102R-SEP configure command split into two SPI transmission cycles:
        for(Cnt=0; Cnt < number; Cnt++)
        {
           SpiaRegs.SPITXBUF = (*(data+Cnt) >> 1) & 0x7FE0 ;
           SpiaRegs.SPITXBUF = (*(data+Cnt) << 10) & 0xFC00;
        }
2. Two SPI reception cycles combine together to be one ADC168M102R-SEP conversion result:
        for(Counteri = 0; Counteri < Rxcounter/2; Counteri ++ )
        {
           RxInterpreter[Counteri] = ( Rxdata[Counteri * 2] << 6 ) 
                                        | ( Rxdata[Counteri * 2 +1] >> 5 );
        }
Table 4-2 Key Register Setting o SPI
RegisterSettingComments
SPICTL.all0x0002As a slave, normal SPI clocking scheme without delay
SPIPRI.bit.TRIWIRE0Normal 4-wire SPI mode
SPIFFCT0x0000The next word in buffer is transferred immediately upon completion of transmission of previous one
SPICCR.all0x008A11 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.

Table 4-3 Key Register Setting of ePWM
RegisterePWM1 SettingsPWM2 SettingsComments
TBCTL.bit.HSPCLKDIV11Set the time base clock rate
TBCTL.bit.CLKDIV11
TBCTL.bit.CTRMODE00Set the counter mode as up-count mode
TBPRD2199Set the period of the time-base counter
AQCTLA.bit.ZRO22Set the ePWM module output action
AQCTLA.bit.CAU11
CMPA.half.CMPA105Set compare register to control duty cycle
TBCTL.bit.PHSEN01Synchronization control, ePWM1 as master, ePWM2 as slave
TBCTL.bit.SYNCOSEL10
TBPHS.half.TBPHS00Set the counter value after synchronization