C28x SCI transmit data using tx-fifo interrupt

18 次查看(过去 30 天)
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.

回答(1 个)

Pratyush
Pratyush 2024-7-10
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!

Translated by