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.

CCS/LAUNCHXL-F28069M: SCIA and SCIB used at the same time, prevents SCIB from receiving.

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

Tool/software: Code Composer Studio

Hello,

I am receiving GPS data through SCIB, and i wanted to send this thata through SCIA. I have based on the example project "Example_2806xSci_Echoback.c".

When i only use SCIB (i use pins 77 scibtx and 75 scibrx) to receive GPS data, the code works fine, it reads the data, and then processes it to extract the information i am intrested in (Latitude, longitude, speed, and another parameter). Then i connected SCIA (pins 3 sciarx and 4 sciatx) to an external display, which also seem to work fine, i have tested this connection, commenting out the SCIB portion of the code, and the screen received correct data from SCIA.

However, when i try to use both scia and scib in the same code, scib doesn't seem to correctly receive the GPS data. I think i might have a timing problem, where scib doesn't have enough time to receive all the data because i made other functions that may take too long to finish, but i amb really new to this so i might be missing sth important.

Appart from that i also wanted to ask whether it would be much more dificult to use interrupts to achieve my goal, i have never used interrupts so i am not familiar with how they work...

Here is the main loop code with comments. some functions have wierd names because i made them in my language catalan:

for(;;)
    {
    scia_msg("velocitat.val=");
    scia_msg(vel);                           // vel is a char array containing info for the display
    scia_xmit(255);
    scia_xmit(255);
    scia_xmit(255);

       }
          while(ScibRegs.SCIFFRX.bit.RXFFST ) {                               // while there is sth sent by gps and received by scib
              ReceivedChar = ScibRegs.SCIRXBUF.all;
              missatge[index] = ReceivedChar;                                       //this creates a char array of the bytes received from GPS, which sends Sentences          starting        with '$' and then the information.
              index++;
              if ('$' == ReceivedChar) {
                  index = 0;
                  analitza_paraula();                                                             //this function analyses the array "missatge" received from GPS to extract the info and update the variables "latutude", "longitude", speed etc...
              }
           }
    }

i only posted the main loop, if i comment out the first lines, from scia_msg("velocitat.val="); to the last scia_xmit(255); the code works and extracts the correct information from the GPS, but if i add these first 5 lines of code SCIB doesn't seem to read data, it never enters the   if ('$' == ReceivedChar) {} condition, neither the while (ScibRegs...) loop.

Does anyone have any idea of what could be the cause?

Thank you very much for the attention, i am really stuck at this point

  • I can post the whole code if necessary, but the main part i think is the main loop

  • UPDATE i do receive data through scib, however the NMEA sentence received seems to have some bytes skipped when scib is used in conjuction with scia.

    Then i added a kind of a "delay" by adding a counter like so:

    int counter = 0;

    for(;;)

    {

    if (counter >= 900000)

    {

    //function that sends scia data

    counter = 0;

    }

    counter++;

    }

    this whay more or less every half a second data is sent and scib reads the data just fine!

    However this can't be the right way to do it, how is this properlly done? could i use an interrupt? i tried importing code from F2806x_CpuTimers example but got errors and i am not confident about how these timers work.

    any advice will be helpfull thank you very much

  • Joan,

    Since you have it working now, it does look like it is a slight timing issue that you corrected with the delay.  (However, you might want to double check and make sure the baud rate matches, too).  As you may already know, C2000Ware also has a loopback example with interrupts:

    C:\ti\c2000\C2000Ware_<version>\device_support\f2806x\examples\c28\scia_loopback_interrupts\

    Using interrupts should help.  If you want to become more familiar with interrupts, please see the F2806x multi-day workshop at:

    http://processors.wiki.ti.com/index.php/C2000_Archived_Workshops#C2000_Piccolo_Multi-Day_Workshop_-_Revision_5.0_May_2014_.28ExpKit_F28069.3B_CCSv6.0.29

    See module 4 and lab 5 exercise (second part).  Since the workshop uses the Experimenter Kit, I have attached a document to help convert the directions to use the LaunchPad.

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

    - Ken

    8540.F28069-MDW-LP_Supplement.pdf