Creating bit stream for SPI devices

4 次查看(过去 30 天)
Device: Ti C2000 F2837xD Microcontroller
I'm working on controlling my device via SPI. I'm wokring on creating a model where I can output a sine wave from DAC channel 0.
To do this I need to:
Command Address Command Payload
0011 0000 sinewave date [16 data bits]
I have been trying to create my stream of data as shown below. Would this be an adequate method to creating data streams to control devices via spi ? Can i use the pack block to create a 24 bit stream ?

回答(1 个)

Venkatesh Chilapur
Venkatesh Chilapur 2021-10-27
编辑:Venkatesh Chilapur 2021-10-27
Hi,
Please refer the shipping example - c28x_spi_eeprom/Write EEPROM Data which will provide a very good overview on how you can setup the data for transmission using the SPI Master Transfer block. Command and Adress for command can be provided in the block mask of the SPI Master Transfer block under Register address field.
Also Note: If you select the STE pin provided by the SPI peripheral in Configuration Parameters, the slave is deselected between data transfers. In this case, the Explicit GPIO calls option must be used to set Slave select pin to ensure that the slave is selected continuously for multiple data transfers.
For additional queries please connect directly to MathWorks' tech support.
Regards,
Venkatesh C

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by