Hi all,
I'm a relatively new user of the maple, so forgive me if this is a simple question.
I'm trying to read data via the SPI bus for an accelerometer. Writing data works as expected, but using spi.read is causing me some issues.
When I send the data address out, it uses a full byte as expected. Then I use spi.read, but the chip is no longer being clocked by the spi.write command, so no data is returned to me. Since a full read cycle takes 16 clocks, the accelerometer doesnt send data until after 8 have passed. I can cheat it by writing blank data, and then the accelerometer sends data back to me, but something tells me this isnt a good way of doing it... I'm assuming it has something to do with not detecting there are unread bytes, but I'm not sure how to tell it there are.
Here is the code I have
This works:
spi.write(0xE8);
spi.write(0x00);
uint8 data2 = spi.read();
This doesnt:
spi.write(0xE8);<br />
uint8 data2 = spi.read();
Thanks
Nick