Skip to contentSkip to conversation

Flash Erase/Write error in uboot

U-Boot-Users Shiju Mathew 4 participants 12 messages May 2, 2007 – May 8, 2007 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hello,
I have a board with flash part S71WS256N. I was using CFI driver and didn't had any problems programming the device. But from today I am getting an unusual error while writing to flash sectors. It always gives erase successful. But when I try to write data after erase, I get a message that the flash is not erased. I use uboot-1.2. Below is the debug message on running saveenv. Could someone help me to resolve this problem.

Saving Environment to Flash...
Protect off A0060000 ... A007FFFF
Un-Protecting sectors 6..6 in bank 1
fwc addr a0060000 cmd 50 0050 16bit x 16 bit
fwc addr a0060000 cmd 60 0060 16bit x 16 bit
fwc addr a0060000 cmd d0 00d0 16bit x 16 bit
flash_is_busy: 0
. done
Un-Protected 1 sectors
Erasing Flash...Erase Flash from 0xa0060000 to 0xa007ffff in Bank # 1 fwc addr a0060aaa cmd aa 00aa 16bit x 16 bit
fwc addr a0060554 cmd 55 0055 16bit x 16 bit
fwc addr a0060aaa cmd 80 0080 16bit x 16 bit
fwc addr a0060aaa cmd aa 00aa 16bit x 16 bit
fwc addr a0060554 cmd 55 0055 16bit x 16 bit
fwc addr a0060000 cmd 30 0030 16bit x 16 bit
flash_is_busy: 0
done
Erased 1 sectors
Writing to Flash... Flash not Erased
Protecting sectors 6..6 in bank 1
fwc addr a0060000 cmd 50 0050 16bit x 16 bit
fwc addr a0060000 cmd 60 0060 16bit x 16 bit
fwc addr a0060000 cmd 1 0001 16bit x 16 bit
flash_is_busy: 0
. done
Protected 1 sectors

Thanks,
Shiju
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20070501/37649788/attachment.htm

#1 lore raw
Quoted 8 lines · In message <[email protected]> you…

I have a board with flash part S71WS256N. I was using CFI driver and didn't had any problems programming the device. But from today I am getting an unusual error while writing to flash sectors. It always gives erase successful. But when I try to write data after erase, I get a message that the flash is not erased. I use uboot-1.2. Below is the debug message on running saveenv. Could someone help me to resolve this problem.

Is it correct to assume that this is just on one board? Seems your flash died. This happens.

Quoted 4 lines

------=_Part_14465_22402792.1178065379050
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Please never post HTML here. Never.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,    CEO: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Witch!  Witch!  They'll burn ya!
	-- Hag, "Tomorrow is Yesterday", stardate unknown
#12 lore raw
In reply to Shiju Mathew
Quoted 5 lines · Shiju Mathew

I have a board with flash part S71WS256N. I was using CFI driver and didn't had any problems programming the device. But from today I am getting an unusual error while writing to flash sectors. It always gives erase successful. But when I try to write data after erase, I get a message that the flash is not erased. I use uboot-1.2.

Are you using 1.2.0 release or top-of-git version? Please use top-of-git version, there were some changes regarding io-ordering/barrier in the CFI driver lately.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
=====================================================================

#2 lore raw
In reply to Wolfgang Denk
Quoted 10 lines · Wolfgang Denk
Quoted 8 lines · In message <[email protected]> you…

I have a board with flash part S71WS256N. I was using CFI driver and didn't had any problems programming the device. But from today I am getting an unusual error while writing to flash sectors. It always gives erase successful. But when I try to write data after erase, I get a message that the flash is not erased. I use uboot-1.2. Below is the debug message on running saveenv. Could someone help me to resolve this problem.

Quoted 3 lines

Is it correct to assume that this is just on one board? Seems your flash died. This happens.

The flash is not dead. I could flash uboot using RVI debugger without any problem. Basically I load two uboot images onto RAM using RVI- one to run from RAM and writes the second image to flash. This is always succussfull. ONce the uboot is written to flash, and reboot the board, I get the error that the "flash is not errased".
Today I tested with the top-of-git version. Still have the same problem. Anyone have experienced this problem before.

Thanks,
Shiju

#3 lore raw
Quoted 24 lines · Shiju Mathew
Quoted 10 lines · Wolfgang Denk
Quoted 8 lines · In message <[email protected]> you…

I have a board with flash part S71WS256N. I was using CFI driver and didn't had any problems programming the device. But from today I am getting an unusual error while writing to flash sectors. It always gives erase successful. But when I try to write data after erase, I get a message that the flash is not erased. I use uboot-1.2. Below is the debug message on running saveenv. Could someone help me to resolve this problem.

Quoted 4 lines

Is it correct to assume that this is just on one board? Seems your flash died. This happens.

The flash is not dead. I could flash uboot using RVI debugger without any problem. Basically I load two uboot images onto RAM using RVI- one to run from RAM and writes the second image to flash. This is always succussfull. ONce the uboot is written to flash, and reboot the board, I get the error that the "flash is not errased".
Today I tested with the top-of-git version. Still have the same problem. Anyone have experienced this problem before.

