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.

LAUNCHXL-F28379D: SCI Connection in Simulink

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

Hello,

I am setting up a communication link between a Pc app and the LAUNCHXL-F280049C. I am using an external FTDI chip USB to serial converter to connect the SCI_B Rx and Tx lines from target.

The Tx works fine I am receiving the data I am sending from the target.However I am encountering a strange issue on the Rx sid: while in external mode ( which uses SCI-A ) I am trying to display 4 bytes of data sent from the PC App on SCI_B 

If I send "1234", I receive "1020". there are always zeros between the bytes received and I have no clue where it is coming from. I uploaded an image showing the data being captured on the logic analyzer.

I am relatively new to Simulink and C2000 and I though someone might have had this issue.

Your help is greatly appreciated.

Regards,

AJ

  • Response from duplicate thread:

    ----

    Hi AJ,

    Thanks for your question! Do you happen to have the number of data bits on the host PC set to a higher number than the C2000? Like you said, it looks like the the device is receiving an extra packet of data between bytes, meaning that the packet size may be mismatched between them.

    See our C2000Ware "sci_ex4_echoback.c" example for a great starting point on debugging this as well, as it basically does what you are looking to do (but the example uses the on-board transceiver instead). Make sure the data bits are set to 8 on both C2000 and PC.

    Also, would you be able to take an oscilloscope capture or logic analyzer capture of the RX line to see if there is an extra packet of 0's coming in? Thanks!

    Looking forward to hearing your responses!

    ----

    Follow up response:

    Hi AJ,

    Thanks for providing scope shots and config details, this helps a lot! It definitely does look like the configuration settings are not matching the C2000 device. See section 23.6 of the Technical Reference Manual for details on the configurable data format.

    link: https://www.ti.com/lit/pdf/sprui33

    In particular, the max number of data bits is 8, while the data length of the PC config shown is 10. This, along with the 15 bits of additional package header/terminator (assuming this is adding these bits to the beginning/end) may be causing an extra "byte" to appear.

    Here is the recommended configuration to work with "sci_ex4_echoback.c" example in C2000Ware:

    //! Open a COM port with the following settings using a terminal:
    //! - Find correct COM port
    //! - Bits per second = 9600
    //! - Data Bits = 8
    //! - Parity = None
    //! - Stop Bits = 1
    //! - Hardware Control = None

    Let me know if this helps with your issue!

    Regards,

    Vince

  • Hello Vince,

    I don't think the SCI config is the problem here. 

    you said "In particular, the max number of data bits is 8, while the data length of the PC config shown is 10", do you mean the "data Length" is set to 10 or did you use the Logic analyzer screenshot to determine that ?

    here is the test I just did:

    1. make sure the UART configuration is the same for the host and target ( from the simulink Hardware implementation window )

    on the SCI_B Rx Block, I changed the data type to uint_32 and the data length to 1:

    Now, when sending Header ('S') + 4bytes + termination (\n), I am receiving the correct 4 bytes at the output of the Rx Block : the equivalent ASCII hex for the 4 bytes I sent.

    However,

    if I set the Data length to 1 with a unit_8 type in the  SCI receive block diagram, I do not receive anything :

    Finally, If I set the data length to 4 with a uint_8 type, I receive the zeros between the different bytes:

  • Hello Vince,

    you said "In particular, the max number of data bits is 8, while the data length of the PC config shown is 10",

    Do you mean the "data Length" is set to 10 in the SCI_B Rx Config window or did you use the Logic analyzer screenshot to determine that ?

  • Hi AJ,

    I think I see the confusion happening. First I will say that I cannot really help in debugging Simulink, as it is not a TI system and therefore not something I can really assist with (or know well enough to debug). I will say however, that I do understand what you are trying to do a bit more, and see what the config window from the first image is actually showing.

    If I understand the image correctly, the data length is actually talking about the number of bytes, not the length of the data bits portion of a single byte.

    Given this, this really does seem like it is more of a mismatch on the number of bytes in a given "packet" that Simulink is configuring. Meaning you are trying to send from the PC Simulink app 4 total data bytes ("1234") of 32 bit data (you are actually using 32 bit data it appears), but were setting the "data length" to 10 bytes. Unfortunately, I do not know what Simulink does when it receives less data to send than it is expecting, but this could be the cause of the issue you were seeing (where it may be just 0-filling the gaps).

    I am sorry I cannot really assist further on this issue due to the nature of it primarily being a Simulink configuration question. If you have any questions directly related to the C2000 itself I would be more than happy to help though!

    Regards,

    Vince

    ----------------------------------------------------------------------------------------------------------------------------

    If I was able to answer your question, please press the green "Verified" button below, thanks!

  • Thank you for the feedback Vince. I will generate the code, import it into ccs and debug it there.

    I reached out to Mathworks for assistance as well .

    I though TI developed the Embedded coder addon for Matlab/Simulink and was hoping to get to the team that implemented those libraries to work with Matlab.

  • Amine,

    Just so it is clear, The Mathworks developed everything for C2000 support for all Mathworks products. They have a dedicated team for ongoing support / improvement. They can help you with any issues with their products!

  • I've got a similar problem.

    Using External mode with 379D (usb connection using SCI_A), and sending/reading data over SCI_C

    While simulink connects to the target a 0 is inserted in ALL sent and received data

    If using BUILD mode this doesn't hapens.

    If using CAN external mode (CCP) works fine.

    Mairo

  • Mario - suggest you reach out to MathWorks support