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.

TMS320F2808: Simulink&SPI Communication

Part Number: TMS320F2808

Hello,

I am currently working on a project that 2 TMS320F2808 processors should communicate using SPI communication protocol. I am using Simulink as my software tool. Moreover, with the help of the Code Composer Studio, generated C code from the Simulink is embedded to processors. The problem I encountered is that when one of the processors used as master and other one is used as slave (master sends 32 byte constant data, slave receives it and transmits it to master) , the output data of the slave (SOMI/MISO) is contaminated after a while. The time that data contamination starts is directly related to the Simulink's solver time. What could possibly be  the problem related with?

  • Hi Mert,

    Thanks for your question. Experts from Mathworks should reply to you soon.

    Best regards,
    Chen
  • Hi Mert,

    Can you better explain how the data contamination relates to Simulink?  Are you importing the C code into a project in CCS, or using Simulink to download the code (which calls a subset of CCS to do so)?

    I think this question could be quite complex.  You may be best served by contacting MathWorks Technical Support and opening a ticket.

    Cheers,

    -Brian

  • Hi Brian,

    First of all yes, I am importing the generated C code into a project in CCS. Let me explain the problem in a detailed manner. Master transmits 32 byte constant data. In order to examine the SPI data, slave also transmits the same 32 byte constant data. I am not using receive block. There isn't any other variable. Just constant blocks and transmit blocks.  I examine the data with the help of an oscilloscope to see the data on the SPI lines. At the beginning, both master output and slave output data are as it should be. However as the time passes, the slave data changes, on the other hand no changes happen. Interestingly, when I set the solver step size to 1ms the contamination occurs after 5 minutes, however, when I set the solver step size to 10 ms, the contamination occurs after approximately 50 minutes. This is the reason why I relate the problem to Simulink or the C code generated by Simulink.

    I will contact to MathWorks Tech Support, thank you for your answer.

  • Hi Mert,

    Please contact MathWorks tech support - They may need a copy of your model to they can try to recreate the issue.

    Thanks,

    -Brian