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);
The problem is that SCI_lockAutobaud()
does not consistently work. When it fails, no characters are sent out after calling the function.
We found two specific conditions where autobaud works reliably:
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));
*3
, *4
, *5
, etc., also work.Checked System Clock:
XCLKOUT
to output PLLSYSCLK
./8
divider.Tested Baud Rate Before Autobaud Lock:
0xAA
before SCI_lockAutobaud()
.SCI_setConfig()
parameters, the baud rate is always 1.66 Mbps.SCI_setConfig(XXXXX_SCI_BASE, 25000000, 9600,
(SCI_CONFIG_WLEN_8 | SCI_CONFIG_STOP_ONE | SCI_CONFIG_PAR_NONE));
Autobaud Behavior:
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.We're trying to understand:
SCI_lockAutobaud()
only work under these specific conditions?SCI_setConfig()
is modified?Any insights or suggestions would be greatly appreciated. Thank you!
Apologies for the delay in response, I was out sick.
The lspclkHz input of the SCI_setConfig() function is intended to be the actual LSPCLK clock value. Additionally, the SCI_setConfig() function shouldn't actually be relevant after you use the SCI_lockAutobaud() function:
Debug questions:
Regards,
Jason Osborn
SCIHBAUD = 0x0
SCILBAUD = 0x5D
These are the values of SCIHBAUD and SCILBAUD registers before the autobaud lock when we pass the following arguments to the SCI_setConfig function
SCI_setConfig(XXXXX_SCI_BASE, DEVICE_LSPCLK_FREQ, 230400,
(SCI_CONFIG_WLEN_8 | SCI_CONFIG_STOP_ONE | SCI_CONFIG_PAR_NONE));
where
DEVICE_LSPCLK_FREQ = 25MHz
The intended final baud rate is 230400.
Hm. With those parameters, the value of SCILBAUD should be 0x0D, I believe. For a baud rate of 230400, SCILBAUD=0x5D would require DEVICE_LSPCLK_FREQ to be just under 7x the given value.
Questions
Regards,
Jason Osborn
1) You are correct, my bad. SCILBAUD=0x5D happens when
SCI_setConfig(XXXXX_SCI_BASE, DEVICE_LSPCLK_FREQ * 7, 230400,
(SCI_CONFIG_WLEN_8 | SCI_CONFIG_STOP_ONE | SCI_CONFIG_PAR_NONE));
and it is SCILBAUD=0x0C when
SCI_setConfig(XXXXX_SCI_BASE, DEVICE_LSPCLK_FREQ, 230400,
(SCI_CONFIG_WLEN_8 | SCI_CONFIG_STOP_ONE | SCI_CONFIG_PAR_NONE));
2) SCIHBAUD = 0x00 and SCILBAUD = 0x0C after the full autobaud process is successful. And this just happens when using
DEVICE_LSPCLK_FREQ * 7 in th
SCI_setConfig.
If the result is 0x0C, the autobaud process resulted in a baud rate of 223214, which is just under the intended target, which is correct. However, you said the autobaud does not work in your original post- am I misunderstanding something?
Regards,
Jason Osborn
Hi Jason,
As we stated in the post, autobaud is only working when we have either
DEVICE_LSPCLK_FREQ * 7 in th
SCI_setConfig
or
debugger connected and running.
To clarify, while adding/removing multiplier in SCI_setConfig() is changing the values for SCILBAUD, there is no difference when we try to send a message after SCI_setConfig(). The baudrate of the message is always 1.66Mbps, shown by the scope capture.
The “real” baudrate will only be corrected when autobaud works, which requires us to put a multiplier in SCI_setConfig(), confirmed by the scope capture. Without the multiplier, it will be as if autobaud did not see any messages thus will not send out anything.
I see- so when there is no multiplier, the value of SCILBAUD is correct, but the actual output is not right- and additionally, the autobaud does not function. Alright, thank you for the clarification.
I need a bit more time to look through the information you provided and get back to you. In the meantime, I want to clarify one of my previous questions- When the autobaud fails, what are the contents of SCILBAUD and SCIHBAUD?
Regards,
Jason Osborn
The Autobaud function doesn't have a timeout, so the way we know it fails it is because it got stuck in the Autobaud function. The other microcontroller sending the 0x0A in a infinite loop also gets stuck as the TMS320F280049 never successfully gets the Autobaud to finish.
Alberto,
I'd misunderstood you before, then. My apologies Thank you for your clarification and patience in explaining this issue.
I'm going to discuss this issue further internally- nothing I'm seeing should result in this issue. This is very odd. I have some thoughts, but nothing that quite makes sense, given the full context of the problem.
To clarify my current thought process:
As I said, I'll continue discussing this internally to try and determine a root cause based on our discussions so far. If there is any further information you're able to provide, please let me know. Depending on what we're able to determine, the following information may end up being useful:
Regards,
Jason Osborn
Hi Jason,
sorry for the late rely. Our software engineer is out this week but I will answer the ones I know.
Q: Any relevant HW differences between the old board and new board mentioned in your prev. thread on this topic, such as wiring differences, device changes, pinout changes, etc.
A: We don't think there is any significant HW differences especially related to SCI and that's why we are a bit confused. We are using the same external oscillator and we are using the same pinout for SCI. The main changes for the DSP was that we swap some of the ADC pins around but I don't image that would impact the SCI. The layout did change a bit but the SCI connections to the other microcontroller are just 2 traces with nothing in between, same as before.
Q: Which SCI peripheral (-A or -B) is being used
A: This I'm not super sure.
Q: What IO is being assigned for each SCI pin
A: We are using GPIO22 VFBSW for SCITX and GPIO13 SCIRX
Q: JTAG configuration details
A: I'm not sure about the software config. Hardware wise we are using the 14pin JTAG and with the same setup as the datasheet example.
Q: Device boot mode
A: We have pull up and GPIO 24 and 32, thus boot mode = flash.
Based on the pin choice, you're using SCIB.
Note that IO22 has the following pinout note in the datasheet:
If the SCI pins are unchanged from the working version, this is unlikely to be the root cause, but it's definitely worth checking.
Thank you for all the information. I'm still discussing internally and hope to get back to you soon with a more probable cause.
Regards,
Jason Osborn
Hi Jason, want to follow up to see if you have found anything related to this issue?
Sorry for the delay in response, I was out sick for quite a while, and missed updating you because of that.
Based on the information provided, I've been unable to find any distinct root cause- Nothing indicated should be causing these issues, assuming that you've also been checking my debug suggestions, such as the note on GPIO22 in my last post.
I would like to follow up on the other questions I've asked, then I have more and debug suggestions:
I'm sorry again that I've been unable to determine the source of this issue.
Regards,
Jason Osborn