Skip to main content
Guidoted
Associate III
March 3, 2020
Solved

How to reset TXE flag on SPI slave?

  • March 3, 2020
  • 1 reply
  • 1234 views

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.
Best answer by Danish1

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

1 reply

Danish1
Danish1Best answer
Lead III
March 3, 2020

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
March 3, 2020

Many thanks, Danish.

It seems to have solved my issues, thumbs up!

Best regards

*****