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: Receive data through SPI using Simulink

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

Hi Friends,

I'm trying to receive vector of data through SPI using simulink but I'm getting JUNK!!!! 

I used channel A (config as Master) to send data and channel B (config as slave) to receive the data. In addition, I enabled the RX interrupt in channel B with FIFO level 2.

Physical connections:

SPICLKA (pin 7) --> SPICLKB (pin 47)

CS-A (pin 2) --> CS-B (pin5)

SPISIMOA (pin 15) --> SPISIMOB (pin 55)

 Simulink Model:

What did I do wrong ?!?!

Thank you,

Fares Marjieh   ||   Control Engineer

  • Fares,

    Please provide a little more detail describing your issue.
    Please define "junk". Is it just bad data?
    Confirm that this is just a simple external loopback test and there are no other connections between the modules.
    What frequency are you running the SPI Master at?
    Confirm the signals in your scope capture: blue- SPISTE/CS, Yellow- SPICLK, Purple -SPISIMO

    The Simulink model does not really help us debug here. Please review the generated SPI code and compare against the SPI examples provided in C2000Ware, The basic configuration should be enough to see if there is an issue.

    Thanks,
    Mark
  • Mark hi,

    Thank you for the response.

    I meant with the"Junk" data that the data jumps between 4-5 values (jitter).

    Yes, it's a simple external loop-back test between two channels.

    The model runs with step size 62.5 us and the baud rate of the SPI is 2e6 bit/sec.

    The signals in the scope are exactly what you mentioned.

    Where can I found the SPI examples which provided in C2000ware?

    Do you know what is the difference between the "transfer master" and "transmit" simulink block ?

    BR,
    Fares Marjieh || Control Engineer
  • Fares,

    I don't understand how there is jitter on the SPI. Do you mean to say that the value transmitted is (for example) 0x0010 but you receive 0x0015? Or is it that the data to be transmitted is what is jittering. A simpler way to ask this - Is the slave correctly receiving data that the master is transmitting? Is this a SPI problem or a simulink model problem.

    SPI (and all F2803x examples ) can be found here: ..\C2000Ware_<version>\device_support\f2803x\examples\c28\

    I am not sure the difference between the simulink models. We do not create or maintain these. Mathworks Support will be better suited to answer your questions on the Mathworks models.

    -Mark