AnsweredAssumed Answered

STM32CubeMX NAND STM32F2

Question asked by Bettega Stefano on Jun 21, 2016
Latest reply on Aug 25, 2016 by bhayani.sunny
Hello,
I would report a strange issue in generating the low level driver for NAND. In particular there is a problem in function HAL_NAND_Address_Inc located in stm32f2xx_hal_nand.c:

uint32_t HAL_NAND_Address_Inc(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress)
{
  uint32_t status = NAND_VALID_ADDRESS;
  
  /* Increment page address */
  pAddress->Page++;
 
  /* Check NAND address is valid */
  if(pAddress->Page == hnand->Info.BlockSize)
  {
    pAddress->Page = 0;
    pAddress->Block++;
     
    if(pAddress->Block == hnand->Info.ZoneSize)
    {
      pAddress->Block = 0;
      pAddress->Zone++;
 
      if(pAddress->Zone == (hnand->Info.ZoneSize/ hnand->Info.BlockNbr))
      {
        status = NAND_INVALID_ADDRESS;
      }
    }
  }
   
  return (status);
}

As BlockNbr holds the total number of blocks in NAND, and ZoneSize holds the size of a zone in terms of number of blocks, the test should be performed in this way:

if(pAddress->Zone == (hnand->Info.BlockNbr / hnand->Info.ZoneSize))

I'm currently using STM32CubeMx v. 4.15.0 and F2 library version 1.3.1.
Driver file is V1.1.2; is this an issue on my installation or is a problem in the library?

Thanks in advance and regards,
Stefano

Outcomes