[U-Boot] Flash Not Erased Problem with M29W128GL

Hi Friends,
I have my custom board with MCF5329 processor and M29W128GL (16MB NOR). I have LTIB package from freescale of M5329EVB board. I am using this package and modified according M29W128GL NOR. Like
* FLASH organization */ #define CONFIG_SYS_FLASH_CFI #ifdef CONFIG_SYS_FLASH_CFI # define CONFIG_FLASH_CFI_DRIVER 1 # define CONFIG_SYS_FLASH_SIZE 0x1000000 /* Max size that the board might have */ # define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT # define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of memory banks */ # define CONFIG_SYS_MAX_FLASH_SECT 137 /* max number of sectors on one chip */ # define CONFIG_SYS_FLASH_PROTECTION /* "Real" (hardware) sectors protection */ #endif
And Enviroment Configuration:
#define CONFIG_SYS_FLASH_BASE CONFIG_SYS_CS0_BASE
/* Configuration for environment * Environment is embedded in u-boot in the second sector of the flash */ #define CONFIG_ENV_OFFSET 0x40000 #define CONFIG_ENV_SECT_SIZE 0x20000 #define CONFIG_ENV_SIZE 0x2000 #define CONFIG_ENV_IS_IN_FLASH 1
And U-boot output after flash using JTAG:
U-Boot 2011.09 (Jan 15 2013 - 14:03:02)
CPU: BTAM MCF5329 (Mask:54 Version:2) CPU CLK 240 MHz BUS CLK 80 MHz Board: BTAM 5329 I2C: ready DRAM: 32 MiB Reserving 512k for protected RAM at 41f80000 Top of RAM usable for U-Boot at: 41f80000 Reserving 155k for U-Boot at: 41f59000 Reserving 256k for malloc() at: 41f19000 Reserving 58 Bytes for Board Info at: 41f18fc6 Reserving 88 Bytes for Global Data at: 41f18f6e Reserving 64k for boot parameters at: 41f08f6e Stack Pointer at: 41f08f48 Start relocate of code from 00000400 to 41f59000 Now running in RAM - U-Boot at: 41f59000 Flash: flash detect cfi fwc addr (null) cmd f0 f000 16bit x 8 bit fwc addr 000000aa cmd 98 9800 16bit x 8 bit is= cmd 51(Q) addr 00000020 is= 5100 5100 is= cmd 52(R) addr 00000022 is= 5200 5200 is= cmd 59(Y) addr 00000024 is= 5900 5900
device interface is 2 found port 2 chip 1 port 16 bits chip 8 bits 00 : 51 52 59 02 00 40 00 00 00 00 00 27 36 b5 c5 04 QRY..@.....'6... 10 : 04 09 10 04 02 03 04 18 02 00 06 00 01 7f 00 00 ................ 20 : 02 00 00 00 00 00 00 00 00 00 00 00 00 41 f0 8e .............A.. fwc addr (null) cmd f0 f0 8bit x 8 bit fwc addr 00000aaa cmd aa aa 8bit x 8 bit fwc addr 00000555 cmd 55 55 8bit x 8 bit fwc addr 00000aaa cmd 90 90 8bit x 8 bit fwc addr (null) cmd f0 f0 8bit x 8 bit fwc addr 000000aa cmd 98 9800 16bit x 8 bit manufacturer is 2 manufacturer id is 0x0 device id is 0x22 device id2 is 0x0 cfi version is 0x3133 size_ratio 1 port 16 bits chip 8 bits found 1 erase regions erase region 0: 0x0200007f erase_region_count = 128 erase_region_size = 131072
fwc addr (null) cmd f0 f0 8bit x 8 bit Portwidth: 1 Chipwidth: 1 Man ID : 0 Device ID: 34 flash_protect ON: from 0x00000400 to 0x000213FF fwc addr (null) cmd 70 70 8bit x 8 bit flash_is_busy: 0 protect on 0 fwc addr 00020000 cmd 70 70 8bit x 8 bit flash_is_busy: 0 protect on 1 flash_protect ON: from 0x00040000 to 0x0005FFFF fwc addr 00040000 cmd 70 70 8bit x 8 bit flash_is_busy: 0 protect on 2 16 MiB *** Warning - bad CRC, using default environment
Destroy Hash Table: 41f7beb4 table = (null) Create Hash Table: N=105 INSERT: table 41f7beb4, filled 1/107 rv 41f19414 ==> name="bootdelay" value="5" INSERT: table 41f7beb4, filled 2/107 rv 41f19480 ==> name="baudrate" value="115200" INSERT: table 41f7beb4, filled 3/107 rv 41f1936c ==> name="ethaddr" value="00:e0:0c:bc:e5:60" INSERT: table 41f7beb4, filled 4/107 rv 41f1930c ==> name="ipaddr" value="192.162.1.2" INSERT: table 41f7beb4, filled 5/107 rv 41f194e0 ==> name="serverip" value="192.162.1.1" INSERT: table 41f7beb4, filled 6/107 rv 41f191d4 ==> name="gatewayip" value="192.162.1.1" INSERT: table 41f7beb4, filled 7/107 rv 41f19654 ==> name="netmask" value="255.255.255.0" INSERT: table 41f7beb4, filled 8/107 rv 41f194a4 ==> name="hostname" value="M5329EVB" INSERT: table 41f7beb4, filled 9/107 rv 41f1954c ==> name="netdev" value="eth0" INSERT: table 41f7beb4, filled 10/107 rv 41f194ec ==> name="loadaddr" value="40010000" INSERT: table 41f7beb4, filled 11/107 rv 41f19564 ==> name="u-boot" value="u-boot.bin" INSERT: table 41f7beb4, filled 12/107 rv 41f194b0 ==> name="load" value="tftp ${loadaddr) ${u-boot}" INSERT: table 41f7beb4, filled 13/107 rv 41f1960c ==> name="upd" value="run load; run prog" INSERT: table 41f7beb4, filled 14/107 rv 41f193cc ==> name="prog" value="prot off 0 3ffff;era 0 3ffff;cp.b ${loadaddr} 0 ${filesize};save" INSERT: free(data = 41f19008) INSERT: done In: serial Out: serial Err: serial U-Boot relocated to 41f59000 Net: No PHY device found. FEC0 ### main_loop entered: bootdelay=5
### main_loop: bootcmd="<UNDEFINED>" -> saveenv Saving Environment to Flash... Data to save 0x1f000, 0x40000, 0x5ffff Data (start 0x41000, len 0x1f000) saved at 0x41f1a058 Protect off 00040000 ... 0005FFFF Un-Protecting sectors 2..2 in bank 1 fwc addr 00040000 cmd 70 70 8bit x 8 bit flash_is_busy: 0 . done Un-Protected 1 sectors EXPORT table = 41f7beb4, htab.size = 107, htab.filled = 19, size = 4092 Unsorted: n=19 0: 41f191d4 ==> gatewayip => 192.162.1.1 1: 41f191e0 ==> stdout => serial 2: 41f192d0 ==> stderr => serial 3: 41f1930c ==> ipaddr => 192.162.1.2 4: 41f1936c ==> ethaddr => 00:e0:0c:bc:e5:60 5: 41f1939c ==> stdin => serial 6: 41f193cc ==> prog => prot off 0 3ffff;era 0 3ffff;cp.b ${loadaddr} 0 ${filesize};save 7: 41f19414 ==> bootdelay => 5 8: 41f19480 ==> baudrate => 115200 9: 41f194a4 ==> hostname => M5329EVB 10: 41f194b0 ==> load => tftp ${loadaddr) ${u-boot} 11: 41f194e0 ==> serverip => 192.162.1.1 12: 41f194ec ==> loadaddr => 40010000 13: 41f1951c ==> mem => 32256k 14: 41f1954c ==> netdev => eth0 15: 41f19564 ==> u-boot => u-boot.bin 16: 41f195b8 ==> ethact => FEC0 17: 41f1960c ==> upd => run load; run prog 18: 41f19654 ==> netmask => 255.255.255.0 Erasing Flash...!Erase Flash from 0x00040000 to 0x0005ffff in Bank # 1 fwc addr 00040aaa cmd aa aa 8bit x 8 bit fwc addr 00040555 cmd 55 55 8bit x 8 bit fwc addr 00040aaa cmd 80 80 8bit x 8 bit fwc addr 00040aaa cmd aa aa 8bit x 8 bit fwc addr 00040555 cmd 55 55 8bit x 8 bit fwc addr 00040000 cmd 30 30 8bit x 8 bit flash_is_busy: 0 . done Erased 1 sectors Writing to Flash...! My Debug info :Flash Addr = 40000, Config Env Size = 20000, Env Size = 1fffc Flash not Erased Protecting sectors 2..2 in bank 1 fwc addr 00040000 cmd 70 70 8bit x 8 bit flash_is_busy: 0 . done Protected 1 sectors -> I am having problem with Flash Not Erased.
Please help me.
Thanks & Warm Regards, Ramesh
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Disclaimer~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Information contained and transmitted by this e-mail is confidential and proprietary to iGATE and its affiliates and is intended for use only by the recipient. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, copying or use of this e-mail is strictly prohibited and you are requested to delete this e-mail immediately and notify the originator or mailadmin@igate.com mailto:mailadmin@igate.com. iGATE does not enter into any agreement with any party by e-mail. Any views expressed by an individual do not necessarily reflect the view of iGATE. iGATE is not responsible for the consequences of any actions taken on the basis of information provided, through this email. The contents of an attachment to this e-mail may contain software viruses, which could damage your own computer system. While iGATE has taken every reasonable precaution to minimise this risk, we cannot accept liability for any damage which you sustain as a result of software viruses. You should carry out your own virus checks before opening an attachment. To know more about iGATE please visit www.igate.com http://www.igate.com. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Dear Ramesh,
this issue could be connected to a patch i recently posted to the list, where the erase command is now allowed to be customizable for CFI AMD compatible chips only.
Are you using board_flash_get_legacy in your board files ?
If yes, could you just add after line 1834 in cfi_flash.c
info->cmd_reset = AMD_CMD_RESET; + info->cmd_erase_sector = AMD_CMD_ERASE_SECTOR;
And report back if erasing now works ?
Many Thanks, Angelo Dureghello

