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.

TMS320F28375D: Issues with serial port and interrupt code example implementation

Part Number: TMS320F28375D
Other Parts Discussed in Thread: LAUNCHXL-F28379D,

Tool/software:

Hey C2000 SW Team,

I have a customer evaluating the TMS320F28375D for a new platform design and they are running into issues with using basic code examples to get a simple set of tasks up and running on the LAUNCHXL-F28379D Launchpad. Please see a summary below of the expected results for the application code in addition to the actual SW code that is causing problems. Looking forward to your guidance on what the root cause of the issue could be and please let us know if you have any follow-up questions!

The basic idea was to generate code in CCS that:

  • Sets the program to generate a constant string of characters via SCIA Tx
  • Sets the SCIA ‘receive’ FIFO to generate an interrupt the moment the FIFO has received 16 characters
  • After an interrupt occurs, flush the FIFO to ensure that a new stream of characters can be received
  • Blink the LAUNCHXL F28379D “RED” LED to indicate a heartbeat
  • Blink the LAUNCHXL F28379D “BLUE” LED to indicate an interrupt took place

We expected this to be simple but cannot get it to work.

Can you please help us to understand what it is that we are doing wrong.  For example, here is the code we have:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/******************************************************************************
* File: Using the default sci_ex2_loopback_interrupts.c and overriding with new code
* Title: SCIA FIFO Loopback with Interrupt + LED Blink (F28379D, DriverLib)
*
* Description:
* - Initializes the F28379D system clock and peripherals via DriverLib.
* - Configures SCIA for 8-bit data, 1 stop bit, no parity, 300 baud.
* - Enables FIFO mode, triggers interrupt when 16 bytes are received.
* - By default uses internal loopback. If you define EXT_LOOPBACK,
* it disables internal loopback (so you'd wire TX->RX externally).
* - On each interrupt, reads the RX FIFO into rdataA, blinks GPIO31 (LED),
* and sets messageArrived=true.
* - In main(), we toggle a second LED (GPIO34) to show we're alive
* and send data out SCIA, which loops back (internally or externally).
* - Both LEDs start OFF.
* - Adds a 250ms delay at the beginning to show LEDs are off.
*
* Requirements:
* 1) Link driverlib.lib (or driverlib_coff/eabi.lib if your project is COFF/EABI).
* 2) Proper driverlib include paths in Project Properties > C2000 Compiler > Include Options.
* 3) A valid.cmd linker file (e.g. 2837xD_flash_lnk_cpu1.cmd).
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

-Matt Calvo

  • Hey Arnav,

    I already pinged you over email but also wanted to reach out on this thread for my customer's awareness. We know it is currently the weekend so once you return to office on Monday can you please help to prioritize providing feedback ASAP so that we can get my customer the support they need? Feel free to let us know if you have any follow-up questions on their HW/SW setup or if anything needs further clarification. 

    Looking forward to your reply!

    -Matt

  • Hi Matt,

    A few notes regarding the code:

    1) The method they're using to set SCI loopback is configuring the wrong bits. Use the SCI_enableLoopback API from driverlib

    2) Having a big delay inside an interrupt is never recommended. It would make more sense to have that LED blink in the main loop or replace it with a single toggle. SCI_clearOverflowStatus would also need to be called at the end to avoid potential overflow related errors

    3) The if() block starting at line 146 may not be entered immediately, since SCI transmission will take some time. This may take multiple iterations of the main loop to complete, which will lead to overflows. The main loop can instead wait till messageReceived is set (in a while() loop for example), then execute the block

    4) For ease of use, customers can use the SysCtl_delay and DEVICE_DELAY_US APIs for inserting delays instead of creating a custom implementation

    The code should work as expected once these issues are taken care of. Let me know if there are any other queries.

    Regards,

    Arnav

  • Thank you so much for taking the time to go through my customer's code and helping identify the issues to address!

    I'll go ahead and pass this along to my customer and will have them comment back on this thread directly with any additional issues or follow-up questions that they have.

    Best regards,

    Matt