Skip to main content
mclapd
Associate III
May 4, 2023
Question

External Nor flash - HAL_NOR_MspWait makes a delay when the ready(H)/busy(L) pin is high. Could anybody explain to me why?

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--;

 }

}

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
May 4, 2023

>> 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.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
mclapd
mclapdAuthor
Associate III
May 5, 2023

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.