Reduce SPI frame timeout
This commit is contained in:
		@ -27,6 +27,8 @@
 | 
				
			|||||||
#define GET_ERROR_CMD_LEN 1
 | 
					#define GET_ERROR_CMD_LEN 1
 | 
				
			||||||
#define GET_MEASUREMENTS_CMD_LEN 1
 | 
					#define GET_MEASUREMENTS_CMD_LEN 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SPI_FRAME_TIMEOUT 300
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void spi_communication_init(SPI_HandleTypeDef* spi,
 | 
					void spi_communication_init(SPI_HandleTypeDef* spi,
 | 
				
			||||||
                            AIRStateHandler* airstatemaschine);
 | 
					                            AIRStateHandler* airstatemaschine);
 | 
				
			||||||
void checkSPI();
 | 
					void checkSPI();
 | 
				
			||||||
 | 
				
			|||||||
@ -335,7 +335,7 @@ void InterSTMFrame() {
 | 
				
			|||||||
  spi_transfer_complete = 0;
 | 
					  spi_transfer_complete = 0;
 | 
				
			||||||
  HAL_SPI_Receive_IT(spibus, spirxbuf, 13);
 | 
					  HAL_SPI_Receive_IT(spibus, spirxbuf, 13);
 | 
				
			||||||
  HAL_GPIO_WritePin(Inter_STM_IRQ_GPIO_Port, Inter_STM_IRQ_Pin, GPIO_PIN_SET);
 | 
					  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) {
 | 
					  while (!spi_transfer_complete && HAL_GetTick() < timeout) {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  HAL_GPIO_WritePin(Inter_STM_IRQ_GPIO_Port, Inter_STM_IRQ_Pin, GPIO_PIN_RESET);
 | 
					  HAL_GPIO_WritePin(Inter_STM_IRQ_GPIO_Port, Inter_STM_IRQ_Pin, GPIO_PIN_RESET);
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user