Thank you so much Angelo,
I am not using board_flash_get_legacy in my board.
In then function flash_erase() there is one function for flash_write_cfiword() in that there is one check for if flash is erased or not. In that code there is one reading of byte and it returns 0x00. so that is problem. Following is the line here, in that flag gets 0 and this function returns ERR_NOT_ERASED.
case FLASH_CFI_8BIT: flag = ((flash_read8(dstaddr) & cword.c) == cword.c); break;
static int flash_write_cfiword (flash_info_t * info, ulong dest, cfiword_t cword) { void *dstaddr = (void *)dest; int flag; flash_sect_t sect = 0; char sect_found = 0;
/* Check if Flash is (sufficiently) erased */ switch (info->portwidth) { case FLASH_CFI_8BIT: flag = ((flash_read8(dstaddr) & cword.c) == cword.c); break; case FLASH_CFI_16BIT: flag = ((flash_read16(dstaddr) & cword.w) == cword.w); break; case FLASH_CFI_32BIT: flag = ((flash_read32(dstaddr) & cword.l) == cword.l); break; case FLASH_CFI_64BIT: flag = ((flash_read64(dstaddr) & cword.ll) == cword.ll); break; default: flag = 0; break; } if (!flag) return ERR_NOT_ERASED;
Thanks & Warm Regards, Ramesh
-----Original Message----- From: Angelo Dureghello [mailto:sysamfw@gmail.com] Sent: Wednesday, January 16, 2013 5:09 AM To: u-boot@lists.denx.de Cc: Ramesh K Khokhani Subject: Re: [U-Boot] Flash Not Erased Problem with M29W128GL
Dear Ramesh,
this issue could be connected to a patch i recently posted to the list, where the erase command is now allowed to be customizable for CFI AMD compatible chips only.
Are you using board_flash_get_legacy in your board files ?
If yes, could you just add after line 1834 in cfi_flash.c
info->cmd_reset = AMD_CMD_RESET; + info->cmd_erase_sector = AMD_CMD_ERASE_SECTOR;
And report back if erasing now works ?
Many Thanks, Angelo Dureghello
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Disclaimer~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Information contained and transmitted by this e-mail is confidential and proprietary to iGATE and its affiliates and is intended for use only by the recipient. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, copying or use of this e-mail is strictly prohibited and you are requested to delete this e-mail immediately and notify the originator or mailadmin@igate.com mailto:mailadmin@igate.com. iGATE does not enter into any agreement with any party by e-mail. Any views expressed by an individual do not necessarily reflect the view of iGATE. iGATE is not responsible for the consequences of any actions taken on the basis of information provided, through this email. The contents of an attachment to this e-mail may contain software viruses, which could damage your own computer system. While iGATE has taken every reasonable precaution to minimise this risk, we cannot accept liability for any damage which you sustain as a result of software viruses. You should carry out your own virus checks before opening an attachment. To know more about iGATE please visit www.igate.com http://www.igate.com. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Dear Ramesh,
i am running last u-boot (pulled yesterday) on a coldfire m5307 and a SST 16bit flash, erasing works fine.
From your debug trace seems the correct erasing command (0x30) is
sent.
But the function you mentioned detect that flash is not erased.
Are you using a 16bit port for data connection to the flash ?
First check i would do is an "erase" test.
Try to erase some sectors with "erase" command, something like
# erase 40000 4ffff
Then dump the memory, (to be sure also with BDM eventually), to see if it has really been erased.
Also, these are some settings i am using in my config, maybe they can be useful:
/* * Start addresses for the final memory configuration * (Set up by the startup code) * Please note that CONFIG_SYS_SDRAM_BASE _must_ start at 0 */ #define CONFIG_SYS_SDRAM_BASE 0x00000000 #define CONFIG_SYS_SDRAM_SIZE 16 /* in MB */ #define CONFIG_SYS_FLASH_BASE 0xffc00000 #define CONFIG_SYS_TEXT_BASE 0xffc00000 #define CONFIG_SYS_MAX_FLASH_BANKS 1 #define CONFIG_SYS_MAX_FLASH_SECT 1024 #define CONFIG_SYS_FLASH_ERASE_TOUT 1000
/* * CFI FLASH driver setup */ #define CONFIG_SYS_FLASH_CFI #define CONFIG_FLASH_CFI_DRIVER #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
...
Let us know if you find something.
Regards, Angelo

Hi Angelo,
Still having problem.
Can I have your flash_cfi.c code file?
Thanks & Regards, Ramesj
-----Original Message----- From: Angelo Dureghello [mailto:sysamfw@gmail.com] Sent: Wednesday, January 16, 2013 3:56 PM To: u-boot@lists.denx.de Cc: Ramesh K Khokhani Subject: Re: [U-Boot] Flash Not Erased Problem with M29W128GL
Dear Ramesh,
i am running last u-boot (pulled yesterday) on a coldfire m5307 and a SST 16bit flash, erasing works fine.
From your debug trace seems the correct erasing command (0x30) is
sent.
But the function you mentioned detect that flash is not erased.
Are you using a 16bit port for data connection to the flash ?
First check i would do is an "erase" test.
Try to erase some sectors with "erase" command, something like
# erase 40000 4ffff
Then dump the memory, (to be sure also with BDM eventually), to see if it has really been erased.
Also, these are some settings i am using in my config, maybe they can be useful:
/* * Start addresses for the final memory configuration * (Set up by the startup code) * Please note that CONFIG_SYS_SDRAM_BASE _must_ start at 0 */ #define CONFIG_SYS_SDRAM_BASE 0x00000000 #define CONFIG_SYS_SDRAM_SIZE 16 /* in MB */ #define CONFIG_SYS_FLASH_BASE 0xffc00000 #define CONFIG_SYS_TEXT_BASE 0xffc00000 #define CONFIG_SYS_MAX_FLASH_BANKS 1 #define CONFIG_SYS_MAX_FLASH_SECT 1024 #define CONFIG_SYS_FLASH_ERASE_TOUT 1000
/* * CFI FLASH driver setup */ #define CONFIG_SYS_FLASH_CFI #define CONFIG_FLASH_CFI_DRIVER #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
...
Let us know if you find something.
Regards, Angelo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Disclaimer~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Information contained and transmitted by this e-mail is confidential and proprietary to iGATE and its affiliates and is intended for use only by the recipient. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, copying or use of this e-mail is strictly prohibited and you are requested to delete this e-mail immediately and notify the originator or mailadmin@igate.com mailto:mailadmin@igate.com. iGATE does not enter into any agreement with any party by e-mail. Any views expressed by an individual do not necessarily reflect the view of iGATE. iGATE is not responsible for the consequences of any actions taken on the basis of information provided, through this email. The contents of an attachment to this e-mail may contain software viruses, which could damage your own computer system. While iGATE has taken every reasonable precaution to minimise this risk, we cannot accept liability for any damage which you sustain as a result of software viruses. You should carry out your own virus checks before opening an attachment. To know more about iGATE please visit www.igate.com http://www.igate.com. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Dear Ramesh,
i am using last u-boot form git / master.
You can get the file fome there, just go to u-boot site, custodians, click "master", selct tree and click on the file.
Still, some questions:
How is the flash connected, as 8 or 16 bit data port ? Is the flash connected stirght D0/D15 to D0/D15 of the cpu ?
Did you try to add the TIMEOUT config field, as i posted ?
Can you try to use the command "erase" and dump to see if the flash can get erased ?
Regards, Angelo

Hi Angelo,
Thank you so much for replying me.
Now, I get the file from u-boot site as you have directed.
In our hardware flash is connected as 16-Bit Data Port means straight D0/D15 of flash to D0/D15 of CPU.
No I haven't used TIMEOUT config field any way.
I have tried erase command but cant run erase command. I will try it today proper.
Second thing I have tried my custom code in cfi_flash.c file to write data in flash in write_buff(). So it works but it can not wite first 15-20 byte and then after it writes all bytes.
Thanks & Regards, Ramesh
-----Original Message----- From: Angelo Dureghello [mailto:sysamfw@gmail.com] Sent: Sunday, January 20, 2013 7:59 PM To: u-boot@lists.denx.de Cc: Ramesh K Khokhani Subject: Re: [U-Boot] Flash Not Erased Problem with M29W128GL
Dear Ramesh,
i am using last u-boot form git / master.
You can get the file fome there, just go to u-boot site, custodians, click "master", selct tree and click on the file.
Still, some questions:
How is the flash connected, as 8 or 16 bit data port ? Is the flash connected stirght D0/D15 to D0/D15 of the cpu ?
Did you try to add the TIMEOUT config field, as i posted ?
Can you try to use the command "erase" and dump to see if the flash can get erased ?
Regards, Angelo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Disclaimer~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Information contained and transmitted by this e-mail is confidential and proprietary to iGATE and its affiliates and is intended for use only by the recipient. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, copying or use of this e-mail is strictly prohibited and you are requested to delete this e-mail immediately and notify the originator or mailadmin@igate.com mailto:mailadmin@igate.com. iGATE does not enter into any agreement with any party by e-mail. Any views expressed by an individual do not necessarily reflect the view of iGATE. iGATE is not responsible for the consequences of any actions taken on the basis of information provided, through this email. The contents of an attachment to this e-mail may contain software viruses, which could damage your own computer system. While iGATE has taken every reasonable precaution to minimise this risk, we cannot accept liability for any damage which you sustain as a result of software viruses. You should carry out your own virus checks before opening an attachment. To know more about iGATE please visit www.igate.com http://www.igate.com. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hi Angelo & Wolfgang,
I can erase perfectly but can read perfectly.
One thing is that I can write some data in debug mode and without debug mode I cant write any bytes in flash.
You can see as follows:
-> md 0x40000
00040000: ffffffff ffffffff ffffffff ffffffff ................ 00040010: ffffffff ffffffff ffffffff ffffffff ................ 00040020: ffff6861 63743d46 45433000 65746861 ..hact=FEC0.etha 00040030: 6464723d 30303a65 303a3063 3a62633a ddr=00:e0:0c:bc: 00040040: 65353a36 30006761 74657761 7969703d e5:60.gatewayip= 00040050: 3139322e 3136322e 312e3100 686f7374 192.162.1.1.host 00040060: 6e616d65 3d4d3533 32394556 42006970 name=M5329EVB.ip 00040070: 61646472 3d313932 2e313632 2e312e32 addr=192.162.1.2 00040080: 006c6f61 643d7466 74702024 7b6c6f61 .load=tftp ${loa 00040090: 64616464 72292024 7b752d62 6f6f747d daddr) ${u-boot} 000400a0: 006c6f61 64616464 723d3430 30313030 .loadaddr=400100 000400b0: 3030006d 656d3d33 32323536 6b006e65 00.mem=32256k.ne 000400c0: 74646576 3d657468 30006e65 746d6173 tdev=eth0.netmas 000400d0: 6b3d3235 352e3235 352e3235 352e3000 k=255.255.255.0. 000400e0: 70726f67 3d70726f 74206f66 66203020 prog=prot off 0 000400f0: 33666666 663b6572 61203020 33666666 3ffff;era 0 3fff -> erase 0x40000 0x5ffff
- Warning: 1 protected sectors will not be erased! done Erased 1 sectors -> protect off all
Un-Protect Flash Bank # 1 ................................................................................................................................ done -> erase 0x40000 0x5ffff . done Erased 1 sectors -> md 0x40000
00040000: ffffffff ffffffff ffffffff ffffffff ................ 00040010: ffffffff ffffffff ffffffff ffffffff ................ 00040020: ffffffff ffffffff ffffffff ffffffff ................ 00040030: ffffffff ffffffff ffffffff ffffffff ................ 00040040: ffffffff ffffffff ffffffff ffffffff ................ 00040050: ffffffff ffffffff ffffffff ffffffff ................ 00040060: ffffffff ffffffff ffffffff ffffffff ................ 00040070: ffffffff ffffffff ffffffff ffffffff ................ 00040080: ffffffff ffffffff ffffffff ffffffff ................ 00040090: ffffffff ffffffff ffffffff ffffffff ................ 000400a0: ffffffff ffffffff ffffffff ffffffff ................ 000400b0: ffffffff ffffffff ffffffff ffffffff ................ 000400c0: ffffffff ffffffff ffffffff ffffffff ................ 000400d0: ffffffff ffffffff ffffffff ffffffff ................ 000400e0: ffffffff ffffffff ffffffff ffffffff ................ 000400f0: ffffffff ffffffff ffffffff ffffffff ................
(My comment: Without debug cant write.)
-> save Saving Environment to Flash... . done Un-Protected 1 sectors Erasing Flash...! . done Erased 1 sectors Writing to Flash...! done . done Protected 1 sectors -> md 0x40000
00040000: ffffffff ffffffff ffffffff ffffffff ................ 00040010: ffffffff ffffffff ffffffff ffffffff ................ 00040020: ffffffff ffffffff ffffffff ffffffff ................ 00040030: ffffffff ffffffff ffffffff ffffffff ................ 00040040: ffffffff ffffffff ffffffff ffffffff ................ 00040050: ffffffff ffffffff ffffffff ffffffff ................ 00040060: ffffffff ffffffff ffffffff ffffffff ................ 00040070: ffffffff ffffffff ffffffff ffffffff ................ 00040080: ffffffff ffffffff ffffffff ffffffff ................ 00040090: ffffffff ffffffff ffffffff ffffffff ................ 000400a0: ffffffff ffffffff ffffffff ffffffff ................ 000400b0: ffffffff ffffffff ffffffff ffffffff ................ 000400c0: ffffffff ffffffff ffffffff ffffffff ................ 000400d0: ffffffff ffffffff ffffffff ffffffff ................ 000400e0: ffffffff ffffffff ffffffff ffffffff ................ 000400f0: ffffffff ffffffff ffffffff ffffffff ................
(With debug I can write but first after 36 bytes.)
-> printenv
EXPORT table = 41f7b0b4, htab.size = 107, htab.filled = 19, size = 0 Unsorted: n=19 0: 41f181d4 ==> gatewayip => 192.162.1.1 1: 41f181e0 ==> stdout => serial 2: 41f182d0 ==> stderr => serial 3: 41f1830c ==> ipaddr => 192.162.1.2 4: 41f1836c ==> ethaddr => 00:e0:0c:bc:e5:60 5: 41f1839c ==> stdin => serial 6: 41f183cc ==> prog => prot off 0 3ffff;era 0 3ffff;cp.b ${loadaddr} 0 ${filesize};save 7: 41f18414 ==> bootdelay => 5 8: 41f18480 ==> baudrate => 115200 9: 41f184a4 ==> hostname => M5329EVB 10: 41f184b0 ==> load => tftp ${loadaddr) ${u-boot} 11: 41f184e0 ==> serverip => 192.162.1.1 12: 41f184ec ==> loadaddr => 40010000 13: 41f1851c ==> mem => 32256k 14: 41f1854c ==> netdev => eth0 15: 41f18564 ==> u-boot => u-boot.bin 16: 41f185b8 ==> ethact => FEC0 17: 41f1860c ==> upd => run load; run prog 18: 41f18654 ==> netmask => 255.255.255.0 baudrate=115200 bootdelay=5 ethact=FEC0 ethaddr=00:e0:0c:bc:e5:60 gatewayip=192.162.1.1 hostname=M5329EVB ipaddr=192.162.1.2 load=tftp ${loadaddr) ${u-boot} loadaddr=40010000 mem=32256k netdev=eth0 netmask=255.255.255.0 prog=prot off 0 3ffff;era 0 3ffff;cp.b ${loadaddr} 0 ${filesize};save serverip=192.162.1.1 stderr=serial stdin=serial stdout=serial u-boot=u-boot.bin upd=run load; run prog
Environment size: 432/8188 bytes -> md 40000
00040000: ffffffff ffffffff ffffffff ffffffff ................ 00040010: ffffffff ffffffff ffffffff ffffffff ................ 00040020: ffffffff 63743d46 45433000 65746861 ....ct=FEC0.etha 00040030: 6464723d 30303a65 303a3063 3a62633a ddr=00:e0:0c:bc: 00040040: 65353a36 30006761 74657761 7969703d e5:60.gatewayip= 00040050: 3139322e 3136322e 312e3100 686f7374 192.162.1.1.host 00040060: 6e616d65 3d4d3533 32394556 42006970 name=M5329EVB.ip 00040070: 61646472 3d313932 2e313638 2e312e32 addr=192.168.1.2 00040080: 006c6f61 643d7466 74702024 7b6c6f61 .load=tftp ${loa 00040090: 64616464 72292024 7b752d62 6f6f747d daddr) ${u-boot} 000400a0: 006c6f61 64616464 723d3430 30313030 .loadaddr=400100 000400b0: 3030006d 656d3d33 32323536 6b006e65 00.mem=32256k.ne 000400c0: 74646576 3d657468 30006e65 746d6173 tdev=eth0.netmas 000400d0: 6b3d3235 352e3235 352e3235 352e3000 k=255.255.255.0. 000400e0: 70726f67 3d70726f 74206f66 66203020 prog=prot off 0 000400f0: 33666666 663b6572 61203020 33666666 3ffff;era 0 3fff
Why this happening I don't know.
Second things is like in flash_get_size() function it become portwidth = 1 because of our M29W128GL has interface code = 2 (X8X16).
Please help me.
Thanks a lot.
-----Original Message----- From: Angelo Dureghello [mailto:sysamfw@gmail.com] Sent: Sunday, January 20, 2013 7:59 PM To: u-boot@lists.denx.de Cc: Ramesh K Khokhani Subject: Re: [U-Boot] Flash Not Erased Problem with M29W128GL
Dear Ramesh,
i am using last u-boot form git / master.
You can get the file fome there, just go to u-boot site, custodians, click "master", selct tree and click on the file.
Still, some questions:
How is the flash connected, as 8 or 16 bit data port ? Is the flash connected stirght D0/D15 to D0/D15 of the cpu ?
Did you try to add the TIMEOUT config field, as i posted ?
Can you try to use the command "erase" and dump to see if the flash can get erased ?
Regards, Angelo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Disclaimer~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Information contained and transmitted by this e-mail is confidential and proprietary to iGATE and its affiliates and is intended for use only by the recipient. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, copying or use of this e-mail is strictly prohibited and you are requested to delete this e-mail immediately and notify the originator or mailadmin@igate.com mailto:mailadmin@igate.com. iGATE does not enter into any agreement with any party by e-mail. Any views expressed by an individual do not necessarily reflect the view of iGATE. iGATE is not responsible for the consequences of any actions taken on the basis of information provided, through this email. The contents of an attachment to this e-mail may contain software viruses, which could damage your own computer system. While iGATE has taken every reasonable precaution to minimise this risk, we cannot accept liability for any damage which you sustain as a result of software viruses. You should carry out your own virus checks before opening an attachment. To know more about iGATE please visit www.igate.com http://www.igate.com. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hi Angelo,
Thanks a lot for helping me.
Now Its working fine and I can save perfectly.
I have just replace my "cfi_flash.c" with latest released "cfi_flach.c" and related #define parameters.
Thanks & Regards, Ramesh Khokhani
-----Original Message----- From: Angelo Dureghello [mailto:sysamfw@gmail.com] Sent: Wednesday, January 16, 2013 3:56 PM To: u-boot@lists.denx.de Cc: Ramesh K Khokhani Subject: Re: [U-Boot] Flash Not Erased Problem with M29W128GL
Dear Ramesh,
i am running last u-boot (pulled yesterday) on a coldfire m5307 and a SST 16bit flash, erasing works fine.
From your debug trace seems the correct erasing command (0x30) is
sent.
But the function you mentioned detect that flash is not erased.
Are you using a 16bit port for data connection to the flash ?
First check i would do is an "erase" test.
Try to erase some sectors with "erase" command, something like
# erase 40000 4ffff
Then dump the memory, (to be sure also with BDM eventually), to see if it has really been erased.
Also, these are some settings i am using in my config, maybe they can be useful:
/* * Start addresses for the final memory configuration * (Set up by the startup code) * Please note that CONFIG_SYS_SDRAM_BASE _must_ start at 0 */ #define CONFIG_SYS_SDRAM_BASE 0x00000000 #define CONFIG_SYS_SDRAM_SIZE 16 /* in MB */ #define CONFIG_SYS_FLASH_BASE 0xffc00000 #define CONFIG_SYS_TEXT_BASE 0xffc00000 #define CONFIG_SYS_MAX_FLASH_BANKS 1 #define CONFIG_SYS_MAX_FLASH_SECT 1024 #define CONFIG_SYS_FLASH_ERASE_TOUT 1000
/* * CFI FLASH driver setup */ #define CONFIG_SYS_FLASH_CFI #define CONFIG_FLASH_CFI_DRIVER #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
...
Let us know if you find something.
Regards, Angelo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Disclaimer~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Information contained and transmitted by this e-mail is confidential and proprietary to iGATE and its affiliates and is intended for use only by the recipient. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, copying or use of this e-mail is strictly prohibited and you are requested to delete this e-mail immediately and notify the originator or mailadmin@igate.com mailto:mailadmin@igate.com. iGATE does not enter into any agreement with any party by e-mail. Any views expressed by an individual do not necessarily reflect the view of iGATE. iGATE is not responsible for the consequences of any actions taken on the basis of information provided, through this email. The contents of an attachment to this e-mail may contain software viruses, which could damage your own computer system. While iGATE has taken every reasonable precaution to minimise this risk, we cannot accept liability for any damage which you sustain as a result of software viruses. You should carry out your own virus checks before opening an attachment. To know more about iGATE please visit www.igate.com http://www.igate.com. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Dear Ramesh,
you're welcome, happy to help.
Anyway, i suggest you to update to ALL the last "master" git tree, since overwriting a single file can bring you to some other misalignment/malfunction.
You can find eventually instructions here:
http://www.denx.de/en/Software/GIT
Best Regards, Angelo Dureghello
participants (2)
-
Angelo Dureghello
-
Ramesh K Khokhani