TMS320F28335: RS-232 USB to TTL with TMS320F28335. Trying SCI Reception. Missing Data while receiving how do I fix it?

Part Number: TMS320F28335

Tool/software:

Hi, 

For our Project requirement we want to convert the USB data to TTL form. In order to achieve this, we are using DEVICE: TMS320F28335. 

We are using USB to TTL converter. TTL output is connected to the SCI B port of 28335 controller card. 

The receiver configuration is done as per the steps given in particular link (2.3 Configuration issue symptoms --- Cause 2)

LINK: https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1031947/faq-my-c2000-sci-is-not-transmitting-and-or-receiving-data-correctly-how-do-i-fix-this 

In spite of that it is observed that transmitter is transmitting the data without any missing data, were as receiver is not receiving the data and please find attached code which we developed for this particular purpose. Can you please look at our code and fix problems if any. 

and also attaching waveform which seeing in TTL side rx pin : 

void Sci_Config()
{

    EALLOW;
    SysCtrlRegs.PCLKCR0.bit.SCIBENCLK = 1;     // enabiling peripheral clock
    EDIS;

    EALLOW;
    GpioCtrlRegs.GPAPUD.bit.GPIO18 = 0;
    GpioCtrlRegs.GPAPUD.bit.GPIO19 = 0;
    EDIS;

    ScibRegs.SCIFFRX.bit.RXFFIENA = 0;
    ScibRegs.SCIFFTX.bit.TXFFIENA = 0;
    ScibRegs.SCIRXST.bit.FE = 0;
    ScibRegs.SCIRXST.bit.OE = 0;
    ScibRegs.SCIRXST.bit.PE =0;
    ScibRegs.SCICTL1.bit.RXERRINTENA = 0;
    ScibRegs.SCICTL2.bit.RXBKINTENA = 0;
    ScibRegs.SCICTL2.bit.TXRDY = 0;
    ScibRegs.SCICTL1.bit.SWRESET = 1;

    ScibRegs.SCIFFTX.bit.TXFFINTCLR = 1;
    ScibRegs.SCIFFRX.bit.RXFFINTCLR = 1;

    ScibRegs.SCIFFRX.bit.RXFFOVRCLR = 1;

    ScibRegs.SCIFFTX.bit.TXFIFOXRESET = 0;
    ScibRegs.SCIFFRX.bit.RXFIFORESET = 0;

    ScibRegs.SCIFFTX.bit.TXFIFOXRESET = 1;
    ScibRegs.SCIFFRX.bit.RXFIFORESET = 1;

    ScibRegs.SCICTL1.bit.TXENA = 0;   
    ScibRegs.SCICTL1.bit.RXENA = 0;

    ScibRegs.SCIFFTX.bit.SCIRST = 1;

    ScibRegs.SCICCR.all = 0x0007;

    ScibRegs.SCIHBAUD = 0x0000;    // Setting the baud rate (high register)
    ScibRegs.SCILBAUD = 0x0079;

    ScibRegs.SCICTL1.bit.TXENA = 1;
    ScibRegs.SCICTL1.bit.RXENA = 1;

    ScibRegs.SCICTL1.bit.SWRESET = 1;

    ScibRegs.SCIFFTX.bit.TXFFIL = 4;   
    ScibRegs.SCIFFRX.bit.RXFFIL = 4;

    ScibRegs.SCIFFTX.bit.SCIRST = 1;
    ScibRegs.SCIFFTX.bit.SCIFFENA = 1;
    ScibRegs.SCIFFTX.bit.TXFIFOXRESET =1;

    ScibRegs.SCIFFRX.bit.RXFIFORESET =1;

    ScibRegs.SCICTL1.bit.TXENA = 1;
    ScibRegs.SCICTL1.bit.RXENA = 1;

    ScibRegs.SCICTL1.bit.SWRESET = 1;
	
	EALLOW;
    GpioCtrlRegs.GPAQSEL2.bit.GPIO19 = 3;     // Asynchronous input    (SCIRXDA)
    GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 2;     //config gpio as SCITXDA 
    GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 2;     //config gpioas SCIRXDA
    EDIS;

}

 

Thanks & Regards,

Chaya

  • Hi Chaya,

    receiver is not receiving the data

    Can you please describe the missed data? Is there a pattern to the missed data (shifted, missing frames, etc.)? Can you clearly describe a case where data is transmitted and describe what data is received/what is missing? Are you able to see correct signals output on the SCI lines but not seeing the data correctly received into the RXBUF (RXEMU) register on the C2000?

    Best Regards,

    Allison

  • Hi, 

    From USB we will be transmitting commands with GUI, commands will get transmitted to TI experiment kit as a frame and frame starting with STX and ETX. Between STX and ETX the command word will be inserted and get transmitted. 

    Prefixed commands shall be transmitted from USB port as command frames and format of the command frame is shown below:

    During our testing, a command "MD1" (4D 44 31) was transmitted to SCI port as given below:

    The SCI is supposed to receive the data given above, and following are the observations: 

    • Start of Text 02 is always received 
    • End of Text 03 is received most of the times 
    • In between STX and ETX data (MD1) is received occasionally OR in a random manner as given below:
      • 02 4D 44 03 ;
      • 02 44 03 ;
      • 02 4D 4D 03 ; 
      • 02 03 ;
      • 02 31 31 4D 03 ;
      • 02 44 44 31 4D 03 ;
      • 02 4D 44;
      • 03 4D 4D 02 
    • This particular reception is also happening occasionally

    • Attaching waveform here, TTL output: 

    Thanks & Regards, 

    Chaya 

  • Hi Chaya,

    Thank you kindly for the clear explanation and details. Please allow another day for me to review the information you provided. Appreciate your patience!

    Best Regards,

    Allison

  • Hi Chaya,

    My apologies I will need another day to form a proper response here.

    Best Regards,

    Allison

  • Hi Chaya,

    Sorry for the delay. Can you please clarify the baud rate you are using? What is your LSPCLK divider (what LSPCLK frequency are you running at) and what baud rate is the communicating device expecting? Since there is corrupted data upon receival by SCI, one speculation is it could be a timing mismatch. I would like confirmation if the waveforms always reflect correct data, but you are seeing incorrect data received in the SCI buffer (RXBUF/SCIRXEMU)

    Best Regards,

    Allison

  • Hi, 

    Baud rate we are using is 38.4khz. LSPCLK, we gave 150mhz (as we are writing 0x0079 into SCILBAUD register we are not using baud rate formula- ((LSPCLK/(BAUD_RATE*8))-1) as per manual).

    But, by measuring for this 38.4khz in oscilloscope we are writing value for SCILBAUD as 0x0079. 

    Yes, waveforms are always reflecting correct data, but we are seeing incorrect data received.  

    Thanks & Regards,

    Chaya

  • Hi Chaya,

    Allison is currently out of office until after the holidays. Please expect a delay in response. Thank you for your patience.

    Best Regards,

    Aishwarya