To support a new NAND in WinCE BSP, you need add the NAND information into file "WINCE600\PLATFORM\COMMON\SRC\SOC\COMMON_FSL_V2_PDK1_9\NAND\INC\NANDTYPES.h".
The "NANDCode" line is hard to get from NAND datasheet, you can also print it ot from driver code, file "WINCE600\PLATFORM\COMMON\SRC\SOC\COMMON_FSL_V2_PDK1_9\NAND\FMDCOMMON\BIG_SECTOR_INTERLEAVE\fmd.cpp"
Function FMD_Init(), you can add the debug message as followed:
... ...
CSPNAND_Reset(i);
FullCode = CSPNAND_ReadID(i);
//only support multi-nand with same type
//only support multi-nand connected continously
RETAILMSG(TRUE, (TEXT("NAND FullCode = 0x%x\r\n"), FullCode)); // Print out the current NAND flash code
for(j = 0; j < sizeof(ChipInfo)/sizeof(ChipInfo[0]); j++)
... ...
An example to support the NAND NAND01GW3B2CNb
//NAND01GW3B2CNb
{
{NAND, 1024, 2048 * 64, 64, 2048}, //FlashInfo fi;
{0x20, 0xF1, 0x00, 0x1d}, //BYTE NANDCode[NANDID_LENGTH]
3, //BYTE NumBlockCycles
5, //BYTE ChipAddrCycleNum
8, //BYTE DataWidth
1, //BYTE BBMarkNum
{0}, //BYTE BBMarkPage
6, //BYTE StatusBusyBit
0, //BYTE StatusErrorBit
64, //WORD SpareDataLength
0x70, //BYTE CmdReadStatus
0x00, //BYTE CmdRead1
0x30, //BYTE CmdRead2
0x90, //BYTE CmdReadId
0xff, //BYTE CmdReset
0x80, //BYTE CmdWrite1
0x10, //BYTE CmdWrite2
0x60, //BYTE CmdErase1
0xD0, //BYTE CmdErase2
{30, 20, 25, 6} //NANDTiming timings
},
with this parameters all test's was passed ok. Its interesting, but Freescale BSP write 2 copies of EBOOT to the NAND. 6 block is needed for 1 copy at 2k page size
Hi Radist ,
Please help me to solve this issue: iMX6Q NAND Boot issue in WinCE
Thanks.
With regards,
Keshava G N
Hi Keshave G N!
i was out of internet few weeks :smileyhappy: Will read your questions and contact
you soon.
Keshava G N пишет:
>
Freescale Community <https://community.freescale.com/index.jspa>
<https://community.freescale.com/index.jspa>
>
You have been mentioned
by Keshava G N <https://community.freescale.com/people/KeshavaGN> /in
Re: How to add a new NAND Flash support in iMX WinCE BSP -blog archive
in Freescale Community/ - View Keshava G N's reference to you
<https://community.freescale.com/message/313359#313359>
Thank you Makovetskyi!
With regards,
Keshava G N
Member - Technical (Software)
From: Sergii Makovetskyi
Sent: Monday, January 28, 2013 12:53 AM
To: Keshava G N
Subject: Re: - How to add a new NAND Flash support in iMX WinCE BSP -blog archive
How to add a new NAND Flash support in iMX WinCE BSP -blog archive
created by Sergii Makovetskyi in i.MX Community - View the full discussion
Offset (in blocks) | Block count | Block name | Offset variable name in BSP | Description |
0 | 4 | BCB | IMAGE_BOOT_NCB_NAND_OFFSET | Boot Control Block |
4 | 4 | BBT | IMAGE_BBT_NAND_OFFSET | Bad Block Table |
8 | 2 | DBBT | IMAGE_BOOT_DBBT_NAND_BLOCKS | Bad block table used by ROM |
10 | 12 | EBOOT IMAGE 1 | IMAGE_BOOT_BOOTIMAGE_NAND_BLOCKS | Eboot image, 2 copy (6 * 2) NOTE: EBOOT assumes these NAND regions are block-aligned |
SPLASH SCREEN 1 | ||||
EBOOT IMAGE 2 | ||||
SPLASH SCREEN 2 | ||||
22 | 1 | IMAGE_BOOT_BOOTCFG_NAND_BLOCKS | Boot configuration | |
23 | 1 | IMAGE_BOOT_UUID_NAND_BLOCKS | UUID | |
24 | XXX (32MB) | NKIMAGE | IMAGE_BOOT_NKIMAGE_NAND_OFFSET | OS WinCE Kernel 32MB |
XXX | Last block | FFS | Flash File System | |
IMAGE_BOOT_NANDDEV_RESERVED_SIZE (for NAND with 2k page, 64 pages in block) = 24*2048*64 + 32*1024*1024 = 35*1024*1024 | ||||
IMAGE_BOOT_NANDDEV_RESERVED_SIZE (for NAND with 4k page, 128 pages in block) = 24*4096*128 + 32*1024*1024 =44*1024*1024 |
Hi,
yes, exactly. And it work ok when i am using resistors for boot mode configuration. Than i remove boot mode resistors, set pull down resistor to LCD_RS (enable boot from source, that configured by OTP fuses). And tried to boot from NAND 1Gbit? but... xldr started ok and eboot have crashed.
Than i change IMAGE_BOOT_BOOTIMAGE_NAND_BLOCKS back to 512. And its start work ok.
Do you know why it is work in that way? have you tried too boot from OTP-configured boot source?
There is a BSP bug in file "image_cfg.h", it defines IMAGE_BOOT_BOOTIMAGE_NAND_BLOCKS (512)
That means the EBoot reserved 512 blocks NAND size, for 128KB block size NAND, it is 64MB, it is not reasonable, and this will cause system hang up when we used the small size NAND.
The code should be updated as followed:
#define IMAGE_BOOT_BOOTIMAGE_NAND_BLOCKS (8)
Do you know, what is the minimum size for the IMAGE_BOOT_NANDDEV_RESERVED_SIZE ?
i just sent it to 32M and its work now. But i think its too small...
result is the same:
11876 PID:400002 TID:ea0002 reset GPMI module
11876 PID:400002 TID:ea0002 --SMA DEBUG: NAND FullCode = 0x9580f12c
11904 PID:400002 TID:ea0002 --SMA DEBUG: NAND FullCode = 0x0
11904 PID:400002 TID:ea0002 NumberOfChip=1
11904 PID:400002 TID:ea0002 ECC_ConfigLayout
11941 PID:400002 TID:ea0002 --SMA debug: BSP_GetNANDImageCfg IMAGE_BOOT_NANDDEV_RESERVED_SIZE = 0x4600000
11941 PID:400002 TID:ea0002 --SMA debug: BSP_GetNANDImageCfg IMAGE_BOOT_NANDDEV_RESERVED_SIZE = 0x4600000
11941 PID:400002 TID:ea0002 INFO: Set NAND flash blocks [0x0 ~ 0x22f] as reserved.
11941 PID:400002 TID:ea0002 --SMA debug1: dwNandSize = 0x4600000
11941 PID:400002 TID:ea0002 --SMA debug1: dwBytesPerBlock = 0x20000
12001 PID:400002 TID:ea0002 ERROR: C:\WINCE600\PLATFORM\COMMON\SRC\SOC\MX28_FSL_V2_PDK1_9\MEDIA\NAND\CORE\.\cspnand.c line 505:
12001 PID:400002 TID:ea0002 FMD_Deinit: FMD Driver is unloading (c095d8a0)
NAND code is correct, chip is 1Gbit. With 8G and 4G everything is ok...
ok, thanks, i already made the same steps. Only 1 difference -i set IMAGE_BOOT_NANDDEV_RESERVED_SIZE to 64M, you have set it to 70M. Now i am rebuilding my OS with 70M.
NAND support for iMX28 (BSP version: WCE600_10.08.02_SDK.msi)
The detail steps for me to support the 128MB SLC NAND NAND01GW3B2CNb:
1. Catalog -> iMX28-EVK-PDK1_9-Monility -> Third Party -> BSP -> Freescale i.MX28 EVK PDK1_9: ARMV4I -> Device Drivers -> SD Controller
remove "SSP2 SDHC"
2. Catalog -> iMX28-EVK-PDK1_9-Monility -> Device Drivers -> Storage Devices -> MSFlash Drivers
select "Flash MDD"
3. Visual Studio 2005 menu: Project -> iMX28-EVK-PDK1_9-Mobility Property ...
Configuration Properties -> Environment
remove "imgsdmmc"; add "imgnand" and set value to 1.
4. BSP code, modify file “WINCE600\PLATFORM\COMMON\SRC\SOC\COMMON_FSL_V2_PDK1_9\NAND\INC\NANDTYPES.h”, data structure NandChipInfo ChipInfo[], added the followed codes:
//NAND01GW3B2CNb
{
{NAND, 1024, 2048 * 64, 64, 2048}, //FlashInfo fi;
{0x20, 0xF1, 0x00, 0x1d}, //BYTE NANDCode[NANDID_LENGTH]
3, //BYTE NumBlockCycles
5, //BYTE ChipAddrCycleNum
8, //BYTE DataWidth
1, //BYTE BBMarkNum
{0}, //BYTE BBMarkPage
6, //BYTE StatusBusyBit
0, //BYTE StatusErrorBit
64, //WORD SpareDataLength
0x70, //BYTE CmdReadStatus
0x00, //BYTE CmdRead1
0x30, //BYTE CmdRead2
0x90, //BYTE CmdReadId
0xff, //BYTE CmdReset
0x80, //BYTE CmdWrite1
0x10, //BYTE CmdWrite2
0x60, //BYTE CmdErase1
0xD0, //BYTE CmdErase2
{30, 20, 25, 6} //NANDTiming timings
},
5. BSP code, modify file "WINCE600\PLATFORM\iMX28-EVK-PDK1_9\SRC\INC\image_cfg.h”, modify IMAGE_BOOT_NANDDEV_RESERVED_SIZE as followed:
#define IMAGE_BOOT_NANDDEV_RESERVED_SIZE (DWORD)((DWORD)(70 * 1024 * 1024))
I mean next things, Did you had error "ERROR: C:\WINCE600\PLATFORM\COMMON\SRC\SOC\MX28_FSL_V2_PDK1_9\MEDIA\NAND\CORE\.\cspnand.c line 505: 11877 PID:400002 TID:ea0002 FMD_Deinit: FMD Driver is unloading (c095d8a0)" before changing IMAGE_BOOT_NANDDEV_RESERVED_SIZE with right NANDcode.
My NAND code is right, because eboot can see this chip and able to format it.
Yes, I see such error when I set NANDCode to wrong.
Did you had the same error that i have? before you have changed this variable
yes, NAND ID is correct and i can see NAND from eboot. able to format it.
Yes, ofcourse i already made it. Strange situation. Small difference - i have tried to change variable to 64 or 128 MB, i did not tried to set 70. Will try to do it now. I am using SLC MT29F1G08ABADAW. Did you had the same error that i had? before you have changed this variable
Did you print out the NAND ID with the followed code?
RETAILMSG(TRUE, (TEXT("NAND FullCode = 0x%x\r\n"), FullCode)); // Print out the current NAND flash code
Yes I used the iMX28 EVK board, with the 128MB SLC NAND (NAND01GW3B2CNb), I think you need rebuild both the eboot and NK.
Hi! Thanks for the answer,
its interesting, but i also update this variable and its still not work. What kind of NAND are you using? Do you work with iMX28 ?
To support a small NAND, the IMAGE_BOOT_NANDDEV_RESERVED_SIZE in image_cfg.h should be updated. For example, I had modified it to "#define IMAGE_BOOT_NANDDEV_RESERVED_SIZE (DWORD)((DWORD)(70 * 1024 * 1024))" for a 128MB NAND, it works fine.