This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280049: UART autobaud rate detection

Part Number: TMS320F280049


Hi C2K experts,

I am trying to use auto baud rate detection (F280049), however,

the program is stuck at below statement, even I had sent 'a' ('A').

while(SciaRegs.SCIFFCT.bit.ABD != 1) {}

I am sure the RX, TX pins are correct. The host baud rate is 9600.

Here is my code:

void SCIA_AutobaudLock(void)
{

Uint16 byteData;

SciaRegs.SCICCR.all = 0x0007;

SciaRegs.SCICTL1.all = 0x0003;

SciaRegs.SCICTL2.all = 0x0000;

SciaRegs.SCICTL1.all = 0x0023; 

// Reset
SciaRegs.SCIFFTX.bit.SCIRST = 1;

//----- SCI Reset -----//
SciaRegs.SCICTL1.bit.SWRESET = 0;
SciaRegs.SCICTL1.bit.SWRESET = 1;
//---------------------//

// Must prime baud register with >= 1
SciaRegs.SCIHBAUD.all = 0x0000;
SciaRegs.SCILBAUD.all = 0x0001;

// Prepare for autobaud detection
// Set the CDC bit to enable autobaud detection
// and clear the ABD bit
SciaRegs.SCIFFCT.bit.CDC = 1;
SciaRegs.SCIFFCT.bit.ABDCLR = 1;

// Wait until we correctly read an
// 'A' or 'a' and lock
while(SciaRegs.SCIFFCT.bit.ABD != 1) {}

// After autobaud lock, clear the ABD and CDC bits
SciaRegs.SCIFFCT.bit.ABDCLR = 1;
SciaRegs.SCIFFCT.bit.CDC = 0;

while(SciaRegs.SCIRXST.bit.RXRDY != 1) { }

byteData = (Uint16)SciaRegs.SCIRXBUF.bit.SAR; //SciaRegs.SCIRXBUF.bit.RXDT;
SciaRegs.SCITXBUF.bit.TXDT = byteData;

return;

}

May I have your comment about this?

Thanks,

  • Hi Kevin,

    What GPIOs are you using for SCI-A?  Are you using a virtual COM port or a physical serial connection? If it is a physical serial connection, what transceiver are you using?  Either way, have you run the SCI echoback example (with pre-specified baud) to verify the hook-up and that 'a' is transmitted from the host and received by the MCU as expected?

  • Hi Devin,

    I am using 64pin package, the GPIO I am using is GPIO28(RX)/pin2, GPIO29(TX)/pin1.

    I use physical serial connection, the transceiver is SiliconLab CP210x.

    Yes, I had tested SCI echoback example and also SCI firmware update function without error.

    Thanks,

  • Hi Kevin,

    I don't see anything obviously wrong with your setup or code. 

    One debug activity might be to pause execution in the spin-wait loop that is waiting for auto-baud detect.  You can then go into the expressions window in the debugger and check some of the following:

    Status of SCIRXST register.  Are any of the error flags set such as BRKDT?

    Status of the other SCI configuration registers, in particular you may want to verify that the settings that should have been written in the code have actually made it to the SCI registers. e.g. check that these writes actually made it into the registers:

    SciaRegs.SCICCR.all = 0x0007;

    SciaRegs.SCICTL1.all = 0x0003;

    SciaRegs.SCICTL2.all = 0x0000;

    SciaRegs.SCICTL1.all = 0x0023; 

    (if they don't match, the likely culprits would be a missing 'EALLOW' or some other code that later re-initializes the settings accidentally) 

    You may also want to check the other basic system configurations at that point too (PLL and clocking, LSPCLK divider, etc.)  

  • Hi Devin,

    There are some errors in SCIRXST, after I sent "A" to the chip.

    I am not sure what the errors come from, without Autobaud rate detection/correction, 

    the chip can receive more than 20K bytes data without error under normal configuration.

    I will keep digging the problem.

    Thanks,

  • Hi Devin,

    I found the root cause!!

    It is my mistake, I should send "ASCII" format of 'a' NOT "HEX" format.

    Now, it works.

    Thanks,

  • Hi Devin,

    I found the root cause!!

    It is my mistake, I should send "ASCII" format of 'a' NOT "HEX" format.

    Now, it works.

    Thanks,