SPRUII0F May 2019 – June 2024 TMS320F28384D , TMS320F28384D-Q1 , TMS320F28384S , TMS320F28384S-Q1 , TMS320F28386D , TMS320F28386D-Q1 , TMS320F28386S , TMS320F28386S-Q1 , TMS320F28388D , TMS320F28388S
To reset and initialize the sample rate generator:
During a DSP reset, the sample rate generator, the receiver, and the transmitter reset bits (GRST, RRST, and XRST) are automatically forced to 0. Otherwise, during normal operation, the sample rate generator can be reset by setting GRST = 0 in SPCR2, provided that CLKG and/or FSG is not used by any portion of the McBSP. Depending on your system, you can reset the receiver (RRST = 0 in SPCR1) and reset the transmitter (XRST = 0 in SPCR2).
If GRST = 0 due to a device reset, CLKG is driven by the CPU clock divided by 2, and FSG is driven inactive-low. If GRST = 0 due to program code, CLKG and FSG are driven low (inactive).
Program the sample rate generator registers (SRGR1 and SRGR2) as required for your application. If necessary, other control registers can be loaded with desired values, provided the respective portion of the McBSP (the receiver or transmitter) is in reset.
After the sample rate generator registers are programmed, wait 2 CLKSRG cycles. This makes sure of proper synchronization internally.
In SPCR2, make GRST = 1 to enable the sample rate generator.
After the sample rate generator is enabled, wait two CLKG cycles for the sample rate generator logic to stabilize.
On the next rising edge of CLKSRG, CLKG transitions to 1 and starts clocking with a frequency equal to the following CLKG frequency equation:
where the input clock is selected with the SCLKME bit of PCR and the CLKSM bit of SRGR2 in one of the configurations shown in Table 34-7.
SCLKME | CLKSM | Input Clock for Sample Rate Generator |
---|---|---|
0 | 0 | Reserved |
0 | 1 | LSPCLK |
1 | 0 | Signal on MCLKR pin |
1 | 1 | Signal on MCLKX pin |
If necessary, remove the receiver and/or transmitter from reset by setting RRST and/or XRST = 1.
After the required data acquisition setup is done (DXR[1,2] is loaded with data), set GRST = 1 in SPCR2 if an internally generated frame-synchronization pulse is required. FSG is generated with an active-high edge after the programmed number of CLKG clocks (FPER + 1) have elapsed.