Skip to main content
Guidoted
Associate III
Mar 3, 2020 11:15 AM UTC
Solved

How to reset TXE flag on SPI slave?

I'm simulating some issues on my STM32F412 DMA SPI SLAVE because I need to avoid any unrecoverable situation.

If for any reason the TX is not empty (TXE is 0), I'm not able to reset it (set to 1) even reinitializing the peripheral.

Probably, something is missing in my deinit/reinit functions but I'm not able to find what...

Thanks and best regards

*****

This topic has been closed for replies.
Danish1
Danish1Best answer
Lead III
Mar 3, 2020 11:51 AM UTC

Have you tried setting, then resetting, the appropriate reset bit in e.g. RCC->APB1RSTR (which has bits for SPI2 and SPI3) at the start of your initialisation routine?

I tend to throw in at least one __dsb() between these so I can be sure it has taken; this helped for stm32f7.

Hope this helps,

Danisg

4 replies

Danish1
Danish1Best answer
Lead III
Mar 3, 2020 11:51 AM UTC

Have you tried setting, then resetting, the appropriate reset bit in e.g. RCC->APB1RSTR (which has bits for SPI2 and SPI3) at the start of your initialisation routine?

I tend to throw in at least one __dsb() between these so I can be sure it has taken; this helped for stm32f7.

Hope this helps,

Danisg

Guidoted
GuidotedAuthor
Associate III
Mar 3, 2020 1:27 PM UTC

Many thanks, Danish.

It seems to have solved my issues, thumbs up!

Best regards

*****