This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to create an FLM for external Nand-Flash by FMC?

Hi there,

I am taking a lot time to try creating an FLM to program some date to the FMC Nand-Flash on my homemade  board.

I already read This Tutorial and this This page, but I am NOT successful.

My MCU is STM32F429BIT6 and my Nand-Flash is H27U1G8F2BTR, I already have a demo to read/write/erase the Flash normally by HAL lib.

The Nand-Flash is 2KBytes * 64Pages * 1024Blocks = 128MBytes, so I config as this:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
struct FlashDevice const FlashDevice = {
FLASH_DRV_VERS, // Driver Version, do not modify!
"ARMFLY_STM32V6_NandFlash", // Device Name
EXT8BIT, // Device Type
0x70000000, // Device Start Address
0x08000000, // Device Size in Bytes (128MB)
2048, // Programming Page Size
0, // Reserved, must be 0
0xFF, // Initial Content of Erased Memory
6000, // Program Page Timeout 100 mSec
6000, // Erase Sector Timeout 3000 mSec
// Specify Size and Address of Sectors
0x020000, 0x000000, // Sector Size 128kB (1024 Sectors)
SECTOR_END
};
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

and finished FlashPrg.c as below:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#define DEV_ADDR 0x70000000
#define PAGE_SIZE 2048
#define BLOCK_NUM 1024
#define BLOCK_SIZE (2048 * 64)
int Init (unsigned long adr, unsigned long clk, unsigned long fnc)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_FMC_Init();
return (0); // Finished without Errors
}
int EraseSector (unsigned long adr)
{
adr -= DEV_ADDR;
NAND_AddressTypeDef nand_addr = {.Page = 0, .Block = adr / BLOCK_SIZE, .Plane = 0};
if(HAL_NAND_Erase_Block(&hnand1, &nand_addr)) {
return 1;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Of cause I rewrite the HAL_GetTick(), HAL_Delay(), and HAL_Inc() functions the same as the tutorial.

But when I load the FLM and try to program the Nand-Flash, the IDE always Programming Failed!

What‘s wrong with my FLM and How to fix it?

Thands to your help!

0