cancel
Showing results for 
Search instead for 
Did you mean: 

Infinite SPI interrupt request

VPHAM.1
Associate

Our custom board is using the stm32u585. The MCU is the master, communicating with a accelerometer through SPI port 3.When reading the data from the accelerometer, using HAL_SPI_Receive_IT or HAL_SPI_Receive_DMA, the SPI 3 interrupt is constantly generated and halts the entire system. When debugging, the variable "trigger" is always 0. And it doesn't look like the HAL_SPI_IRQHandler handle the case when "trigger" is 0. Any idea what would've caused a situation like mentioned ?

void HAL_SPI_IRQHandler(SPI_HandleTypeDef *hspi)
{
  uint32_t itsource = hspi->Instance->IER;
  uint32_t itflag   = hspi->Instance->SR;
  uint32_t trigger  = itsource & itflag;
  uint32_t cfg1     = hspi->Instance->CFG1;
  uint32_t handled  = 0UL;
   
........
  }

2 REPLIES 2
S.Ma
Principal

Not familiar with newer generation U5. B4, spi was mostly ok in master 4 wires bidirectional mode, while monodirectional was causing SCK not to be fully under sw control. I short miso and mosi externally for 3 wire spi mems. The newer feature to swap miso mosi on the same pin had the same side effect to no use. Maybe same issue here?

Try checking the flags at the ISR itself, i.e. avoiding calling the Cube/HAL functions.

Read out and check/post the SPI registers content.

JW