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.

Sending data from Matlab/Simulink to Concerto F28M35H52C1 via Ethernet UDP

Dear, all


I'm trying to exchange data between the Host PC and my control card via UDP, but there're  problems occured.

I've read and tried the example program at the website: https://www.mathworks.com/help/supportpkg/texasinstrumentsc2000concerto/examples/exchanging-ethernet-data-with-the-f28m3x-concerto-processor.html#responsive_offcanvas

With default setting, the results are shown below:

  

It seems to be nothing came out from the Host UDP Recieve block, so I gave another try.

At the first, I tried to send a signal from Concerto to the Host PC.


         

It worked. I then tried to send a data from Host PC to Concerto.

In this case, I used the Host UDP Send block to send a command to Concerto, and tried to control the LED.

No matter I set 0 or 1 in the constant block, the LED lights on, so I guess that there's nothing came out from the M3 UDP Recieve block and thus the value remained 0. 

Is there any other setting need to be done in order to enable data sending from Host PC to Concerto?

Thanks in advance!

  • Hello Kuan,

    Please see Brian's post in this thread e2e.ti.com/.../2087799

    MathWorks support for C2000:

    The main link for MathWorks Support is: www.mathworks.com/.../

    There is C2000 info in:

    Documentation - www.mathworks.com/.../search.html
    Examples - www.mathworks.com/.../search
    MATLAB Answers - www.mathworks.com/.../index

    Best Regards,
    Adam Dunhoft
  • Hello Kuan Shen

    Seems like you are using a broadcast from the host to the target. Are you sure that the host and the target are in the same network?

    If yes, can you please do one thing, you can use a enabled subsystem and trigger the LED based on the status of the UDP Receive being 0.

    In Concerto UDP and TCP blocks, a status of 0 indicates that the receive has been successful. What I reckon here is that the successful receive is soon followed by a unsuccessful receive due to the sampling time mismatch or anything of that sort, leading to the LED turning off again.

    Thus I reckon the best way is to trigger the LED or any control logic based on the status.

    Let me know if this works.

    Regards

    Sandeep

  • Dear Sandeep

    Thanks for your reply.


    The Host PC is able to receive data from Concerto via UDP, so I think they are in the same network.
    Thus, as your suggestion, I tested an enable subsystem like this:

    After that, I added this enable subsystem to the previous programs.

    I expect that the value send  to the LED should be held as 1 after I ran the Host program and thus turn the LED off. However, the result was still the same, that is, no matter I set 0 or 1 in the constant block, the LED lights on.

    Did I misunderstand what you told to me or I used the enable subsystem in the wrong way?

    Also, if this status of 0 means the data I want to send from the Host PC to Concerto has been received by Concerto successfully, how can I save those data I desire and make sure I can use them in the target program? 

    Thank you very much.

    Best Regards,
    Kuan Shen

  • Dear Sandeep

    I found that I've misunderstood about the meaning of Status of the M3 UDP Receive block.

    So I test the output: Status by LED via these programs:

    The output value of Data was strange number closed to 0.

    The output value of Status was always 1, which represents an error in data reception.

    Is this situation same as what you reckon? Also, how can I fix this problem?

    Best Regards,
    Kuan Shen

  • Hello Kuan

    I think the way you are using the enabled subsystem is wrong. I would rather prefer you read the data based on the status being equal to 0. 

    Let me know if this solves your question. You can add whatever you want to do with the data in the enabled subsystem block. 

  • Dear Sandeep

    I tried these programs:

    In this test, I send a constant from Host PC to Concerto, and Concerto should directly send back this data to Host PC. Moreover, the constant will be send to LED in order to check the constant.

    As the result, what I got from the send back data was 0. Furthermore, the LED remain light on, which means "Data" output was always 0. However, the value I actually send from the Host PC is 1.

    Does this mean that the "Status" output value is always 1, which means the reception was never successful?

    If it does, is it possible for me to solve this problem only by modifying the programs?

  • Hello Kuan

    I dont understand what is going wrong here. I see the models look ok, as long as inside the enabled subsystem all you are doing is copy from input to output. 

    Can you verify the data is going properly to the target via WireShark or something? In WireShark i would rather like to see the data in this case. 

    Can you tell me which release of MATLAB and Concerto support package version are you using. I think that is critical as in January we had some fixes for Ethernet for Concerto Support package.

    Regards

    Sandeep

  • Dear Sandeep

    Yes, inside the enabled subsystem all I'm doing is copy from input to output.

    My MATLAB is 2016a and the version of support package is 16.1.2, rather than the latest version.
    Also, thanks for your advise, though I have no idea how to use WireShark. I'll try to find some information about this.


    Best Regards,
    Kuan Shen

  • Dear Sandeep

    As you suggestion, I used Wireshark to check the data.

    I ran the same programs but I change the data type from single to int8.

    I found this data in Wireshark which has same value as the constant I send in Host PC model. Also, the port number is match to the configuration in the model.

    Does this mean that the data has been send successfully but not received by the target? 

    Best Regards,
    Kuan Shen

  • Hello Kuan
    I see that you are doing a UDP broadcast. Can you set the IP address of the target instead. In UDP there is no way to know if it was received by the target.
    Regards
    Sandeep
  • Dear Sandeep

    It seems work. That's amazing!

    The data send to target is now same as the data send back to Host PC.

    Thank you very much for your help.

    Best Regards,
    Kuan Shen