AnsweredAssumed Answered

Problem with SPI  in External ISR

Question asked by Mohammad Hossein on Dec 31, 2016
Latest reply on Dec 31, 2016 by S. Marsanne

Hello

I'm working with stm32f4 discovery board.I can make spi dma communication with a slave device in while(1) loop without any problem.

But I have problem to make spi communication with slave device in external interrupt service routine (I want to read data from slave device whenever a pin is set by slave and I detect this using external interrupt). The code is executed until it reaches this while loop:

while (HAL_SPI_GetState(&hspi2) == HAL_SPI_STATE_BUSY_TX);

 at this moment it stops and hangs. If I set a flag in ISR and read via SPI in while(1) loop when that flag is set by ISR, every thing is OK.

But how can I transfer data via spi in external ISR without mentioned problem?

Thanks

Outcomes