2022-05-01 03:58 AM
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 !! :)
2022-05-01 05:04 AM
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
2022-05-01 05:20 AM
@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.
2022-05-01 06:41 AM
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?
2022-05-01 10:41 AM
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 +