cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX NAND STM32F2

StefanoBettega1
Associate II
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 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.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
2 REPLIES 2
Amel NASRI
ST Employee
Posted on June 22, 2016 at 14:53

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.

sunny
Associate II
Posted on August 25, 2016 at 14:31

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

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/%5bSTM32L4%5d%20%5bFMC-NAND_FLASH%5d%20Integrating%20NAND%20Flash%20with%20FatFS&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17...

, so if you want to reply there than also it is fine.

Thanks,

Sunny