cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 SPI Slave Error (HAL_SPI_ERROR_FLAG 32)

ajmw_
Associate III

I have an STM32 (SPI slave) connected to a BeagleBone Black (SPI master).

SPI Master Configuration (BBB):

  • SCK = 15 MHz
  • Mode = SPI Mode 0
  • Data Size = 16 bits

The STM32 is attempting to transmit 2 bytes of data to the BBB using interrupt mode. However, HAL_SPI_ErrorCallback() is triggered, and the error code returned is 32 (HAL_SPI_ERROR_FLAG).

 

 

 

 HAL_SPI_Transmit_IT(&hspi2,(uint8_t*)spi_tx,1);

 

 

 

Even when the BBB is idle, running the STM32 results in this error. Any insights on what might be causing this?

ajmw__0-1741345388689.png

ajmw__1-1741345434638.png


~AJ

 

2 REPLIES 2
TDK
Guru

Don't guess. Step through the code and find out where the error occurs.

If you feel a post has answered your question, please click "Accept as Solution".
ajmw_
Associate III

I have debugged the issue and found that the error occurs in SPI_WaitFifoStateUntilTimeout(). Additionally, the STM32 receives an SPI TX interrupt even when the master is disconnected from the slave.

My final requirement is for the STM32 to transmit the DRDY signal to the BeagleBone Black (BBB). Upon receiving this signal, the BBB should provide the SCK to the STM32 and receive data from it.

 

void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi)

{

 HAL_GPIO_WritePin(BB_DRDY_GPIO_Port, BB_DRDY_Pin, 1);

 print("\r\nrx[0] = 0x%04x",rx[0]);

HAL_SPI_TransmitReceive_IT(&hspi2,(uint8_t*)tx,(uint8_t*)rx, 1);

 HAL_GPIO_WritePin(BB_DRDY_GPIO_Port, BB_DRDY_Pin, 0);



}

 

ajmw__0-1741417615719.png

~AJ