优化
This commit is contained in:
@@ -22,7 +22,8 @@ static HAL_StatusTypeDef SPI_Transmit(uint8_t* send_buf, uint16_t size)
|
||||
*/
|
||||
static HAL_StatusTypeDef SPI_Receive(uint8_t* recv_buf, uint16_t size)
|
||||
{
|
||||
return HAL_SPI_Receive(&hspi1, recv_buf, size, 100);
|
||||
memset(recv_buf, 0xFF, size);
|
||||
return HAL_SPI_TransmitReceive(&hspi1, recv_buf, recv_buf, size, 100);
|
||||
}
|
||||
|
||||
|
||||
@@ -135,10 +136,13 @@ AGAIN:
|
||||
{
|
||||
HAL_GPIO_WritePin(FLASH_CS_GPIO_Port, FLASH_CS_Pin, GPIO_PIN_SET);
|
||||
return 0;
|
||||
} else {
|
||||
debug("spi read data %d bytes failed:%d", nbytes, ret);
|
||||
}
|
||||
} else {
|
||||
debug("spi read cmd failed:%d", ret);
|
||||
}
|
||||
|
||||
debug("spi read failed:%d", ret);
|
||||
if (iCnt < 3) {
|
||||
iCnt++;
|
||||
goto AGAIN;
|
||||
|
||||
Reference in New Issue
Block a user