cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in HAL of busy wait in flash NOR

ranran
Senior II

Hello,

Checking stm32h743 eval examples (cube) of NOR, there is a wait on busy/ready signal in code:

/* NOR Ready/Busy signal GPIO definitions */
#define NOR_READY_BUSY_PIN    GPIO_PIN_6 
#define NOR_READY_BUSY_GPIO   GPIOC
 
/**
  * @brief  NOR BSP Wait for Ready/Busy signal.
  * @param  norHandle: Pointer to NOR handle
  * @param  Timeout: Timeout duration  
  * @retval None
  */
void HAL_NOR_MspWait(NOR_HandleTypeDef *norHandle, 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--;
  }  
}

 But PC6 is connected to SDIO, not to NOR, so it seems like a bug.

I also think that this "wrong" waiting can explain another case which I've posted about problematic programming performance (large timing) in NOR programming.

What do you think ?

Thanks,

ranran

2 REPLIES 2

>>What do you think ?

I believe that's a different issue..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ranran
Senior II

It looks like it waits on a wrong pin, which has a different role (SDIO) .