cancel
Showing results for 
Search instead for 
Did you mean: 

stm32 rx and tx interrupts interfere with each other

Mz.1
Associate III

Hello,

I am using STM32H743 Nucleo-144

I have an RX EXTI interrupt which reads multiple SPI messages (a very busy channel)

also, a TX interrupt which reads UDP messages dose small calculation and sends the new messages with SPI channel (pretty busy too).

they can work individually on their own without any issues, but if I connect both of them, they start to interfere with each other, and the receiving MCU is not happy about this.

because the transmit stops in the middle of the SPI message because the CPU is now busy with the RX EXTI interrupt.

any idea what to do instead of replacing to stronger device (more the one core)?

thank you !! 🙂

4 REPLIES 4
Danish1
Lead II

In general, you shouldn't do any time-consuming or potentially-blocking activities inside an interrupt.

So instead of sending a new SPI message inside the UDP-receiving interrupt, you should queue-up the appropriate SPI message into some buffer, to be sent when SPI is ready.

When you say you receive SPI and transmit SPI, are they using the same SPI channel? That might present a problem as well - transmit and receive are not independent (unlike a UART).

Hope this helps,

Danish

Mz.1
Associate III

@Danish​  hey, thank you for your answer!!!

regarding your question:

When you say you receive SPI and transmit SPI, are they using the same SPI channel? That might present a problem as well - transmit and receive are not independent (unlike a UART).

then no, it's 2 different SPI channels.

TDK
Guru

Set a flag in the interrupt and do the processing in the main loop and/or handle the sending/receiving asynchronously (DMA or IT) instead of blocking.

Seems odd to have a TX interrupt processing UDP packets. What's the connection there?

If you feel a post has answered your question, please click "Accept as Solution".

Realy 2 ? You have MOSI1 SCK1 and MISO2 SCK2 ?

And for good network stack you need buffers and management on levels. Too DMA usage is +