2010-06-01 05:49:50     Bf537-stamp+spi flash

Document created by Aaronwu Employee on Sep 25, 2013
Version 1Show Document
  • View in full screen mode

2010-06-01 05:49:50     Bf537-stamp+spi flash

Nikolay Razbegaev (RUSSIAN FEDERATION)

Message: 90044   

 

Hello!

 

I have an BF537-stamp board with AT45DB08x flash connected via spi and

u-boot 1.1.6 installed into on board parallel flash. u-boot defect spi

flash:

 

bfin> eeprom info

SPI Device: AT45DB081x 0x1F (Atmel) 0x25 0x00

Parameters: num sectors = 4096, sector size = 264, write size = 264

Flash Size: 8 mbit (1 mbyte)

Status: 0xA4

 

When I perform read-write-compare test with some fixed values,

i.e. 0xffffffff or 0xaaaaaaaa it perform fine. I.e.:

 

bfin> mw $(loadaddr) 0xffffffff 0x3FFFF

bfin> eeprom write $(loadaddr) 0 0x3FFFF

bfin> mw $(loadaddr) 0 0x3FFFF

bfin> eeprom read $(loadaddr) 0 0 0x3FFFF

 

and i will got 0xffffffff filled memory block at $(loadaddr). Same

result for 0xaaaaaaaa or 0x55555555 fill.

 

But, if I will try to write to eeprom some random data, u-boot from on

board parallel flash, for example, I will got some data corruption:

 

bfin> eeprom write 0x20000000 0 0x3FFFF

...skipping output...

bfin> eeprom read $(loadaddr) 0 0x3FFFF

...skipping output...

bfin> cmp $(loadaddr) 0x20000000 0x3FFFF

word at 0x01000000 (0x93106000) != word at 0x20000000 (0xffa00060)

Total of 0 words were the same

bfin> md 0x20000000

20000000: ffa00060 00000000 00000012 00f4ffa0    `...............

20000010: 000a0000 05c00166 01510150 01530152    ....f...P.Q.R.S.

20000020: 01590158 015b015a 015d015c 015f015e    X.Y.Z.[.\.].^._.

20000030: 01550154 01570156 01610160 ffc0e14a    T.U.V.W.`.a.J...

20000040: 01630162 0424e10a ffc0e149 e1099550    b.c...$.I...P...

20000050: 60080124 e14a9308 e10affc0 e1200010    $..`..J....... .

20000060: 97100300 95106fc2 40fbe121 080842c0    .....o..!..@.B..

20000070: 97111803 e14a0020 e10affc0 60280004    .... .J.......(`

20000080: 6fe29710 e1819510 42c0a800 18030808    ...o.......B....

