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.

SPI communication between F28069 and DAC device (Digital to Analog Converter) using Simulink's hardware support package for C2000

Hi,

The DAC device I am using has 40 channels (AD5370 from Analog Devices). Using SPI, data comes as 24-bit word (16-bits for data and 8-bits for channel/slave address). 

I have a model in Simulink that calculates what the voltage output on this DAC should be at different times based on some conditions. So I have integrated my Simulink model with SPI Transmit and SPI Receive from C2000 hardware support package. I have read the documentation and searched online for tutorials and examples on how to set up the SPI in simulink and send 24-bit SPICLK, SPISIMO, and SPISOMI. Can someone help me? I am using the F28069 Experiment Kit with jumper cables connection SPI pins to the DAC SPI pins.

Thank you in advance! I have attached a page from the DAC datasheet.

  • Hello Venkatesh,

    Thank you for your reply. I did look at the documentation provided by Mathworks and it is not clear to me. Actually, it was the first thing I did before I posted my question on the forum. 

    The following diagram shows what I am trying to do. I have a DAC that I need to control using C2000 microcontroller and SPI. I have a simulink model that calculates what the value of the DAC needs to be and send that to the C2000 using the hardware support package and the C2000 will controller the DAC using SPI.

    The DAC is a 40 channel, 16-bit digital to analog converter. The SIMO word is a 24-bit and the first 16-bits are for data (in my case, value calculated by Simulink) and the rest 8-bits are for address/channel selection. 

    My question is how do I add address bits to the value calculated by simulink model (i,e. Value = D0 to D15 and add address to make DAC word) and pass that to the C2000 microcontroller using the hardware support so that the C2000 passes that to the DAC using SPI? DAC needs a 24-bit word and not 16. I also need to be able to vary the address/channel selection and based on the simulink model result, I need to update the DAC to use different channels at different times.

    Any help is very much appreciated! The table shows the 24-bit word the DAC needs (data in) and below that is the flow diagram I am trying to implement.

  • Hi Raeey,

    I recommend you contact Mathworks for Simulink related queries.

    www.mathworks.com/.../contact_us.html


    Thanks and Regards,
    Veena