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.

LAUNCHXL-F28379D: Receive data from the LAUNCHXL using SCI protocol

Part Number: LAUNCHXL-F28379D
Other Parts Discussed in Thread: C2000WARE

Hello,

I'm trying to use the SCI protocol on my LAUNCHXL-F28379D. As usual, I readed the documentation and tried the examples, but they didn't work. I switch from the SCIA to SCIB (because the LAUNCHXL doesn't have PINs on SCIA) and it still doesn't work. I simplified the code, keeping the essential, so this is my code :

#include "F28x_Project.h"

#define TX 18


void scib_echoback_init(void);
void scib_fifo_init(void);
void scib_xmit(int a);
void scib_msg(char *msg);


void main(void)
{
    char *msg;

   InitSysCtrl();

   // GPIO
   InitGpio();
   GPIO_SetupPinMux(TX, GPIO_MUX_CPU1, 1);
   GPIO_SetupPinOptions(TX, GPIO_OUTPUT, GPIO_ASYNC);

   // Interrupts
   DINT;
   InitPieCtrl();
   IER = 0x0000;
   IFR = 0x0000;
   InitPieVectTable();
   EINT;

   // SCI
   scib_fifo_init();
   scib_echoback_init();

   for (;;) {
       msg = "a\0";
       scib_msg(msg);
   }
}

void scib_echoback_init()
{
    ScibRegs.SCICCR.all = 0x0007;   // 1 stop bit,  No loopback
                                    // No parity,8 char bits,
                                    // async mode, idle-line protocol
    ScibRegs.SCICTL1.all = 0x0003;  // enable TX, RX, internal SCICLK,
                                    // Disable RX ERR, SLEEP, TXWAKE
    ScibRegs.SCICTL2.all = 0x0003;
    ScibRegs.SCICTL2.bit.TXINTENA = 1;
    ScibRegs.SCICTL2.bit.RXBKINTENA = 1;

    //
    // SCIB at 9600 baud
    // @LSPCLK = 50 MHz (200 MHz SYSCLK) HBAUD = 0x02 and LBAUD = 0x8B.
    // @LSPCLK = 30 MHz (120 MHz SYSCLK) HBAUD = 0x01 and LBAUD = 0x86.
    //
    ScibRegs.SCIHBAUD.all = 0x0002;
    ScibRegs.SCILBAUD.all = 0x008B;

    ScibRegs.SCICTL1.all = 0x0023;  // Relinquish SCI from Reset
}

void scib_xmit(int a)
{
    while (ScibRegs.SCIFFTX.bit.TXFFST != 0) {}
    ScibRegs.SCITXBUF.all =a;
}

void scib_msg(char * msg)
{
    int i;
    i = 0;
    while(msg[i] != '\0')
    {
        scib_xmit(msg[i]);
        i++;
    }
}

void scib_fifo_init()
{
    ScibRegs.SCIFFTX.all = 0xE040;
    ScibRegs.SCIFFRX.all = 0x2044;
    ScibRegs.SCIFFCT.all = 0x0;
}

As you can see, I'm just sending over and over the 'a' character. In debug mode, I checked SCITXBUF from the ScibRegs and it is filled correctly (0x0061). So I think the configuration of the SCI is right. For reading, I'm using an Arduino UNO with the following code :

void setup() {
  Serial.begin(9600);
}

void loop() {
  if (Serial.available() > 0) {
    int msg = Serial.read();
    Serial.println(msg);
  }
}

Both cards are connected to my computer via USB. I connected the PIN 4 (GPIO18) of the TI card to the PIN 0 (RX) of the Arduino. But the arduino RX led doesn't light up and the Serial monitor stay empty.

I absolutly don't know where the problem is. I will be able to check on a scope monday if needed.

Thanks for your help !

  • Hello,
    We scoped our signals today. We found two issues and we absolutly don't know where they come from, even after reading again and again the TRM :
    - On the Scia we can read a SCI signal, but a strange one. For example, when we send the character 'a' (97) we receive 'f' (102). We used the example code given in the C2000Ware for our chip.
    - And we can't send any signal with the Scib, Scic and Scid. Using the code I posted before (and ajusting the matching ScixReg).

    If you have any ideas, we will test it promptly!
    Thanks again!
  • Louis,

    I am not familiar with Arduino board, but please check if there is a transceiver on just one side of the communications link. Transceivers invert the signals, and when they are on both sides of the communicating devices the inversion is canceled out. Having one inversion that does not get cancelled out could explain what you are seeing.

    I hope this helps. If this answers your question, please click the green "Verified Answer" button. Thanks.

    - Ken
  • Hello Ken, thanks for your time.

    I can't see anything about a transceiver on the arduino. I send my data to a receiver. When I try to send data over SCI from another arduino to this arduino (the one connected with my TI) it works like a charm.

    Let's imagine that there is a transceiver on the arduino. What should I do?

    And why can't I send any SCI signals on Scib, Scic and Scid?

    Thanks again.

  • Louis,

    You might want to double check that the baud rates match. Also, note that when using the peripheral register header files with the LaunchPad, in \f2837xd\common\include\device.h there is a #ifdef preprocessor directive for _LAUNCHXL_F28379D. You will need to setup this predefined symbols in your project properties.

    Under “C2000 Compiler” select “Advanced Options” and then “Predefined Symbols”. In the predefined name box (“Pre-define NAME”) click the Add icon (first icon with green plus sign). Then in the “Enter Value” window type _LAUNCHXL_F28379D (note leading underscore). Click OK to include each name. This names are used in the project to conditionally include the peripheral register header files code specific to the LaunchPad. Finally, click OK to save and close the Properties window.

    This will affect the device clocking, which will affect the baud rate. As for using other SCIs, you will need to check that they are connected to the headers and also make sure that you are configuring the GPIO correctly. Remember, there are two levels of multiplexing for the GPIOs.

    I hope this helps. If this answers your question, please click the green "Verified Answer" button. Thanks.

    - Ken
  • Thank you so much! Just adding the correct flag fixed the issue!