Creating bit stream for SPI devices

2 vues (au cours des 30 derniers jours)
Mpathan le 26 Oct 2021
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 ?

Réponses (1)

Venkatesh Chilapur
Venkatesh Chilapur le 27 Oct 2021
Modifié(e) : Venkatesh Chilapur le 27 Oct 2021
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.
Venkatesh C




Community Treasure Hunt

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

Start Hunting!

Translated by