Question
STM32CubeMX NAND STM32F2
Posted on June 21, 2016 at 17:51
Hello,
I would report a strange issue in generating the low level driver for NAND. In particular there is a problem in functionHAL_NAND_Address_Inc
located instm32f2xx_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, andZoneSize
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.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
#stm32-cubemx-nand-driver-issue