2018-07-11 11:13 AM
Hi,
I used to have the SPI1 working connected to MAX31865 breakout board. For some reason it's not working at all now. I traced into the code, seems HAL_SPI_Transmit() failed on
__HAL_SPI_GET_FLAG(hspi, SPI_FLAG_TXE) until timeout.
Seems the TXE flag never get set. Not sure what's going on.
And all of the SPI1 instance registers (CR1, CR2, SR, DR...) have value 0. See below screen shot.
I am kind of don't believe all the registers value be 0 first. Secondly it used to be functional not long ago.
Is there anything I am missing here?
Thx
if (__HAL_SPI_GET_FLAG(hspi, SPI_FLAG_TXE))
{ if (hspi->TxXferCount > 1U) { /* write on the data register in packing mode */ hspi->Instance->DR = *((uint16_t *)pData); pData += sizeof(uint16_t); hspi->TxXferCount -= 2U; } else { *((__IO uint8_t *)&hspi->Instance->DR) = (*pData++); hspi->TxXferCount--; } } else { /* Timeout management */ if ((Timeout == 0U) || ((Timeout != HAL_MAX_DELAY) && ((HAL_GetTick() - tickstart) >= Timeout))) { errorcode = HAL_TIMEOUT; goto error; } }2018-07-11 11:34 AM
Suggests you haven't enabled the SPI1 clock.
2018-07-11 01:48 PM
Yeah, you are right. This is the new project I just created to isolate the SPI issue I am seeing not sending out data. Now I have it fixed and able to see the registers value. Thx