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.

TMDSCNCD28388D: SCI not outputting last character until next call

Part Number: TMDSCNCD28388D

Tool/software:

Hey,

I am working on a custom printf alike function to print over sci. At high level, I am iterating through a char array and printing each char using SCI_writeCharNonBlocking(). I am running into an issue where the last character will not be written until the next call of the function. Let says I am trying to print "Hello World", what shows up on my logic analyzer is "Hello Worl" and then the next time I call the function it would print "dHello Worl". I have been getting around this by calling a function that will print a space after the string so that the space is the character that is not written.

I know there is a better way to get around this but can't seem to figure it out. Any got ideas on why this would be happening or a better way to do this so there are no characters lost? 

  • Hi Grant,

    Are you stepping through your code with the debugger to test this? It doesn't sound like you have any characters being lost, but rather that they are being sent later than expected. I have also seen this when debugging myself; the debugger can interfere with timing of when each packet gets sent. What setting do you have configured for the FREESOFT bits?

    Are you wanting to use these messages for debugging purposes when JTAG isn't connected? If so, you shouldn't see this issue in that case.

    Also note that the SCI_writeCharNonBlocking() function will write one character at a time to the TX buffer without checking the data in the buffer, so it could also potentially overwrite data. I would recommend using a blocking function like SCI_writeCharBlockingNonFIFO() or SCI_writeCharBlockingFIFO() instead.

    Best Regards,

    Delaney

  • Thank you for your quick response Delaney. I am running it with the debugger and my SCIPRI register was set to 0. Setting it to 0x08 made it run how I had expected. Good to know that this will not be an issue when running without the debugger. 

    Also, good to know about the blocking functions. I will implement those to be safe from overwriting data. 

    Best,

    Grant