creating a clock signal for RPi GPIO Simulink

조회 수: 4(최근 30일)
VCOpll 2015년 5월 18일
RPi Simulink has only GPIOs and no SPI/I2C Blocks yet. This prompts me to make use of the GPIO blocks for the SPI signals. I plan to use GPIO Write for SPI_CLK, SPI_CS and SPI_MOSI and GPIO Read for SPI_MISO. (I was able to communicate to ADC and DAC through this "Software" SPI, i.e. generating the required signals just by series of 0s and 1s. But I wrote this with C).
To start with, I want to create my SPI_CLK and SPI_CS signals in Simulink. Using my model, if i replace the GPIO blocks and connect XY Graph Block to both SPI_CLK and SPI_CS, I see that the SPI_CLK port gives alternating 1s and 0s. SPI_CS port gets to LOW. But as soon as I connect GPIO Write blocks and run on my target Hardware, nothing happens. Both SPI_CLK and SPI_CS are LOW (0V).Connecting a real oscilloscope justifies this.
What is wrong with my model? (Note the Matlab function for my SPI Block is not yet complete. It only has CS and CLK up to this time. Need to resolve this issue first.)


Community Treasure Hunt

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

Start Hunting!

Translated by