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.

UART with interrupts on TX and RX example code?

Other Parts Discussed in Thread: TMS570LS0432, HALCOGEN, TMS570LS3137

Hello,

I'm trying to use a TMS570LS0432 part and looking for examples of using the UART with interrupts so that I can minimize CPU utilization.  Basically, I would like to create a ring buffer that the foreground program can shove data into and then the interrupt task will continue sending it.

I would like to be able to do this for the TX and RX.

I think there are some examples in Halcogen, but I can't seem to find it.

Thank you!

Tom

  • Hi Tom,

    You can follow the example shown in this video for implementing an RX interrupt:
    www.youtube.com/watch

    Regards,
    Sunil
  • Tom,


    Please find attaches a CCS and Halcogen project running on TMS570LS3137.

    This project is using the SCI2 (LIN in SCI mode) The SCI2 is accessible via the USB connector on your HDK/Launch pad as virtual serial port.
    Use a serial windows terminal with the following setting: 1 Start, 9600, no parity, 1 stop.

    The project will send from MAIN a message to the serial port using Interrupt.
    On completion (within the send ISR), another message is send to the serial port using polling mode.
    Finally, back to main a 10 character message is received using interrupt. When the full message is received, it is displayed via the CCS console.

    Please let me know if this example is useful.

    8206.TMS570LS3137_SCI_Interrupt.zip

  • Hi Jean-Marc,

    I looked at the example in the video and rolled my own. I had some difficulty getting it running earlier, which is why I posted asking for examples.

    I wanted something with a circular buffer so that I could just shove stuff on the TX side into the buffer and go on about my business... unless the buffer gets full.  Then it stops and waits for the buffer to free up some space and continue on.  The same for RX, sort of.

    The example code is kind of hard to use since the TX needs to keep the buffer that is being transmitted around until it is done, not very convenient.  The RX side just waits until the requested number of bytes comes in.  Again not all that realistic a usage.  Most likely you would want to get whatever has come in and wait for more if necessary.

    I can post my solution, if anyone is interested.  But it does hack up the sci.c file, so it is definitely not Halcogen safe.  I couldn't see a way of making Halcogen safe... since I needed to remove some of the code that is generated by Halcogen.

    Also, I'm not that proud of it, a bit of a hack.

    --Tom

  • Tom,


    Please feel free to post your solution online. This is the purpose of this forum.
    Halcogen provides basic APIs. For custom solution, you can still use Halcogen to generate the initialization part and modify the APIs for fit your need.

    Thanks for your contribution.

  • Here is my working example of using UARTS with  interrupts via a circular buffer.  It is not thoroughly tested, so use at your own risk!  But if you do use and find issues, let me know.  Better yet, if you fix it, post the fixes.

    --Tom7215.SerialInterruptTest.zip