- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, I am interfacing with a 16-port GPIO expander using SPI on the PSOC5. I am using a Master SPI and am able to program the GPIO expander using the Write function of the SPI module. But know I would like to read some of the registers in the GPIO expander. I need some help with the programming for the SPI Master read. Is anyone has some examples on doing a read please share them with me.
Thank you very much,
Joe
Solved! Go to Solution.
- Labels:
-
PSoC 5 Device Programming
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The datasheet says the ReadRxData returns the next Byte per Word of received data.
No, the datasheet tells the value returned is a byte or a word depending on the bit setting of the SPI component which is 16 in your case.
So I sent 1 16bit word, so I will need to read the buffer twice.
You sent 2 (two) 16 bit values, this is the reason why you need to read the buffer twice
I'm not sure what to expect on the first read, it returns 0. What should I expect?
As I pointed out in my first post: When the very first byte/word is sent, the interface does not "know" yet what to answer, so a dummy byte/word is returned. This is zero (0) in your case and has no meaning.
Bob