Creating bit stream for SPI devices
2 ビュー (過去 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 ?
回答 (1 件)
Venkatesh Chilapur 2021 年 10 月 27 日
編集済み: Venkatesh Chilapur 2021 年 10 月 27 日
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)
For additional queries please connect directly to MathWorks' tech support.