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.

SCI2 does not receive data in UART mode

Other Parts Discussed in Thread: HALCOGEN

Hello!

I continue to get started with SCI2 module operating in UART mode. At the moment the situation is as follows: data are sent normally in polling and interrupt mode. But I cannot still receive data.

Pins LIN2RX and LIN2TX are connected together externally on the TMDX570LS20SUSB kit.  I wish to receive sent data in this way. Each sent byte should be received. The problem is so that sent bytes are not received. I tried both polling and interrupt modes. The same result for two approaches. I thought in the beginning that RX INT is incorrectly handled. Now polling mode is used for both data transmission and reception. This does not help. Obviously RX RDY flag is not set after byte is sent. I do not understand what is wrong. RX ENA and RX FUNC bits are set in the sciInit () function. Isn't this enough for data reception in polling mode? Could you please help me to solve this problem. Otherwise I will waste time without result.

I also tried to use loop back function. This does not help too.

The example project is attached.

Received data is read from SCIRD register. What does compatibility SCI mode mean? I suppose it is not a multi-buffer mode. Is it? MBUF MODE = 0 (the multi-buffer mode is disabled) and TIMING MODE = 1 (asynchronous timing is used). What is incorrect?

5277.SCI.zip 

Best regards,

Vitalij 

  • Hi Vitalij,

    TMS570LS20 USB stick comes with a demo code. The demo code transmits data to hyper terminal on PC, and receive data from the hyper terminal. Can you please run the demo if see it works? Thanks

    Regards,

    QJ

  • Hello QJ,

    Thank you for advice. I have already studied the following examples:

    1) HERCULES-SCIUART video on the disk. This example uses interrupt driven data reception and transmission. But there are several strange things in this example. For example SCI2 is used for communication with PC. But channel 13 (LIN1 high) is enabled in the VIM module. We select channel 49 for LIN2 high and channel 54 for LIN2 low during VIM configuration in HalCoGen (when interrupts are used). In this case data transmission operates OK in polling and interrupt mode. I suppose that Hyper Terminal is not installed for CCS on my PC.

    I will connect an external device to the SCI2 interface tomorrow. TMS570 will send packet of several bytes to this device and then receive response from it after some delay. But I doubt that it helps. At the moment I see that RX RDY flag is not set, when bytes are received. LIN2TX is connected to LIN2RX. Therefore, sent bytes should also be received.

    2) Another example in TI Resource Explorer (SCI_UART_9600_570LS20) uses SCI1 for data transmission.

    Or do you mean another example project? 

    P.S.

    TMDX570LS20SUB device was selected during new project creation in HalCoGen. There is an option to select TMS570LS20216SPGE device too. But the stick is equipped with TMS570LS20216ASPGEQQ1. Is this configuration correct?  

     

  • Hi

    I did a quick Example for using SCI1 ( UART) in TMDX570LS20SUSB Kit... To Receive a Charecter from external Terminal and Transmit it back.
    To Receive I used Interrupt, To transmit I used Polling mode.

    7455.SCI2_RX_TX.zip

    Attached is the HALCoGen Generated Code with Project ( Ver 3.05.00 -- Download from www.ti.com/tool/halcogen) and the Complete CCS project. ( 5.3) file.
    Read the notes above Main function for the UART Settings.

    In case you are using RM48x Kit following changes have to be noted to use

    1) SCI2 is used as UART in the development kit's. SCI2 is basically LIN2 used in SCI mode
    2) SCI2 register is referenced as scilinREG
    3) Interrupt for LIN2 must be enabled..
    4) Try accessing the .d.\examples\RM48x\example_sci_uart_9600 that comes with HALCoGen.

    Regards
    Prathap

  • Hello Prathap,

    Thank you very much for working example. It runs perfectly. I have also installed the latest version of HalCoGen as you advised.

    The only thing that I do not understand is configuration for the first byte to be received (Setup to receive Next Byte) sciReceive(UART, 1, &RX_data);

    Data is not received without this line. It was not used in my previous examples.

    Regards,

    Vitalij

  • Hi Vitalij,

    sciReceive(UART, 1, &RX_data);  is used bith in Interrupt and Polling mode.. In our used case since we use RX interrupt, this API is used only to intialize the Data pointer and length which are used in the ISR for reading.. If this is not initialized then ISR will receive the data and put it in random place, might disturb the system.

    Regards
    Prathap 

  • Could you please take a look on modified project? It uses interrupts for both RX and TX.

    When a character is received, "HELLO" is sent to terminal. It also works. Code is written in the ISR directly. Not in the sciNotification (). This approach seems for me easier and faster. Is it correct?

    2287.SCI1.zip

    I do not really understand why my previous example projects did not work. The same approach was used. I suppose that previous version of HalCoGen was not correctly installed. Several warnings appeared during installation and they were ignored.

    I will also check operation of the SCI2 port and report as soon as possible.   

    Regards,

    Vitalij

  • Hello Prathap,

    I have also added SCI2 port for my example project. So, now SCI1 and SCI2 are in use. Interrupt driven communiaction is used for both ports. All works perfecty. In my opinion, previous version of HalCoGen was installed incorrectly.

    Once again thank you very much for assistance !

    Regards,

    Vitalij Stepin 

  • Hello,

    I am having the same problem Vitalij had. When receiving a byte on the RX line, I see that the flag RX RDY in the SCIFLR register is not set ant the receive data register RD remains empty.

    The only difference between my project and the suggested 7455.SCI2_RX_TX project is that I am using polling on RX instead of interrupt. In particular, I have checked that my SCI initialization and the one contained in 7455.SCI2_RX_TX are identical.

    I have noted that the flag IDLE in the SCIFLR register gets high after the SCI configuration. Is that correct? I cannot find a way to reset this condition.

    I have noted that if I connect externally the TX and RX and send a byte to myself, this first byte solves the problem, and from that point on the IDLE bit is 0, the RX RDY gets set upon arrival of the following bytes and RD is active.

    But of course I cannot use this HW workaround in my final application, and I cannot allow to loose the first received byte ...

    Thanks in advance for your help,

    Regards,

    Elena B