20000090: 00209711 ffc0e14a 7bb0e140 0a04e10a    .. .J...@..{....

200000a0: 7bb0e100 e1409310 6c22ffc2 7bb0e100    ...{..@..."l...{

200000b0: e1209310 6fc200ff e1209710 6cc20306    .. ....o.. ....l

200000c0: 61289710 97106fe2 0091e140 e1006fe2    ..(a.o..@....o..

200000d0: 9310114d 930863f8 01220123 01200121    M....c..#.".!. .

200000e0: 01160117 01140115 011e011f 011c011d    ................

200000f0: 011a011b 01180119 01120113 01100111    ................

bfin> md $(loadaddr)

01000000: 93106000 ffe0e14a 03fce140 2008e10a    .`..J...@......

01000010: 000a0000 05c00166 01510150 01530152    ....f...P.Q.R.S.

01000020: 01590158 015b015a 015d015c 015f015e    X.Y.Z.[.\.].^._.

01000030: 01550154 01570156 01610160 ffc0e14a    T.U.V.W.`.a.J...

01000040: 01630162 0424e10a ffc0e149 e1099550    b.c...$.I...P...

01000050: 60080124 e14a9308 e10affc0 e1200010    $..`..J....... .

01000060: 97100300 95106fc2 40fbe121 080842c0    .....o..!..@.B..

01000070: 97111803 e14a0020 e10affc0 60280004    .... .J.......(`

01000080: 6fe29710 e1819510 42c0a800 18030808    ...o.......B....

01000090: 00209711 ffc0e14a 7bb0e140 0a04e10a    .. .J...@..{....

010000a0: 7bb0e100 e1409310 6c22ffc2 7bb0e100    ...{..@..."l...{

010000b0: e1209310 6fc200ff e1209710 6cc20306    .. ....o.. ....l

010000c0: 61289710 97106fe2 0091e140 e1006fe2    ..(a.o..@....o..

010000d0: 9310114d 930863f8 01220123 01200121    M....c..#.".!. .

010000e0: 01160117 01140115 011e011f 011c011d    ................

010000f0: 011a011b 01180119 01120113 01100111    ................

 

I.e. first four words was some how corrupted, but the rest data is the

same till the next corrupted words:

 

bfin> cmp 0x1000010 0x20000010 100

word at 0x01000108 (0x6c260127) != word at 0x20000108 (0xffa00000)

Total of 62 words were the same

 

I also tried new u-boot, but it was unable to detect spi flash:

 

bfin> version

 

U-Boot 2008.10 (ADI-2009R1.1-rc1) (May 31 2010 - 14:23:44)

bfin> sf probe 1

SF: Got idcode 1f 25 00

SF: Unsupported manufacturer 1F

Failed to initialize SPI flash at 0:1

 

Could anyone, please, explain such strange u-boot action? Is it because of

wrong spi settings, that u-boot perform during it's initialisation,

broken flash or other reasons. And how can I check who is work wrong:

u-boot, spi subsystem or the flash?

 

 

QuoteReplyEditDelete

 

 

2010-06-01 09:27:30     Re: Bf537-stamp+spi flash

Mike Frysinger (UNITED STATES)

Message: 90050   

 

u-boot is 1.1.6 is ancient and the old eeprom flash driver is not supported

 

as for the AT45DB081x part, that is not supported in the last release.  current trunk should support it fine.

QuoteReplyEditDelete

 

 

2010-06-03 08:16:11     Re: Bf537-stamp+spi flash

Nikolay Razbegaev (RUSSIAN FEDERATION)

Message: 90106   

 

Thank you for advise! u-boot-2009.11.1 form u-boot-trunk-svn archived

distribution perform sf write/read/probe commands fine w/o corrupt

any data bit.

 

Another question. How `include/config/bf537-stamp.h' file should be

modified in order to compile u-boot image for booting from spi flash

(i.e. u-boot on spi flash). I tried to follow steps from u-boot wiki:

change CONFIG_BFIN_BOOT_MODE from `BFIN_BOOT_BYPASS' to

`BFIN_BOOT_SPI_MASTER' in `include/config/bf537-stamp.h', recompile

u-boot.ldr image and write in into spi flash using `sf write' command.

But when I switched boot mode selector on board into spi booting mode

I got nothing on serial console. Is there some another special

parameters for AT45DB081D flash? As I can see from

`include/config/bf537-stamp' `CONFIG_SPI_FLASH_ATMEL' parameter is

already defined.

QuoteReplyEditDelete

 

 

2010-06-03 13:11:29     Re: Bf537-stamp+spi flash

Mike Frysinger (UNITED STATES)

Message: 90111   

 

did you `make clean` after changing your config file ?

QuoteReplyEditDelete

 

 

2010-06-04 05:38:48     Re: Bf537-stamp+spi flash

Nikolay Razbegaev (RUSSIAN FEDERATION)

Message: 90125   

 

I tried with fresh unpacked u-boot snapshot from trunk:

 

- edit include/config/bf537-stump.h:

 

  % diff include/configs/bf537-stamp.h.original include/configs/bf537-stamp.h  

  15c15                                                                      

  < #define CONFIG_BFIN_BOOT_MODE       BFIN_BOOT_BYPASS                     

  ---                                                                        

  > #define CONFIG_BFIN_BOOT_MODE       BFIN_BOOT_SPI_MASTER                 

 

- make bf537-stamp_config

 

- call make

 

- load u-boot.bin via uart:

 

  bfin> loadb                                                                                               

  ## Ready for binary (kermit) download to 0x01000000 at 57600 bps...                                     

                                                                                                          

  (Back at localhost.localdomain)                                                                         

  ----------------------------------------------------                                                    

  C-Kermit 8.0.211, 10 Apr 2004, for Linux                                                                

   Copyright (C) 1985, 2004,                                                                              

    Trustees of Columbia University in the City of New York.                                              

  Type ? or HELP for help.                                                                                

  (/home/marsijanin/stuff/bf/uboot/u-boot-trunk-svn-2281/u-boot-2009.11.1/) C-Kermit>send ./u-boot.bin    

  (/home/marsijanin/stuff/bf/uboot/u-boot-trunk-svn-2281/u-boot-2009.11.1/) C-Kermit>connect              

  Connecting to /dev/ttyS1, speed 57600                                                                   

   Escape character: Ctrl-\ (ASCII 28, FS): enabled                                                       

  Type the escape character followed by C to get back,                                                    

  or followed by ? to see other options.                                                                  

  ----------------------------------------------------                                                    

  ## Total Size      = 0x00029c44 = 171076 Bytes                                                          

  ## Start Addr      = 0x01000000                                                                         

 

- test new image:

 

  bfin> go $(loadaddr)                                       

  ## Starting application at 0x01000000 ...                  

                                                             

                                                             

  U-Boot 2009.11.1 (ADI-2010R1-pre) (Июн 04 2010 - 09:58:20) 

                                                             

  CPU:   ADSP bf537-0.2 (Detected Rev: 0.2) (spi flash boot) 

  Board: ADI BF537 stamp board                               

         Support: http://blackfin.uclinux.org/               

  Clock: VCO: 500 MHz, Core: 500 MHz, System: 125 MHz        

  RAM:   64 MB                                               

  Flash:  4 MB                                               

  *** Warning - bad CRC, using default environment           

                                                             

  In:    serial                                              

  Out:   serial                                              

  Err:   serial                                              

  KGDB:  [on serial] ready                                   

  Net:   Blackfin EMAC                                       

  Hit any key to stop autoboot:  0                           

 

 

- load u-boot.ldr image:

 

  bfin> loadb                                                                                           

  ## Ready for binary (kermit) download to 0x01000000 at 57600 bps...                                   

                                                                                                        

  (Back at localhost.localdomain)                                                                       

  ----------------------------------------------------                                                  

  (/home/marsijanin/stuff/bf/uboot/u-boot-trunk-svn-2281/u-boot-2009.11.1/) C-Kermit>send u-boot.ldr    

  (/home/marsijanin/stuff/bf/uboot/u-boot-trunk-svn-2281/u-boot-2009.11.1/) C-Kermit>connect            

  Connecting to /dev/ttyS1, speed 57600                                                                 

   Escape character: Ctrl-\ (ASCII 28, FS): enabled                                                     

  Type the escape character followed by C to get back,                                                  

  or followed by ? to see other options.                                                                

  ----------------------------------------------------                                                  

  ## Total Size      = 0x0002be52 = 179794 Bytes                                                        

  ## Start Addr      = 0x01000000                                                                       

 

- init, erase spi flash and write ldr image into it:

 

  bfin> sf probe 1                                

  1056 KiB AT45DB081D at 0:1 is now current device

  bfin> sf erase 0 0x108000                       

  bfin> sf write $(loadaddr) 0 $(filesize)        

 

But, then I switch board into boot form spi flash mode I still got nothing

on console.

 

u-boot-2010.03 distribution (form the same tarball) with

BFIN_BOOT_SPI_MASTER defined failed to write anything into spi flash:

 

U-Boot 2010.03 (ADI-2010R1-pre) (Июн 04 2010 - 12:15:44)

 

CPU:   ADSP bf537-0.2 (Detected Rev: 0.2) (spi flash boot)

Board: ADI BF537 stamp board

       Support: http://blackfin.uclinux.org/

Clock: VCO: 500 MHz, Core: 500 MHz, System: 125 MHz

RAM:   64 MB

Flash:  4 MB

SF: Detected AT45DB081D with page size 264, total  1 MB

*** Warning - bad CRC, using default environment

 

In:    serial

Out:   serial

Err:   serial

KGDB:  [on serial] ready

Warning: Generating 'random' MAC address

Net:   Blackfin EMAC

Hit any key to stop autoboot:  0

bfin> sf probe 1

SF: Detected AT45DB081D with page size 264, total  1 MB

1056 KiB AT45DB081D at 0:1 is now current device

bfin> sf erase 0 0x108000

bfin> sf write 0x20000000 0 0x3ffff

bfin> sf read $(loadaddr) 0 0x3ffff

bfin> cmp.b $(loadaddr) 0x20000000 0x3ffff

byte at 0x01000000 (0xff) != byte at 0x20000000 (0x60)

Total of 0 bytes were the same

bfin> md $(loadaddr)

01000000: 00ffffff 00000000 00000000 00000000    ................

01000010: 00000000 00000000 00000000 00000000    ................

01000020: 00000200 00000000 00000000 00000000    ................

01000030: 00000000 00000000 00001000 00000000    ................

01000040: 00000000 00000000 00000000 00010000    ................

01000050: 00000000 00000000 00000800 00000000    ................

01000060: 00000000 00000000 00000000 00000000    ................

01000070: 00000000 00000000 00400000 00000000    ..........@.....

01000080: 00000000 00000000 00000000 00000000    ................

01000090: 00000000 00000000 00000000 00000000    ................

010000a0: 00000000 00011000 00000000 00000000    ................

010000b0: 00000000 00000000 00010000 00000000    ................

010000c0: 00000000 00000000 00001000 00000000    ................

010000d0: 00000000 00000000 00000000 00000000    ................

010000e0: 00000000 00011001 00000000 00000800    ................

010000f0: 00000000 00000000 00000000 00000000    ................

bfin> md 0x20000000

20000000: ffa00060 00000000 00000012 00f4ffa0    `...............

20000010: 000a0000 05c00166 01510150 01530152    ....f...P.Q.R.S.

20000020: 01590158 015b015a 015d015c 015f015e    X.Y.Z.[.\.].^._.

20000030: 01550154 01570156 01610160 ffc0e14a    T.U.V.W.`.a.J...

20000040: 01630162 0424e10a ffc0e149 e1099550    b.c...$.I...P...

20000050: 60080124 e14a9308 e10affc0 e1200010    $..`..J....... .

20000060: 97100300 95106fc2 40fbe121 080842c0    .....o..!..@.B..

20000070: 97111803 e14a0020 e10affc0 60280004    .... .J.......(`

20000080: 6fe29710 e1819510 42c0a800 18030808    ...o.......B....

20000090: 00209711 ffc0e14a 7bb0e140 0a04e10a    .. .J...@..{....

200000a0: 7bb0e100 e1409310 6c22ffc2 7bb0e100    ...{..@..."l...{

200000b0: e1209310 6fc200ff e1209710 6cc20306    .. ....o.. ....l

200000c0: 61289710 97106fe2 0091e140 e1006fe2    ..(a.o..@....o..

200000d0: 9310114d 930863f8 01220123 01200121    M....c..#.".!. .

200000e0: 01160117 01140115 011e011f 011c011d    ................

200000f0: 011a011b 01180119 01120113 01100111    ................

 

If some there in the known universe exist an u-boot version (svn/git

revision) that work with dam AT45DB081D!?

 

 

QuoteReplyEditDelete

 

 

2010-06-04 13:19:01     Re: Bf537-stamp+spi flash

Mike Frysinger (UNITED STATES)

Message: 90137   

 

you're asking about a SPI flash part we dont make and a driver we didnt write and a part we dont have.  we have verified that the SPI flash subsystem works fine on parts that are on all the different ADI boards (and then some), but that's it.  if that Atmel part isnt working then, then it probably makes more sense to ask Atmel why their driver isnt working.

 

the Blackfin SPI driver as well as the SPI flash drivers have extended debugging that can be enabled with '#define DEBUG' at the top.

QuoteReplyEditDelete

 

 

2010-06-07 06:20:51     Re: Bf537-stamp+spi flash

Nikolay Razbegaev (RUSSIAN FEDERATION)

Message: 90172   

 

All right when. Cud you, please, recommend flash model? I want to

install u-boot and uClinux distribution on it and also boot from spi,

not form on board parallel flash, i.e. 4 megabytes minimum. According

to wiki example M25P16 device should be fine, but it have not enough

size for my tasks. What about other ST Micro flash?

QuoteReplyEditDelete

 

 

2010-06-07 13:47:20     Re: Bf537-stamp+spi flash

Mike Frysinger (UNITED STATES)

Message: 90176   

 

the M25P## parts should all operate the same.  i have a M25P128 connected right now and it works fine with the current release.  testing with just random garbage in external memory:

 

U-Boot 2008.10-svn2310 (ADI-2009R1.1-rc1) (Jun  7 2010 - 12:46:09)

 

CPU:   ADSP bf537-0.2 (Detected Rev: 0.2) (bypass boot)

Board: ADI BF537 stamp board

       Support: http://blackfin.uclinux.org/

Clock: VCO: 500 MHz, Core: 500 MHz, System: 125 MHz

RAM:   64 MB

Flash:  4 MB

In:    serial

Out:   serial

Err:   serial

Net:   Blackfin EMAC

MAC:   00:E0:22:FE:44:EC

Hit any key to stop autoboot:  0

 

bfin> sf probe 1

SF: Got idcode 20 20 18

16384 KiB M25P128 at 0:1 is now current device

 

bfin> sf erase 0 0x1000000

bfin> sf write 0x1000000 0 0x1000000

bfin> sf read 0x2000000 0 0x1000000

bfin> cmp.b 0x1000000 0x2000000 0x1000000

Total of 16777216 bytes were the same

QuoteReplyEditDelete

 

 

2010-06-09 06:09:57     Re: Bf537-stamp+spi flash

Nikolay Razbegaev (RUSSIAN FEDERATION)

Message: 90221   

 

As I wrote AT45DB081D can perform such read write compare test as well, as yours M25P128. But can u-boot actually boot from yours M25P128? Was booting from spi flash feature tested for bf537-stamp board ever?

QuoteReplyEditDelete

 

 

2010-06-09 18:56:01     Re: Bf537-stamp+spi flash

Mike Frysinger (UNITED STATES)

Message: 90237   

 

of course it boots just fine.  if you read the documentation, you'll see that booting from atmel flashes works *only when it is in power-of-2 mode* and that mode *is not the default*.

 

U-Boot 2008.10 (ADI-2009R1.1-rc1) (Dec  4 2009 - 03:21:39)

 

CPU:   ADSP bf537-0.2 (Detected Rev: 0.2) (bypass boot)

Board: ADI BF537 stamp board

       Support: http://blackfin.uclinux.org/

Clock: VCO: 500 MHz, Core: 500 MHz, System: 125 MHz

RAM:   64 MB

Flash:  4 MB

In:    serial

Out:   serial

Err:   serial

Net:   Blackfin EMAC

MAC:   00:E0:22:FE:44:EC

Hit any key to stop autoboot:  0

bfin> t 10 u-boot-bf537-stamp-spi-2009R1.1-rc1.ldr

Using Blackfin EMAC device

TFTP from server 192.168.1.2; our IP address is 192.168.1.15

Filename 'u-boot-bf537-stamp-spi-2009R1.1-rc1.ldr'.

Load address: 0x10

Loading: ###########

done

Bytes transferred = 158580 (26b74 hex)

bfin> sf probe 1

SF: Got idcode 20 20 18

16384 KiB M25P128 at 0:1 is now current device

bfin> sf erase 0 0x40000

bfin> sf write 10 0 $(filesize)

<change bmode pin to 3>

bfin> reset�

 

U-Boot 2008.10 (ADI-2009R1.1-rc1) (Dec  4 2009 - 03:22:03)

 

CPU:   ADSP bf537-0.2 (Detected Rev: 0.2) (spi flash boot)

Board: ADI BF537 stamp board

       Support: http://blackfin.uclinux.org/

Clock: VCO: 500 MHz, Core: 500 MHz, System: 125 MHz

RAM:   64 MB

Flash:  4 MB

SF: Got idcode 20 20 18

In:    serial

Out:   serial

Err:   serial

Net:   Blackfin EMAC

MAC:   00:E0:22:FE:44:EC

Hit any key to stop autoboot:  0

bfin>

Attachments

    Outcomes