Clear Filters
Clear Filters

C28x SCI transmit data using tx-fifo interrupt

12 views (last 30 days)
David
David on 7 May 2024
Answered: Pratyush on 10 Jul 2024 at 7:35
Hello,
I am currently in the process of setting up serial communication from the C2000 to a host system. Larger data blocks (>120 bytes) are to be transmitted at regular intervals (50 ms).
I do not want to use the "Wait until previous data transmitted" option in the C28x SCI Transmit Block, because the blocking mode of the SCI blocks other tasks.
However, if I deactivate this function, the Tx FIFO is only filled once (16 bytes) and then the call is returned. The rest of the data to be transferred is discarded.
Is there a way how I can use the SCI simulink block in combination with the Transmit FIFO lvl interrupt?
The transmission of larger data packets (including an additional header and terminator) should be started in a periodically called subsystem (50 ms). The transmit FIFO interrupt should then be used to write the data to the FIFO as soon as the FIFO is empty or almost empty.

Answers (1)

Pratyush
Pratyush on 10 Jul 2024 at 7:35
Hi David,
To achieve non-blocking transmission of larger data packets (>120 bytes) using the SCI transmit FIFO level interrupt in Simulink for the C2000, you can try out these steps:
1. Periodic Subsystem: Create a subsystem triggered every 50 ms to initiate the transmission of your data packet (including header and terminator).
2. SCI Transmit Block: Configure the C28x SCI Transmit block in Simulink:
  • Select the appropriate SCI module.
  • Set the desired baud rate.
  • Uncheck "Wait until previous data transmitted".
3. FIFO Level Interrupt Handling: Implement custom code to manage the FIFO level interrupt:
  • Enable the FIFO level interrupt to trigger when the FIFO is empty or reaches a certain level.
  • Write an Interrupt Service Routine (ISR) to handle the interrupt, checking the FIFO level and loading more data if needed.
  • Maintain a buffer to manage the data to be transmitted.
Use Embedded Coder to include the custom code within your Simulink model.
Hope this helps.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!