Reduce SPI frame timeout

This commit is contained in:
jazzpi 2022-07-30 22:25:09 +02:00
parent e0b9568e56
commit a4d6036302
2 changed files with 3 additions and 1 deletions

View File

@ -27,6 +27,8 @@
#define GET_ERROR_CMD_LEN 1
#define GET_MEASUREMENTS_CMD_LEN 1
#define SPI_FRAME_TIMEOUT 300
void spi_communication_init(SPI_HandleTypeDef* spi,
AIRStateHandler* airstatemaschine);
void checkSPI();

View File

@ -335,7 +335,7 @@ void InterSTMFrame() {
spi_transfer_complete = 0;
HAL_SPI_Receive_IT(spibus, spirxbuf, 13);
HAL_GPIO_WritePin(Inter_STM_IRQ_GPIO_Port, Inter_STM_IRQ_Pin, GPIO_PIN_SET);
uint32_t timeout = HAL_GetTick() + 500;
uint32_t timeout = HAL_GetTick() + SPI_FRAME_TIMEOUT;
while (!spi_transfer_complete && HAL_GetTick() < timeout) {
}
HAL_GPIO_WritePin(Inter_STM_IRQ_GPIO_Port, Inter_STM_IRQ_Pin, GPIO_PIN_RESET);