2025-01-16 01:06 AM - last edited on 2025-01-16 01:10 AM by Andrew Neil
HAL_SPI_Transmit(&hspi1, NULL, 0, 0);
uint32_t error = HAL_SPI_GetError(&hspi1);
HAL_SPI_StateTypeDef spiState = HAL_SPI_GetState(&hspi1);
above lines of code i expect error = error code
spiState must be error state , but i still gets error = 0, spistate = Ready
anyone knows the reason?
Solved! Go to Solution.
2025-01-16 03:34 AM
@Andrew Neil wrote:how would the hardware detect that there is no slave attached?
It can't
To expand on that, consider how an SPI transfer works:
So you can see that there is no way for the SPI hardware itself to know whether a slave is connected or not.
Similarly for a UART.
But I2C is different - because the I2C protocol requires certain actions from the Slave