This commit is contained in:
2026-09-01 14:09:31 +08:00
parent 653c7ec412
commit dac0e92ac9
11 changed files with 127 additions and 62 deletions
+6 -2
View File
@@ -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;