Quoted 3 lines

Thanks,
Shiju

Does this happen with DEBUG enabled? Did you check with DEBUG disabled? I noticed that DEBUG distrupts some of the registers used for status checking...

If you have to have DEBUG enabled for testing something else please put #undef DEBUG towards the beginning of cfi_flash.c (after #include etc)

Tolunay

Tolunay

#4 lore raw
Quoted 10 lines · Tolunay Orkun
Quoted 3 lines · Shiju Mathew

On Wed, 2007-02-05 at 02:29 +0200, Wolfgang Denk wrote:

Does this happen with DEBUG enabled? Did you check with DEBUG disabled? I noticed that DEBUG distrupts some of the registers used for status checking...

If you have to have DEBUG enabled for testing something else please put #undef DEBUG towards the beginning of cfi_flash.c (after #include etc)

Looks likes some other issue. On our Freescale imx31 ADS board we have connected an extension board(RAM like device) to CS1 through the logical analyser interface. The problem happens when I connect the extension board(even without powering up the extension board). If I remove the extension board the flash erase/writes are successfull.

Thanks,
Shiju

#5 lore raw
Quoted 11 lines · Shiju Mathew
Quoted 10 lines · Tolunay Orkun
Quoted 3 lines · Shiju Mathew

On Wed, 2007-02-05 at 02:29 +0200, Wolfgang Denk wrote:

Does this happen with DEBUG enabled? Did you check with DEBUG disabled? I noticed that DEBUG distrupts some of the registers used for status checking...

If you have to have DEBUG enabled for testing something else please put #undef DEBUG towards the beginning of cfi_flash.c (after #include etc)

Quoted 9 lines

Looks likes some other issue. On our Freescale imx31 ADS board we have connected an extension board(RAM like device) to CS1 through the logical analyser interface. The problem happens when I connect the extension board(even without powering up the extension board). If I remove the extension board the flash erase/writes are successfull.

Thanks,
Shiju

Looks like an hardware/interfacing issue...

Tolunay

#6 lore raw
Quoted 19 lines · Tolunay Orkun
Quoted 17 lines · Shiju Mathew
Quoted 10 lines · Tolunay Orkun
Quoted 3 lines · Shiju Mathew

On Wed, 2007-02-05 at 02:29 +0200, Wolfgang Denk wrote:

Does this happen with DEBUG enabled? Did you check with DEBUG disabled? I noticed that DEBUG distrupts some of the registers used for status checking...

If you have to have DEBUG enabled for testing something else please put #undef DEBUG towards the beginning of cfi_flash.c (after #include etc)

Looks likes some other issue. On our Freescale imx31 ADS board we have connected an extension board(RAM like device) to CS1 through the logical analyser interface. The problem happens when I connect the extension board(even without powering up the extension board). If I remove the extension board the flash erase/writes are successfull.

Quoted 7 lines
Quoted 3 lines

Thanks,
Shiju

Looks like an hardware/interfacing issue...

I was debugging the problem further. We have two other bootloaders running

on this board - redboot and Eboot. Both does not have this problem. Only on Uboot I am experiencing this problem. On debugging what I could find is that when I erase a sector, the function flash_is_busy() returns immidiatly with success(not busy). Usually it should loop for a while in this function before returning that the flash is not busy. Before writing to the erased sector, the "md" command displayed 0xffffffff for the erased sector. But when I tried to write data to the erased location using cp.b, the function flash_write_cfiword() returns with error "flash is not erased" since it failed to find 0xffffffff in the erased locations(Check if Flash is (sufficiently) erased). So why does "md" displays 0xffffffff for erased locations and flash routine says it is not 0xffffffff ? Could someone explain why this difference.

Thanks,
Shiju

Signature · 5 lines
Regards,
Shiju
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20070504/5030e495/attachment.htm 
#7 lore raw
Quoted 6 lines · Shiju Mathew
Quoted 6 lines
Quoted 6 lines

Looks likes some other issue. On our Freescale imx31 ADS board we have connected an extension board(RAM like device) to CS1 through the logical analyser interface. The problem happens when I connect the extension board(even without powering up the extension board). If I remove the extension board the flash erase/writes are successfull.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Thanks,
Shiju

Looks like an hardware/interfacing issue...

I was debugging the problem further. We have two other bootloaders running
on this board - redboot and Eboot.

Wow, 3 bootloaders for one board! What luxury. :)

Quoted 4 lines

Both does not have this problem. Only on
Uboot I am experiencing this problem. On debugging what I could find is that when I erase a sector, the function flash_is_busy() returns immidiatly with success(not busy). Usually it should loop for a while in this function

Quoted 8 lines

