All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] Warning Bad CRC
@ 2009-09-21  6:47 Rahanesh
  2009-09-21  8:43 ` Wolfgang Denk
  0 siblings, 1 reply; 9+ messages in thread
From: Rahanesh @ 2009-09-21  6:47 UTC (permalink / raw)
  To: u-boot

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
 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] Warning Bad CRC
  2009-09-21  6:47 [U-Boot] Warning Bad CRC Rahanesh
@ 2009-09-21  8:43 ` Wolfgang Denk
  2009-09-21 10:25   ` Rahanesh
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2009-09-21  8:43 UTC (permalink / raw)
  To: u-boot

Dear Rahanesh,

In message <4AB72177.7090501@tataelxsi.co.in> 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

-- 
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] Warning Bad CRC
  2009-09-21  8:43 ` Wolfgang Denk
@ 2009-09-21 10:25   ` Rahanesh
  2009-09-21 12:20     ` Wolfgang Denk
  0 siblings, 1 reply; 9+ messages in thread
From: Rahanesh @ 2009-09-21 10:25 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:
>
> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] Warning Bad CRC
  2009-09-21 10:25   ` Rahanesh
@ 2009-09-21 12:20     ` Wolfgang Denk
  2009-09-21 13:59       ` Rahanesh
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2009-09-21 12:20 UTC (permalink / raw)
  To: u-boot

Dear Rahanesh,

In message <4AB75481.6060804@tataelxsi.co.in> 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.

> 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.

> 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

-- 
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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] Warning Bad CRC
  2009-09-21 12:20     ` Wolfgang Denk
@ 2009-09-21 13:59       ` Rahanesh
  2009-09-21 17:43         ` Wolfgang Denk
  0 siblings, 1 reply; 9+ messages in thread
From: Rahanesh @ 2009-09-21 13:59 UTC (permalink / raw)
  To: u-boot

Dear Wolfgang,
> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] Warning Bad CRC
  2009-09-21 13:59       ` Rahanesh
@ 2009-09-21 17:43         ` Wolfgang Denk
  2009-09-22  5:48           ` Rahanesh
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2009-09-21 17:43 UTC (permalink / raw)
  To: u-boot

Dear Rahanesh,

In message <4AB786B9.4080000@tataelxsi.co.in> 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
> 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.

> *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

-- 
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] Warning Bad CRC
  2009-09-21 17:43         ` Wolfgang Denk
@ 2009-09-22  5:48           ` Rahanesh
  2009-09-22  9:32             ` Detlev Zundel
  2009-09-22 10:31             ` Wolfgang Denk
  0 siblings, 2 replies; 9+ messages in thread
From: Rahanesh @ 2009-09-22  5:48 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:
> Dear Rahanesh,
>
> In message <4AB786B9.4080000@tataelxsi.co.in> 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
>> 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.
>   
 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.
>   
>> *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.
>   
     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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] Warning Bad CRC
  2009-09-22  5:48           ` Rahanesh
@ 2009-09-22  9:32             ` Detlev Zundel
  2009-09-22 10:31             ` Wolfgang Denk
  1 sibling, 0 replies; 9+ messages in thread
From: Detlev Zundel @ 2009-09-22  9:32 UTC (permalink / raw)
  To: u-boot

Hi Rahanesh,

[...]

>      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.

> 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.

> 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

-- 
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] Warning Bad CRC
  2009-09-22  5:48           ` Rahanesh
  2009-09-22  9:32             ` Detlev Zundel
@ 2009-09-22 10:31             ` Wolfgang Denk
  1 sibling, 0 replies; 9+ messages in thread
From: Wolfgang Denk @ 2009-09-22 10:31 UTC (permalink / raw)
  To: u-boot

Dear Rahanesh,

In message <4AB86541.1090505@tataelxsi.co.in> you wrote:
>
> >> *** 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.
> >   
>  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.

> > 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?

> 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.

> 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

-- 
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-09-22 10:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-21  6:47 [U-Boot] Warning Bad CRC Rahanesh
2009-09-21  8:43 ` Wolfgang Denk
2009-09-21 10:25   ` Rahanesh
2009-09-21 12:20     ` Wolfgang Denk
2009-09-21 13:59       ` Rahanesh
2009-09-21 17:43         ` Wolfgang Denk
2009-09-22  5:48           ` Rahanesh
2009-09-22  9:32             ` Detlev Zundel
2009-09-22 10:31             ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.