Electronics > Microcontrollers

STM32F4 SPI read problem

<< < (3/3)

Sherlock Holmes:

--- Quote from: Ulfberth on February 02, 2023, 02:07:07 pm ---OMG thanks guys, I was very inattentive and totally forgot that when I send read command of course I have to do dummy read, that's where this weird byte came from.

Although it's still unclear for me.Why it is 0x1C I get? because if you look at logic analyzer, it shows that there is 0x0E on MISO like when 0x10(read command) sent, so where this 1C comes from?  :-//

Also thanks for API's I will take a look at them, after I will manage to get NRF24 working with low level functions  :)

--- End quote ---

That 1C rings a bell, its been like 10 weeks now since I even looked at the NRF stuff so I've gone rusty, if you'd posted your question back then I'd have been right in there with you!

Note that whenever you send a command opcode, the NRF concurrently sends back the status register, so it could be that that you're seeing. SPI is basically just shift registers and there are two so as it shifts the bits in that you are sending, it has to shift something out, so it might as well have some use, that's why they shift the status out, just to avoid wasting that opportunity.

That characteristic is embedded in the API, all NRF command calls rely on _ReadSingleByteRegister or _WriteSingleByteRegister and these always returns the status, since the very act of issuing a command always causes the status to come back anyway, so as a convenience I always return it.

Each of the numerous API calls include that last status arg and I suspect that's what you're seeing - although the bit pattern isn't quite what I'd expect...

This is the NRF spec I used by the way.

I spent many hours on all this and was often puzzled, but I got it to make total sense in the end and the stuff I was seeing on the scope was always understood, always made sense to me but only after weeks n weeks of experimentation.





Navigation

[0] Message Index

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod