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

조회 수: 18 (최근 30일)
Armin Lensker
Armin Lensker . 2017년 8월 7일
답변: Hassan Abouobaida . 2020년 6월 3일
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
pooja jaiswal
pooja jaiswal 2019년 4월 26일

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

댓글을 달려면 로그인하십시오.

채택된 답변

Sumith Sekharan
Sumith Sekharan 2017년 11월 23일
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
  댓글 수: 2
beshoy abdou
beshoy abdou 2020년 5월 11일
편집: beshoy abdou 님. 2020년 5월 11일
can you send to me small simulink model for using Receive/Transmit blocks in F28377S model and serial send/Receive blocks in the model for the host PC.
my email:
Besy regards, beshoy

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Hassan Abouobaida
Hassan Abouobaida 2020년 6월 3일
have the same difficult (using serial exchange method), i want to transmit/receive data from DSP F28335 by interfacing Simulink/Matlab and/or save the data in .mat file, but I encountered difficulties especially in oversizing, I tried to use a 32-bit size and the IQN tools but, here is the message I received:
An error occurred while propagating data type 'sfix32_En18' from 'SCI_A_send / Fractional part IQN x int32', output port 1.
Email :
Thank you
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 6월 3일
Before sending through the serial port, you will probably have to do a typecast of sfix32_En18 to uint32 ... and the destination will have to also be working with representation equivalent to sfix32_En18

댓글을 달려면 로그인하십시오.

Hassan Abouobaida
Hassan Abouobaida 2020년 6월 3일
Using Int32 as type of data to send, i receive the folowing answer :
Error evaluating registered method 'PostPropagationSetup' of MATLAB S-Function 'c2000hostsci_tx' in 'SCI_A_send/SCI Transmit'. The following is the MATLAB call stack (file names and line numbers) that produced this error:
['C:\MATLABB\supportpackages\r2014a\tic2000\blocks\masks\c2000hostsci_tx.m'] [184]
['C:\MATLABB\toolbox\rtw\rtw\tlc_c.m'] [180]
['C:\MATLABB\toolbox\coder\simulinkcoder_core\+coder\+internal\ModelBuilder.m'] [590]
['C:\MATLABB\toolbox\coder\simulinkcoder_core\+coder\+internal\@ModelCodegenMgr\make_rtw.m'] [8]
['C:\MATLABB\toolbox\rtw\rtw\make_rtw.m'] [18]
['C:\MATLABB\toolbox\simulink\simulink\private\build_target.p'] [93]
['C:\MATLABB\toolbox\simulink\simulink\private\build_target.p'] [5]
['C:\MATLABB\toolbox\simulink\simulink\private\build_standalone_rtw_target.p'] [59]
['C:\MATLABB\toolbox\simulink\simulink\private\slbuild_private.p'] [733]
['C:\MATLABB\toolbox\simulink\simulink\private\slbuild_private.p'] [408]
['C:\MATLABB\toolbox\simulink\simulink\sl.m'] [15]
['C:\MATLABB\toolbox\simulink\simulink\slbuild.m'] [61]
['C:\MATLABB\toolbox\rtw\rtw\sl_internal_customization.m'] [537]
Index exceeds matrix dimensions.
Thank you for help

Community Treasure Hunt

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

Start Hunting!

Translated by