Creating bit stream for SPI devices
3 ビュー (過去 30 日間)
古いコメントを表示
Device: Ti C2000 F2837xD Microcontroller
Interfacing Device Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/AD5674-5674R-5679-5679R.pdf Page 24.
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 ?
0 件のコメント
回答 (1 件)
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.
Additional details refer the example page: Using SPI to Read and Write Data to SPI EEPROM - MATLAB & Simulink Example (mathworks.com)
Refer the FAQ on the SPI blocks: What are the use case scenarios for SPI (Master Transfer/Transmit/Receive) blocks when developing a Simulink Application for ... - MATLAB Answers - MATLAB Central (mathworks.com)
Regards,
Venkatesh C
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!