MATLAB Answers

0

Serial Send / Serial Receive in Simulink with a TI C2000 MCU

Asked by Armin Lensker on 7 Aug 2017
Latest activity Commented on by pooja jaiswal on 26 Apr 2019
Hi all! ;)
In the last week I successfully established a serial communication between my computer and an F28069M MCU using "SCI Receive", "SCI Transmit" and "SCI Setup" blocks from the Embedded Coder package in Simulink. This MCU was associated with the COM4 port. Now I want to establish the same connection with my F28377S MCU which is associated with the COM6 port. Now I cannot use the SCI blocks from the Embedded Coder package anymore because they only support ports COM1-COM4. Therefore I am now using the "Serial Receive", "Serial Send" and "Serial Configuration" blocks from the "Instrument Control Toolbox". I already set up the COM6 port with the right baudrate and the other parameters and in all blocks (also the ones from the MCU). I set SCI_A as the used SCI module. But when I run a model on the MCU that should send and receive data to/from the computer (in normal mode, NOT in external mode), the model on my host computer only receives timeouts. However, the external mode via COM6 works perfectly. Do you know a solution? Have I forgotten to set up a certain configuration step? For example, I do not know which value I should assign to the option "Data size". I used the standard entry "[1 1]" but I want to send int16 values with header 'S' and terminator 'E'.
Best regards, Armin

  3 Comments

Hello I am communicating in serial form between launchxl-f28068&f28335 and pc, But there is a question: is it possible to transfer float data in serial communication?
Yes, I think it is possible. But I think the bit length of floats is bigger and thus could slow down the connection.

Hello I have one question that How can I know that to which com port our McU is associated. And how to do actual connection to mcu for serial communication

Sign in to comment.

1 Answer

Answer by Sumith Sekharan on 23 Nov 2017
 Accepted Answer

Hi Armin,
Instrument Control Toolbox blocks should work perfectly for your usecase. As you are sending only one int16, data size [1 1] should be fine. I have attached Host Receive block and target send block settings. One thing to notice is that header and terminator settings are different in both the blocks. Target block need '' for header and terminator as highlighted in the attached picture.
Another thing to ensure is the GPIO settings in the Model Configuration Parameters. If you are using F28377S Launchpad, for SCI_A Tx is GPIO84 and Rx is GPIO85.
Hope this helps. Let me know.
Thanks, Sumith

  1 Comment

Hi Sumith,
I figured this out myself in the meantime (the question is quite old :D ). But thank you anyway! Now people who have the same problem can easily find a solution. I am now using SCI Receive/Transmit blocks in my F28377S model and Serial Send/Receive blocks in the model for the host PC.
Best regards, Armin

Sign in to comment.