[U-Boot] Atmel AT91RM9200: U-Boot refuses to copy to a particular sector of flash memory

Hello list,
I am trying to load a Linux 2.6.22 kernel uimage on the flash memory of a custom Atmel AT91RM9200 board. From U-Boot the flash memory map is as follows:
U-Boot> flinfo DataFlash:AT45DB161 Nb pages: 4096 Page Size: 528 Size= 2162688 bytes Logical address: 0xC0000000 Area 0: C0000000 to C0007FFF (RO) Area 1: C0008000 to C001FFFF (RO) Area 2: C0020000 to C0027FFF Area 3: C0028000 to C020FFFF
Bank # 1: Atmel: AT49BV163D (16Mbit) Size: 2 MB in 39 Sectors Sector Start Addresses: 10000000 (RO) 10002000 (RO) 10004000 (RO) 10006000 10008000 1000A000 1000C000 1000E000 (RO) 10010000 (RO) 10020000 10030000 10040000 10050000 10060000 10070000 10080000 10090000 100A0000 100B0000 100C0000 100D0000 100E0000 100F0000 10100000 10110000 10120000 10130000 10140000 10150000 10160000 10170000 10180000 10190000 101A0000 101B0000 101C0000 101D0000 101E0000 101F0000
I also have 2x 48LC8M16A2 modules (32MB, SDRAM, address 0x20000000 - 0x21ffffff) which I download the kernel to before copying to flash.
I have to copy the kernel into the flash starting at address 0x10020000 (lower addresses reserved by U-Boot apparently). However, when I try to copy the 1018KB uimage, the copy always fails with "flash not erased", even after the sectors have been unprotected and erased. I found that if I copy anything into the sector starting at 0x10100000, U-Boot will fail to start from the flash. The sector in question can be unprotected and erased without problems.
Is there any way to find out why U-Boot will not let me copy to this sector, and why erasing and/or trying to copying to it would cause U-Boot not to start anymore? Thanks in advance.
P.S. This is my first post here, apologies if I missed out any important info.

On 17:16 Mon 20 Oct , Ki Chi Leung wrote:
Hello list,
hi Could you specify the U-Boot version.
the command sequence that you use please
Best Regards, J.
I am trying to load a Linux 2.6.22 kernel uimage on the flash memory of a custom Atmel AT91RM9200 board. From U-Boot the flash memory map is as follows:
U-Boot> flinfo DataFlash:AT45DB161 Nb pages: 4096 Page Size: 528 Size= 2162688 bytes Logical address: 0xC0000000 Area 0: C0000000 to C0007FFF (RO) Area 1: C0008000 to C001FFFF (RO) Area 2: C0020000 to C0027FFF Area 3: C0028000 to C020FFFF
Bank # 1: Atmel: AT49BV163D (16Mbit) Size: 2 MB in 39 Sectors Sector Start Addresses: 10000000 (RO) 10002000 (RO) 10004000 (RO) 10006000 10008000 1000A000 1000C000 1000E000 (RO) 10010000 (RO) 10020000 10030000 10040000 10050000 10060000 10070000 10080000 10090000 100A0000 100B0000 100C0000 100D0000 100E0000 100F0000 10100000 10110000 10120000 10130000 10140000 10150000 10160000 10170000 10180000 10190000 101A0000 101B0000 101C0000 101D0000 101E0000 101F0000
btw I supposed that 1000E000 (RO) 10010000 (RO) is your env sector, maybe you can put the env just after U-Boot itself to not loose space.
I also have 2x 48LC8M16A2 modules (32MB, SDRAM, address 0x20000000 - 0x21ffffff) which I download the kernel to before copying to flash.
do check that the uImage in ram is correct? (just to be sure)
I have to copy the kernel into the flash starting at address 0x10020000 (lower addresses reserved by U-Boot apparently). However, when I try to copy the 1018KB uimage, the copy always fails with "flash not erased", even after the sectors have been unprotected and erased.
Best Regards, J.

Hello,
The U-Boot version I am using is 1.1.2.
I forgot to mention my sector sizes: they are as given in the AT49BV163D data sheet. Sectors up to address 0x0000ffff are 8KB in size, while all others after 0x00010000 are 64KB.
And the commands I use are:
* tftpboot 20000000 uimage * cp.b 20000000 10020000 fe4bc # my uimage is 0xfe4bc (1041516) bytes, the copy will always fail here
I tried to copy in chunks of smaller sectors each but I cannot copy if the range written to crosses the "special" byte 10102000:
* cp.b 200e0000 10100000 2000 # works, copies to 0x10100000 - 0x10101fff inclusive * cp.b 200e0000 10100000 2001 # fails, even though it is writing to the same 64KB sector as the previous copy
I tried erasing the problematic sector but it appears to be only half erased - everything after 0x10102000 is intact.
U-Boot> protect off 10100000 1010ffff Un-Protected 1 sectors U-Boot> erase 10100000 1010ffff Erasing sector 23 ... ok. Erased 1 sectors U-Boot> md 10101fe0 10 10101fe0: ffffffff ffffffff ffffffff ffffffff ................ 10101ff0: ffffffff ffffffff ffffffff ffffffff ................ 10102000: e3500000 1affffef ebfffeea e3500000 ..P...........P. 10102010: 0a00000f e3500003 979ff100 ea000009 ......P.........
Regards, Ki Chi
On 10/20/08, Jean-Christophe PLAGNIOL-VILLARD plagnioj@jcrosoft.com wrote:
On 17:16 Mon 20 Oct , Ki Chi Leung wrote:
Hello list,
hi Could you specify the U-Boot version.
the command sequence that you use please
Best Regards, J.
I am trying to load a Linux 2.6.22 kernel uimage on the flash memory of a custom Atmel AT91RM9200 board. From U-Boot the flash memory map is as follows:
U-Boot> flinfo DataFlash:AT45DB161 Nb pages: 4096 Page Size: 528 Size= 2162688 bytes Logical address: 0xC0000000 Area 0: C0000000 to C0007FFF (RO) Area 1: C0008000 to C001FFFF (RO) Area 2: C0020000 to C0027FFF Area 3: C0028000 to C020FFFF
Bank # 1: Atmel: AT49BV163D (16Mbit) Size: 2 MB in 39 Sectors Sector Start Addresses: 10000000 (RO) 10002000 (RO) 10004000 (RO) 10006000 10008000 1000A000 1000C000 1000E000 (RO) 10010000 (RO) 10020000 10030000 10040000 10050000 10060000 10070000 10080000 10090000 100A0000 100B0000 100C0000 100D0000 100E0000 100F0000 10100000 10110000 10120000 10130000 10140000 10150000 10160000 10170000 10180000 10190000 101A0000 101B0000 101C0000 101D0000 101E0000 101F0000
btw I supposed that 1000E000 (RO) 10010000 (RO) is your env sector, maybe you can put the env just after U-Boot itself to not loose space.
I also have 2x 48LC8M16A2 modules (32MB, SDRAM, address 0x20000000 - 0x21ffffff) which I download the kernel to before copying to flash.
do check that the uImage in ram is correct? (just to be sure)
I have to copy the kernel into the flash starting at address 0x10020000 (lower addresses reserved by U-Boot apparently). However, when I try to copy the 1018KB uimage, the copy always fails with "flash not erased", even after the sectors have been unprotected and erased.
Best Regards, J.
participants (3)
-
7words.sg@gmail.com
-
Jean-Christophe PLAGNIOL-VILLARD
-
Ki Chi Leung