Hi,
We are trying to put an image file to the NAND flash of our P1020RDB-PD board through
CodeWarrior's Flash Programmer, but have run into som problems. If we simply import the provided Target Task called P1020RDB-PD_NAND_FLASH, and use a run configuration which is set as "Connect" with the predefined target configuration P1020RDB-PD_RAM, it cannot erase or program the device with an "Erase and Program" operation.
Everything look alright to me until it all of a sudden just bail out with an error.
fl::target -lc "P1020RDB-PD RAM Connect" fl::target -b 0x2000 0x30000 fl::target -v off -l on cmdwin::fl::device -d "MT29F1G08ABAEA-eLBC" -o "128Mx8x1" -a 0x0 0x7ffffff cmdwin::fl::image -f "/<very-long-path>/example.img" -t "Auto Detect" -re on -r 0x0 0x7ffffff -oe on -o 0x0 cmdwin::fl::erase image Beginning Operation ... ------------------------- log: Trying auto-detect... log: File is NOT of type Elf Format. log: File is NOT of type Motorola S-Record Format. Auto-detection is successful. File is of type Binary/Raw Format. log: Using Algorithm: MT29FxG08-eLBC.elf log: log: log: ====================================================================== log: === Target Configuration Settings log: === Launch Configuration: P1020RDB-PD RAM Connect log: ====================================================================== log: Connecting ... Performing target initialization ... log: Connected ... log: log: ====================================================================== log: === Execute: Erase log: === Timestamp: Tue Apr 25 14:00:27 2017 log: === Flash Device: MT29F1G08ABAEA-eLBC log: === Flash Organization: 128Mx8x1 log: === Flash Mem Start Addr: 0x00000000 log: === Flash Mem End Addr: 0x07FFFFFF log: ====================================================================== Downloading Flash Device Driver ... log: Loading Flash Device Driver at: 0x00002000 log: Flash Driver Buffer is at: 0x00008800 log: Flash Driver Buffer Size is: 0x00029800 log: log: Writing the Address log: Writing the address of the sector list log: Clearing the status log: Setting up Registers log: Commanding target to run Reading flash ID ... log: Reading init return status log: Done log: log: Initialization Command Succeeded log: Writing Erase Function Code log: Writing the Address log: Writing the Number of Sectors log: Writing the address of the sector list log: Writing the sector list Erasing Sector 0x00000000 to 0x0001FFFF log: Clearing the status log: Setting up Registers log: Commanding target to run Erasing ... log: Reading erase return status Did not erase bad block at address 0x00000000 Error: Erase failed. log: Timestamp: Tue Apr 25 14:00:32 2017 Error: Erase failed.
What is more strange is that if I for example run a "Dump Flash" operation prior to the "Erase and Program" operation, the erase succeed, but it fails on the program step.
<---- Cut away identical log ------> Erasing Sector 0x00000000 to 0x0001FFFF log: Clearing the status log: Setting up Registers log: Commanding target to run Erasing ... log: Reading erase return status log: Done Erase Command Succeeded log: Timestamp: Tue Apr 25 14:24:32 2017 cmdwin::fl::write ------------------------- Using restricted address range 0x00000000 to 0x07FFFFFF Programming file /<very-long-path>/example.img log: Trying auto-detect... log: File is NOT of type Elf Format. log: File is NOT of type Motorola S-Record Format. Auto-detection is successful. File is of type Binary/Raw Format. log: Using Algorithm: MT29FxG08-eLBC.elf log: log: ====================================================================== log: === Execute: Program log: === Timestamp: Tue Apr 25 14:24:32 2017 log: === Flash Device: MT29F1G08ABAEA-eLBC log: === Flash Organization: 128Mx8x1 log: === Flash Mem Start Addr: 0x00000000 log: === Flash Mem End Addr: 0x07FFFFFF log: ====================================================================== Downloading Flash Device Driver ... log: Loading Flash Device Driver at: 0x00002000 log: Flash Driver Buffer is at: 0x00008800 log: Flash Driver Buffer Size is: 0x00029800 log: log: Writing the Address log: Writing the address of the sector list log: Clearing the status log: Setting up Registers log: Commanding target to run Reading flash ID ... log: Reading init return status log: Done log: log: Initialization Command Succeeded log: Trying auto-detect... log: File is NOT of type Elf Format. log: File is NOT of type Motorola S-Record Format. Auto-detection is successful. File is of type Binary/Raw Format. Downloading 0x00010000 bytes to be programmed at 0x00000000 Downloading 0x0000545C bytes to be programmed at 0x00010000 log: Programming 0x0000545C bytes of Target Memory at 0x00000000 log: Writing Program Function Code log: Writing the Address log: Writing the Size log: Writing the address of the buffer log: Clearing the status log: Setting up Registers log: Commanding target to run Executing program .... log: Reading program return status Error: Program failed. Flash driver reports the following error(s): Bad block detected in flash at address 0x27051956 Error: Program failed. Flash driver reports the following error(s): Bad block detected in flash at address 0x27051956
Reading and writing NAND flash from within uBoot works fine, and if I examine the results of CodeWarrior's flash attempts I see that it can indeed erase the flash. It can also write something, but the data is corrupt somehow and is not the expected image file.
I also made a quick attempt to disable the bad block handling as suggested in another thread. The programming part did succeed then according to CodeWarrior log, but data was still corrupted on target so I guess that is not the way forward.
Does anyone have an idea of why we see these issues?
BR
/ Eric
Hello Eric Fornstedt ,
I suggest you setup NOR Flash u-boot first, then mark the NAND flash block at address 0x27051956 as bad block under u-boot, please try u-boot command "nand markbad".
Thanks,
Yiping
Hello Yiping,
NOR Flash u-boot is already in place, and from there it is possible to flash NAND normally without issues. It is only from CodeWarrior it does not work.
I don't really see how marking address 0x27051956 as a bad block would be possible (I did try anyway, just in case). The P1020RDB-PD board has 128 MB of NAND flash only, so highest address would be 0x07FFFFFF right? And, the specific address/number 0x27051956 seems to be related to some magic number used by u-boot when I google it.
BR
/ Eric