Skip to main content
jmary
Associate III
August 13, 2023
Solved

Transmit SPI data from timer interrupt, the mcu become freeze

  • August 13, 2023
  • 3 replies
  • 2552 views

I tried to periodically send SPI data using PIT timer on SPC572.

but whenever the timer interrupt call the SPI to transmit the data, the MCU freezing. while, when call the SPI transmit from main function, it working fine.

any suggestion to solve this issue? thanks 

This topic has been closed for replies.
Best answer by Erwan YVIN

Hello Jmary ,

i recommend to use a debugger (PLS (Windows) or TRACE32 (Windows,Linux))

1) Check where the issue with the Program Counter, R13, R14 with a debugger

2) Check your stack size maybe your stack is too small. (overflow)

               Best Regards

                                        Erwan

 

3 replies

Associate II
August 13, 2023

I have the same problem! #SPC563

Associate II
August 13, 2023

However, if you use DMA for sending and receiving messages, this issue is eliminated. Nevertheless, I still do not know the cause of this happening.

jmary
jmaryAuthor
Associate III
August 13, 2023

the problem, from spc5 RLA LLD library, i can't enable the dma on DSPI module for SPC572 mcu.

would you share the working code for spc56?

Erwan YVIN
Erwan YVINBest answer
ST Employee
August 23, 2023

Hello Jmary ,

i recommend to use a debugger (PLS (Windows) or TRACE32 (Windows,Linux))

1) Check where the issue with the Program Counter, R13, R14 with a debugger

2) Check your stack size maybe your stack is too small. (overflow)

               Best Regards

                                        Erwan

 

jmary
jmaryAuthor
Associate III
August 28, 2023

Yes, seems I found the culprit. I think it because the spi global config if used inside the timer interupt, its like calling another profile, different from the main profile. so when called "spi_lld_exchange(&SPID1, 3, txbuf, rxbuf)", then it wait the transmit forever.

any idea pass the "&SPID1" to the timer interupt event? thanks