Skip to contentSkip to conversation

Warning Bad CRC

U-Boot Rahanesh 3 participants 9 messages Sep 21, 2009 – Sep 22, 2009

lore
Share & tools
lore

Rahanesh

author
#0 lore raw

Hi All,

I am getting a warning message when i run fw_printenv on board.

Warning : Bad CRC!! Using Default Environment. And it showed Few environment variables.
The values of those environment variables are not that is set on my board.

What might me the issue?

Thanks
Rahanesh

#1 lore raw

Dear Rahanesh,

Quoted 9 lines · In message <[email protected]> you wrote:

I am getting a warning message when i run fw_printenv on board.

Warning : Bad CRC!! Using Default Environment. And it showed Few environment variables.
The values of those environment variables are not that is set on my board.

What might me the issue?

I thiunk this has been explained to you before: your fw_env.config file is incorrect and does not match your actual hardware configuration.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: 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
Madness has no purpose.  Or reason.  But it may have a goal.
	-- Spock, "The Alternative Factor", stardate 3088.7
author
#2 lore raw
Quoted 6 lines · Wolfgang Denk

I thiunk this has been explained to you before: your fw_env.config file is incorrect and does not match your actual hardware configuration.

But i cannot find out the issue with config file.

This is the information i get from include/configs/my_board.h
/* Address and size of Primary Environment Sector */
/* I put the env in the last sector since the board has */ /* "top" type boot sectors... */

 #define CFG_ENV_ADDR        0xAD03F000
 #define CFG_ENV_SIZE        0x1000
 #define CFG_ENV_SECT_SIZE   0x10000

and my config file is as below

MTD device name Device offset Env. size Flash sector size
Number of sectors
/dev/mtd0 0x3F000 0x1000 0x10000

Thanks
Rahanesh

#3 lore raw

Dear Rahanesh,

Quoted 2 lines · In message <[email protected]> you wrote:

But i cannot find out the issue with config file.

We cannot find this out either. We don't know your hardware, and your code is not in mainline either.

Quoted 7 lines

This is the information i get from include/configs/my_board.h
/* Address and size of Primary Environment Sector */
/* I put the env in the last sector since the board has */ /* "top" type boot sectors... */

 #define CFG_ENV_ADDR        0xAD03F000
 #define CFG_ENV_SIZE        0x1000
 #define CFG_ENV_SECT_SIZE   0x10000

It has already meen explained before that this looks broken.

I would expect that the environment address is a multiple of the block size, which it is not in your case.

Quoted 5 lines

and my config file is as below

MTD device name Device offset Env. size Flash sector size =20
Number of sectors
/dev/mtd0 0x3F000 0x1000 0x10000

Is 0x3F00 really the correct offset? I doubt so.

What are your full U-Boot boot messages, and what does "flinfo" print?

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: 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
Nearly everyone is in favor of going  to  heaven  but  too  many  are
hoping  they'll  live  long  enough  to see an easing of the entrance
requirements. Never appeal to a man's "better nature." he  might  not
have one.
author
#4 lore raw

Dear Wolfgang,

Quoted 4 lines

Is 0x3F00 really the correct offset? I doubt so.

What are your full U-Boot boot messages, and what does "flinfo" print?

* This is the print message of flinfo*

      U-BOOT # flinfo
      DataFlash:Nb pages:  32768
      Page Size:    256
      Size= 8388608 bytes
      Logical address: 0xAD000000
      Nb Erase Blocks:    128
      Erase Block Size:  65536
      Area 0: AD000000 to AD003FFF
     Area 1: AD004000 to AD03FFFF
     Area 2: AD040000 to AD30BFFF
     Area 3: AD30C000 to AD7FFFFF

*U-Boot boot messages follow*

U-Boot 1.1.2 (Sep 19 2009 - 10:26:28)

Board: IAD CPU Speed 200 MHz
DRAM:  32 MB

sflash.c:266:DF_F_DataflashProbe: Entered sflash.c:269:DF_F_DataflashProbe: flash type is 0x1 sflash.c:270:DF_F_DataflashProbe: num pages 32768 DataFlash:Nb pages: 32768
Page Size: 256
Size= 8388608 bytes

Logical address: 0xAD000000
Nb Erase Blocks:    128
Erase Block Size:  65536
Area 0: AD000000 to AD003FFF
Area 1: AD004000 to AD03FFFF
Area 2: AD040000 to AD30BFFF
Area 3: AD30C000 to AD7FFFFF