before returning that the flash is not busy. Before writing to the erased sector, the "md" command displayed 0xffffffff for the erased sector. But when I tried to write data to the erased location using cp.b, the function flash_write_cfiword() returns with error "flash is not erased" since it failed to find 0xffffffff in the erased locations(Check if Flash is (sufficiently) erased). So why does "md" displays 0xffffffff for erased locations and flash routine says it is not 0xffffffff ? Could someone explain why this difference.

Does this problem also occur when you disconnect the "extension board"?

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
=====================================================================

#8 lore raw
In reply to Shiju Mathew
Quoted 16 lines · Shiju Mathew

On 5/3/07, *Tolunay Orkun* <[email protected]
<mailto:[email protected]>> wrote:

> Looks likes some other issue. On our Freescale imx31 ADS board
we have
> connected an extension board(RAM like device) to CS1 through the
logical
> analyser interface. The problem happens when I connect the extension > board(even without powering up the extension board). If I remove the > extension board the flash erase/writes are successfull. >
> Thanks,
> Shiju
>

Quoted 4 lines

Looks like an hardware/interfacing issue...

I was debugging the problem further. We have two other bootloaders running on this board - redboot and Eboot. Both does not have this

Check how CS configuration etc. is correctly configured. If it is working with the extension board not installed but not obviously you have something wrong. It could be that your CS1 configuration is incorrect. Possibilities are endless. But I do not see this as a flash driver issue.

Tolunay

#10 lore raw
In reply to a message not in the archive
Quoted 19 lines · Andrew Dyer
Quoted 4 lines · Shiju Mathew

I was debugging the problem further. We have two other bootloaders running on this board - redboot and Eboot. Both does not have this problem. Only on Uboot I am experiencing this problem. On debugging what I could find is that when I erase a sector, the function flash_is_busy() returns immidiatly with

Quoted 8 lines

success(not busy). Usually it should loop for a while in this function before returning that the flash is not busy. Before writing to the erased sector, the "md" command displayed 0xffffffff for the erased sector. But when I tried to write data to the erased location using cp.b, the function flash_write_cfiword() returns with error "flash is not erased" since it failed to find 0xffffffff in the erased locations(Check if Flash is (sufficiently) erased). So why does "md" displays 0xffffffff for erased locations and flash routine says it is not 0xffffffff ? Could someone

I suspect the code is reading the status word instead of the array data. You have to be careful with handling the array, as there is no separate status port, so the status data will show up as read data if you aren't careful.

Quoted 7 lines

One thing you might check is to make sure the flash 'timeout' variable isn't getting set to zero. I found a problem with this a long time ago - it had to do with how the CFI timeout data (reported in usec) was being converted to a value for timeout (in msec). If timeout was zero, the status read stuff would time out before reding the data the second time through. I think was fixed, but it's worth checking.

Thanks for all your comments. I could get a few sector erase/write success if I reduce the system clock to 398 MHz and bus speed to 66 MHz and also make the below changes for erase status check. Previouly it was running at 532 MHz/133 MHz (CPU/bus).Now I could update uboot without any problem. But if I try to erase/write large no: of sectors, says 100 sectors, it fails with the same error as before. So I think the problem is realated to timming.

#define TIMEOUT 10000000
               timeout = TIMEOUT;
                while (1) {
                     if (flash_isset (info, sect, 0, 0x08)) {
	                    debug("Operation complete\n");
         	            break;
                      }
                      if (!timeout--) {
                             printf("Operation Timed Out!!n");
                             break;
                      }
               }
               timeout = TIMEOUT;
               while (1) {
                      if (flash_isset (info, sect, 0,
FLASH_STATUS_DONE)) {
                            debug("Flash erase done\n");
                            break;
                      }
                      if (!timeout--) {
                            printf("Erase Timed Out!!\n");
                            break;
                      }
              }
Quoted 6 lines

Check how CS configuration etc. is correctly configured. If it is working with the extension board not installed but not obviously you have something wrong. It could be that your CS1 configuration is incorrect. Possibilities are endless. But I do not see this as a flash
driver issue.

If I disconnected the extension board, I don't have any issues. I could also run the system at 532/133 MHz without any flash write issues. The problem happens when the load increases on the bus. I made sure that the CS are configured right.I disabled CS1( where extension board is connected) without any success.

Quoted 2 lines

Wow, 3 bootloaders for one board! What luxury. :)

We got eboot and redboot along with the board. But we want to move to uboot to support all the OS runnning on the board because of its feature rich and has good support from the community.

Thanks,
Shiju

#11 lore raw
Quoted 3 lines · In message <1178649400.8335.26.camel@localhost> you wrote:
#define TIMEOUT 10000000
               timeout = TIMEOUT;

...

Quoted 3 lines
                      if (!timeout--) {
                             printf("Operation Timed Out!!n");
                             break;

You shouldreally use a delay based timeout here,not a counter based one (where youwill never know how long exactly your timeout runs).

Add for example an "udelay (100);" (delay for 10 microseconds) and adjust TIMEOUT to a reasonable value, say 100000 (10 seconds).

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,    CEO: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I will not say that women have no character;  rather, they have a new
one every day.                                               -- Heine