Tool/software:
SCI Autobaud Issue on TMS320F280049
Hi,
We're encountering an issue with the SCI autobaud functionality on the TMS320F280049. Below is the code we use to configure the SCI:
SCI_setConfig(XXXXX_SCI_BASE, DEVICE_LSPCLK_FREQ, 230400,
(SCI_CONFIG_WLEN_8 | SCI_CONFIG_STOP_ONE | SCI_CONFIG_PAR_NONE));
SCI_resetChannels(XXXXX_SCI_BASE);
SCI_clearInterruptStatus(XXXXX_SCI_BASE, SCI_INT_RXFF);
SCI_enableModule(XXXXX_SCI_BASE);
SCI_performSoftwareReset(XXXXX_SCI_BASE);
HWREG(XXXXX_SCI_BASE + SCI_O_FFRX) &= ~SCI_RXFF_RESET;
SCI_disableInterrupt(XXXXX_SCI_BASE, SCI_INT_RXFF);
SCI_enableFIFO(XXXXX_SCI_BASE);
SCI_setFIFOInterruptLevel(XXXXX_SCI_BASE, SCI_FIFO_TX16, SCI_FIFO_RX10);
SCI_enableInterrupt(XXXXX_SCI_BASE, SCI_INT_RXFF);
SCI_lockAutobaud(XXXXX_SCI_BASE);
uint16_t byteData = SCI_readCharBlockingFIFO(XXXXX_SCI_BASE);
SCI_writeCharBlockingFIFO(XXXXX_SCI_BASE, byteData);
Interrupt_register(XXXXX_INT_SCI_RX, sciRxISR);
Issue Description:
The problem is that SCI_lockAutobaud()
does not consistently work. When it fails, no characters are sent out after calling the function.
Key Observations:
We found two specific conditions where autobaud works reliably:
- When the debugger is connected and running.
- When modifying
SCI_setConfig()
to use a multiplied LSPCLK frequency:SCI_setConfig(XXXXX_SCI_BASE, DEVICE_LSPCLK_FREQ * 7, 230400, (SCI_CONFIG_WLEN_8 | SCI_CONFIG_STOP_ONE | SCI_CONFIG_PAR_NONE));
- Interestingly, multipliers like
*3
,*4
,*5
, etc., also work.
- Interestingly, multipliers like
Debugging Steps Taken:
-
Checked System Clock:
- Configured
XCLKOUT
to outputPLLSYSCLK
. - With our system clock at 100 MHz, we consistently observe 12.5 MHz output, matching the default
/8
divider. - PWM functions also operate correctly at the expected frequency.
- Configured
-
Tested Baud Rate Before Autobaud Lock:
- Added code to transmit
0xAA
beforeSCI_lockAutobaud()
. - Regardless of the
SCI_setConfig()
parameters, the baud rate is always 1.66 Mbps. - For example, even with:
the output baud rate remains 1.66 Mbps.SCI_setConfig(XXXXX_SCI_BASE, 25000000, 9600, (SCI_CONFIG_WLEN_8 | SCI_CONFIG_STOP_ONE | SCI_CONFIG_PAR_NONE));
- Added code to transmit
-
Autobaud Behavior:
- When using the LSPCLK multiplier or with the debugger connected,
SCI_lockAutobaud()
functions correctly, and data is transmitted as expected. We will be able to see a second message with the correct baud rate being send out after we see the one with the 1.66Mbps baudrate.
- When using the LSPCLK multiplier or with the debugger connected,
Request for Help:
We're trying to understand:
- Why does
SCI_lockAutobaud()
only work under these specific conditions? - Why is the baud rate stuck at 1.66 Mbps before the autobaud lock, even when
SCI_setConfig()
is modified? - Could there be an issue related to clock configurations or SCI internal timing?
Any insights or suggestions would be greatly appreciated. Thank you!