LAUNCHXL-F28379D: Transmitting data using SCI api

Part Number: LAUNCHXL-F28379D

Tool/software:

Hello there,

I am trying to transmit an array of data using SCI_writeCharArray() in a tx ISR and my understanding is this function writes the entire array at once and send it out but if you look at the attached screenshot line# 319 executed while SCI_writeCharArray() is still writing. I want the enable pin to go low after I finished the transmission of data not before or in between the transmission.

I know there are APIs which puts one char at a time on the shift register (e.g. SCI_writeCharBlockingFIFO()) but that will trigger the ISR for each byte, what I want is send data in one shot and then make the enable pin go low.

I also try the something like this:

while(SCI_getTxFIFOStatus(SCIB_BASE))

{

          SCI_writeCharArray(SCIB_BASE, g_send_data, g_count);

}

but didn't work. 

Note: In the attached screenshot we are coming to ISR only once which is good but line#319 executing before or with line#317 is not good.

  • Hi Sumit,

    What is the total number of data you are wanting to send in one go? The SCI FIFOs are 16 levels deep, meaning that the max number you can send in one go would be 16. What is your TXFFIL?

    Can you please expand on what you mean when it "didn't work"? What are the exact symptoms of the issue? Are you seeing incorrect/missing data? Is there an error in the code? Is the GPIO or interrupt behavior incorrect/unexpected? It is a bit difficult to tell from the information given so far and I want to make sure I have the full picture here. I attached images of the APIs from driverlib below if you have not already been reviewing them.

    Best Regards,

    Allison

  • Allison,

    so far I haven't sent more than 16 byte in one go. Tx fifo level is 2.

    This issue is (sometimes) line# 319 executes before line# 317 finishes. I see the api is using for loop so it should not do that. As per my application requirement EnablePin (line#319) should go low only after sending the data (line #317).

    Should I increase the fifo level?

  • Hi Sumit,

    Thanks for the response.

    What you can do is first wait until TX FIFO level = 0 (so the TX FIFO is completely empty meaning that the data has been shifted out). Then you can write the GPIO. Note that a polling loop in an ISR like this is generally not recommended as it will add delay in your ISR.

    I also wanted to mention a bug with SCI_writeCharArray() if you use FIFO mode and are trying to transmit 16 characters at a time:

    • Notice the line: while(SCI_getTxFIFOStatus(base) == SCI_FIFO_TX15) is incorrect.
    • The correct code there should be while(SCI_getTxFIFOStatus(base) == SCI_FIFO_TX16). 
      • This is because the program should wait in the while loop while the FIFO is full (if the FIFO is not full, that indicates that there is at least one space available to write to)

    Best Regards,

    Allison

  • Thank you Allison, closing this one now