2023-05-04 04:08 PM
Hi ALL,
From the below first if condition code, when the ready/busy pin is high and the timeout is bigger than 0, timeout delay is applied. From my common sense, when external nor flash is busy, the delay should be applied, but this is totally the opposite. The next if condition code is exactly same as my expectation.
I checked other example projects code and all the same. Could you explain to me why?
void HAL_NOR_MspWait(NOR_HandleTypeDef *hnor, uint32_t Timeout)
{
uint32_t timeout = Timeout;
/* Polling on Ready/Busy signal */
while((HAL_GPIO_ReadPin(NOR_READY_BUSY_GPIO, NOR_READY_BUSY_PIN) != NOR_BUSY_STATE) && (timeout > 0))
{
timeout--;
}
timeout = Timeout;
/* Polling on Ready/Busy signal */
while((HAL_GPIO_ReadPin(NOR_READY_BUSY_GPIO, NOR_READY_BUSY_PIN) != NOR_READY_STATE) && (timeout > 0))
{
timeout--;
}
}
2023-05-04 04:48 PM
>> Could you explain to me why?
Not really psychic here, and I don't expect the authors to show up.
What STM32 part / library are we talking about?
Which NOR FLASH device?
The code shown here looks to want to go BUSY and then go READY.
Also looks really poorly bounded, with a run-time dependent on compiler and optimization settings.
2023-05-04 05:14 PM
I found the code STM32469I_EVAL and HAL library, S29GL128S90FHI02.
I can't understand the code because regardless Read/Busy pin condition, a timeout delay will be applied.