This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Need SPI read help

I've read the posts here, and searched the internet. How does one READ from a slave using a processor with SPI?

I can write just fine. I tell my slave that I'm going to write, then I put bits on the bus, and the processor sends out the data with each clock.

For reading, I tell my slave that I'm going to read... then when I read the input buffer, it is just equal to my "I'm going to read" instruction fed back to me.

How do I tell the processor to start sending clocks for a read so that my slave will start shifting out data??

If I can provide more details, please ask. Any reference to C code that reads from a slave over SPI, or any comments about what my stupid mistake is, would be greatly appreciated.

Thanks

Parents
  • Thanks, I've been thinking about that. Since data is sent and received at the same time, I could send "dummy" bits to get the clock going.

    However, my slave has one pin for input/output and this is switched by another chip. I've been having problems with overwriting data... but now that you mention it, I could write dummy bits to a disabled (disconnected from the slave input/output pin) MOSI line, and read in my data on an enabled MISO line.

    Hmm, I hope it works... Thanks for the help!

Reply
  • Thanks, I've been thinking about that. Since data is sent and received at the same time, I could send "dummy" bits to get the clock going.

    However, my slave has one pin for input/output and this is switched by another chip. I've been having problems with overwriting data... but now that you mention it, I could write dummy bits to a disabled (disconnected from the slave input/output pin) MOSI line, and read in my data on an enabled MISO line.

    Hmm, I hope it works... Thanks for the help!

Children
No data