got bad crc. got:0x603b0489, expected:0x0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:    Eth.

Type "run flash_nfs" to mount root filesystem over NFS

Hit any key to stop autoboot: 0

*Print message after execution of saveenv command from uboot :

*Saving Environment to dataflash...
copy 0xad030000-0xad040000 to saveenv-buf 0x80100000.
erasing 0xad030000 - 0xad03ffff
Erasing sectors 0x3 to 0x3
sflash.c:69:DF_F_PageErase: erasing page: 0x3
done erasingsflash.c:164:DF_F_DataFlashWrite: write: src 0x80100000, dst
0x30000, size 0x10000
...........................................................................................................................................................
.....................................................................................................sflash.c:225:DF_F_DataFlashWrite:
final partial page

Hope this helps

Thanks
Rahanesh

#5 lore raw

Dear Rahanesh,

Quoted 18 lines · In message <[email protected]> you wrote:

U-Boot 1.1.2 (Sep 19 2009 - 10:26:28)

Board: IAD CPU Speed 200 MHz
DRAM:  32 MB

sflash.c:266:DF_F_DataflashProbe: Entered sflash.c:269:DF_F_DataflashProbe: flash type is 0x1 sflash.c:270:DF_F_DataflashProbe: num pages 32768 DataFlash:Nb pages: 32768
Page Size: 256
Size=3D 8388608 bytes

Logical address: 0xAD000000
Nb Erase Blocks:    128
Erase Block Size:  65536
Area 0: AD000000 to AD003FFF
Area 1: AD004000 to AD03FFFF
Area 2: AD040000 to AD30BFFF
Area 3: AD30C000 to AD7FFFFF
Quoted 2 lines

got bad crc. got:0x603b0489, expected:0x0
*** Warning - bad CRC, using default environment

Ah! Here you can see that the CRC is incorrect in U-Boot already, so why do you expect to see a different result when using fw_printenv?

WHen the CRC _is_ incorrect, both U-Boot and fw_printenv will report this fact in the same way.

Quoted 9 lines

*Print message after execution of saveenv command from uboot :

*Saving Environment to dataflash...
copy 0xad030000-0xad040000 to saveenv-buf 0x80100000.
erasing 0xad030000 - 0xad03ffff
Erasing sectors 0x3 to 0x3
sflash.c:69:DF_F_PageErase: erasing page: 0x3
done erasingsflash.c:164:DF_F_DataFlashWrite: write: src 0x80100000, dst=20 0x30000, size 0x10000

I have no idea what sort of code you might be using there, there is no such file as 'sflash.c' in the mainline U-Boot code.

And U-Boot 1.1.2 is old. I mean: OLD. Really, really OLD. Nearly 5 years old.

Please consider it completely unsupported at this time.

Please update and use recent code instead.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: 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
"UNIX was not designed to stop you from doing stupid things,  because
that would also stop you from doing clever things."       - Doug Gwyn
author
#6 lore raw
Quoted 25 lines · Wolfgang Denk

Dear Rahanesh,

Quoted 17 lines · In message <[email protected]> you wrote:

U-Boot 1.1.2 (Sep 19 2009 - 10:26:28)

Board: IAD CPU Speed 200 MHz
DRAM:  32 MB

sflash.c:266:DF_F_DataflashProbe: Entered sflash.c:269:DF_F_DataflashProbe: flash type is 0x1 sflash.c:270:DF_F_DataflashProbe: num pages 32768 DataFlash:Nb pages: 32768
Page Size: 256
Size=3D 8388608 bytes

Logical address: 0xAD000000
Nb Erase Blocks:    128
Erase Block Size:  65536
Area 0: AD000000 to AD003FFF
Area 1: AD004000 to AD03FFFF
Area 2: AD040000 to AD30BFFF
Area 3: AD30C000 to AD7FFFFF
Quoted 3 lines

got bad crc. got:0x603b0489, expected:0x0
*** Warning - bad CRC, using default environment

Quoted 6 lines

Ah! Here you can see that the CRC is incorrect in U-Boot already, so why do you expect to see a different result when using fw_printenv?

WHen the CRC _is_ incorrect, both U-Boot and fw_printenv will report this fact in the same way.

The message is printed because the flash sector or ERPROM containing
the environment variables has never been initialized yet. The message will go away as soon as you save the envrionment variables using the

|*saveenv*| command.
>   
Quoted 11 lines
Quoted 10 lines

*Print message after execution of saveenv command from uboot :

