cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_SPI_TxRxCpltCallback function called after random delay (about 1ms)

AColino
Associate

I have a random strange delay on SPI2 callback function on my SPI slave application.

Normally the function is called regular after interrupt handling without delay but casually is affected by 1ms delay before its execution!

void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi)
{
	if(hspi->Instance==SPI1) // SPI MASTER
	{
		ACC_ADXL_355.wTransferState = TRANSFER_COMPLETE;
		ACC_ADXL_345.wTransferState = TRANSFER_COMPLETE;
		ACC_MA_352.wTransferState = TRANSFER_COMPLETE;
		ACC_ADIS_16209.wTransferState = TRANSFER_COMPLETE;
	}
	else if(hspi->Instance==SPI2) // SPI SLAVE
	{
		SamplingData.SPI_Slave.wTransferState = TRANSFER_COMPLETE;
	}
}

This make an error on SPI slave response and the master receive a wrong data packet.

Do you have any suggestion to avoid this condition and call this function wiyhout delay?

uP part number: STM32L071CBTx

0693W00000NqdIeQAJ.png0693W00000NqdJNQAZ.png0693W00000NqdLEQAZ.pngSTM32CubeIDE

Version: 1.9.0

Build: 12015_20220302_0855 (UTC)

OS: Windows 7, v.6.1, x86_64 / win32

Java vendor: AdoptOpenJDK

Java runtime version: 11.0.11+9

Java version: 11.0.11

0 REPLIES 0