cancel
Showing results for 
Search instead for 
Did you mean: 

Transmit SPI data from timer interrupt, the mcu become freeze

jmary
Associate III

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 

1 ACCEPTED SOLUTION

Accepted Solutions
Erwan YVIN
ST Employee

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

 

View solution in original post

5 REPLIES 5
Mina
Associate II

I have the same problem! #SPC563

Mina
Associate II

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
Associate III

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
ST Employee

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

 

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