Skip to main content
DGast.1
Associate III
Mar 22, 2023 10:02 AM UTC
Solved

In stm32h743, in SPI, enabling the EOT IRQ after the other IRQs are enabled makes the SPI ISR to be fired endlessly. Why?

In stm32h743, in SPI, I have a slave device with interrupts enabled. In particular, I'm enabling all the error interrupts (UDR, OVR, CRCERR, FRE, MODF), and the RXP, TXP and EOTIE interrupts, in that order.

If I enable EOTIE the first of all of them, everything goes fine. If I enable it after the TXP (as above), the SPI ISR gets fired endlessly. I read the SR reg. within it and its value is 0x12 (TXTF and TXP set), which makes sense because I didn't fill the TxFIFO, but I don't see why it fires all the time.

Any idea why this happens?

This topic has been closed for replies.
FBLBest answer
ST Technical Moderator
Mar 23, 2023 12:46 PM UTC

As mentioned by Pavel, you should follow the sequence.

Here is another thread about the same topic SPI EOT interrupt triggered right after SPI enable (st.com)

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL

4 replies

ST Technical Moderator
Mar 22, 2023 2:28 PM UTC

Hello @DGast.1​,

> If I enable it after the TXP (as above) 

I think the screenshot you intended to share is still not attached.

Would you mind adding it for better understanding?

Thanks

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL
DGast.1
DGast.1Author
Associate III
Mar 22, 2023 5:43 PM UTC

Sorry, I meant if I enable it as I explained above, that is, after TXP. It's difficult to add the code to explain it as it is enabled within a RTOS' driver.

Pavel A.
Mar 23, 2023 3:16 AM UTC

> Any idea why this happens?

The ISR will be re-entered immediately again while the interrupt source is active and unmasked (and the whole peripheral's interrupt is enabled in NVIC). This is how NVIC works.

Duplicate:

https://community.st.com/s/question/0D53W00002CJMvdSAH/in-stm32h743-is-the-txp-interrupt-fired-endlessly-until-the-tx-fifo-is-full

FBLBest answer
ST Technical Moderator
Mar 23, 2023 12:46 PM UTC

As mentioned by Pavel, you should follow the sequence.

Here is another thread about the same topic SPI EOT interrupt triggered right after SPI enable (st.com)

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL