This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Problem with SPI slave, getting 0xAA on first transaction

I'm using NRF51822 as SPI slave and STM32 as SPI master. Everything works fine except the first SPI transaction after resetting both boards.

On the first transaction I'm receiving 0xAA on STM while SPI slave on NRF falls into waiting for transmitting bytes I need. So, right after I reset STM32 I'm getting data from Nordic (STM initiates transaction on a high external interrupt from Nordic and checks it on the start). And all subsequent transactions go well.

Another way to get rid of this bug is resetting NRF51822 - after 1 or 2 resets the first transaction in question becomes successful (STM checks if the state of external interrupt pin changed and is active and initiates transaction again).

On the first transaction on the NRF buffers are successfully set, and new buffers are assigned in SPI slave interrupt handler. Second interrupt telling us about completion of transmission event (when NRF_SPIS1->EVENTS_END != 0) never shows up (until the second try from STM32).

Could you please help me with any ideas why this synchronization(?) issue happens on the first transaction only and only after BOTH board were restarted? It looks like it can have a hardware root cause...

Related