2016-06-21 08:51 AM
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
2016-06-22 05:53 AM
Hi Bettega Stefano,
Thanks for highlighting this issue. It is reported internally.-Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2016-08-25 05:31 AM
Hi Mayla,
Do we need to take the suggested fix for STM32L4 as well ? Also, I am trying to use 8-bit NAND Flash with STM32L4. I am trying to modify the FMC_PCR register, but it seems it is not taking any value. After HAL_NAND_MspInit(), it is having a constant value of 0x00410 In the Reference Manual, it is mentioned that the Reset Value of this register is 0x00000 But I am seeing the value of this register as 0x0. Can you please let me know if I am missing anything here to get the default reset value of this PCR register and also how to modify the register value. Awaiting your reply. I have even posted my query , so if you want to reply there than also it is fine. Thanks, Sunny