*Saving Environment to dataflash...
copy 0xad030000-0xad040000 to saveenv-buf 0x80100000.
erasing 0xad030000 - 0xad03ffff
Erasing sectors 0x3 to 0x3
sflash.c:69:DF_F_PageErase: erasing page: 0x3
done erasingsflash.c:164:DF_F_DataFlashWrite: write: src 0x80100000, dst=20 0x30000, size 0x10000

Quoted 3 lines

I have no idea what sort of code you might be using there, there is no such file as 'sflash.c' in the mainline U-Boot code.

sflash.c is flash driver code . I showed you the print message of
savenev to note that it is erasing 0xad030000 - 0xad03ffff. That means

     environment variables are placed in the mentioned sector(0xad030000 

- 0xad03ffff). Actual address of environment variables is 0xad03f000, which is last 4Kb
of 64KB sector. If this is the case what should be the
DEVICE_OFFSET? ENV_SIZE?

Using the latest u-boot will be quite time consuming. Please help!!!

Thanks
Rahanesh

#7 lore raw

Hi Rahanesh,

[...]

Quoted 6 lines

sflash.c is flash driver code . I showed you the print message of
savenev to note that it is erasing 0xad030000 - 0xad03ffff. That means

     environment variables are placed in the mentioned sector(0xad030000 

- 0xad03ffff). Actual address of environment variables is 0xad03f000, which is last 4Kb
of 64KB sector.

Well yes, you showed us, that the code that you use actually violates the otherwise used principle, that the environment is inside its own erase block. So the code actually *needs* to use some buffering of the contents not to be destroyed. I see this for the first time to be honest and I would not be surprised, if fw_setenv does *not* do such a thing by itself. So it looks like it boils down for you to find out whether the Linux MTD driver plays such tricks. I don't think so and your results indicate the same.

Quoted 2 lines

If this is the case what should be the
DEVICE_OFFSET? ENV_SIZE?

The parameters actually do not look incorrect, but as I said, they violate the implicit assumption that the underlying MTD erase block can be erase without damaging anything.

Quoted 1 line

Using the latest u-boot will be quite time consuming. Please help!!!

Adding more exclamation marks will not improve your chances of getting *free* help. Using latest code (or code that anybody besides you knows) however will.

Best wishes
Detlev

Signature · 8 lines
5.7: Practically speaking, what is the difference between arrays and pointers?
About the difference between alcohol and marijuana; they have different
characteristics, and that's not a problem if you don't mix them too carelessly.
                           - Infrequently Asked Questions in comp.lang.c
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#8 lore raw
In reply to Rahanesh

Dear Rahanesh,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 6 lines
Quoted 2 lines

*** Warning - bad CRC, using default environment

Ah! Here you can see that the CRC is incorrect in U-Boot already, so why do you expect to see a different result when using fw_printenv?

Quoted 7 lines
Quoted 3 lines

WHen the CRC _is_ incorrect, both U-Boot and fw_printenv will report this fact in the same way.

The message is printed because the flash sector or ERPROM containing
the environment variables has never been initialized yet. The message will go away as soon as you save the envrionment variables using the |*saveenv*| command.

Well, then just run "saveenv", make sure the warning message disappears, and re-try using fw_printenv after that.

Quoted 4 lines
Quoted 3 lines

I have no idea what sort of code you might be using there, there is no such file as 'sflash.c' in the mainline U-Boot code.

sflash.c is flash driver code . I showed you the print message of

Maybe it's some flash driver code - in any case it is code that is unknown to us, as it is not part of the mainline U-Boot source code. How do you expect us to comment on the operation of unknown code?

Quoted 6 lines

savenev to note that it is erasing 0xad030000 - 0xad03ffff. That means

     environment variables are placed in the mentioned sector(0xad030000 

- 0xad03ffff). Actual address of environment variables is 0xad03f000, which is last 4Kb
of 64KB sector. If this is the case what should be the
DEVICE_OFFSET? ENV_SIZE?

You are using a quite unusual configuration here - and one that makes no sense to me. But I don;t know your hardware, nor your code, so Icannot comment.

Quoted 1 line

Using the latest u-boot will be quite time consuming. Please help!!!

I cannot help you. Nobody can help you. You are using unknown hardware with unknown code in a suspicious configuration. Someone who came up with this implementation and configuration should also have the knowledge to debug the issues you are observing. Contact the developers of that code, please.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: 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
"An open mind has but one disadvantage: it collects dirt."
                                                    - a saying at RPI