2025-03-07 3:11 AM - edited 2025-03-07 3:13 AM
I have an STM32 (SPI slave) connected to a BeagleBone Black (SPI master).
SPI Master Configuration (BBB):
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?
~AJ
2025-03-07 6:22 AM
Don't guess. Step through the code and find out where the error occurs.
2025-03-07 8:16 PM - last edited on 2025-03-08 1:37 AM by Andrew Neil
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);
}
~AJ