Unable to boot from spansion SPI Flash

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to boot from spansion SPI Flash

3,868 Views
pt
Senior Contributor I

Hi

     I am using customized imx28 board. I am able to boot from SD card.

     But SPI boot is not working.

    

     When I tried to boot from SPI, it prints 0x80501003 error code( The file signature or file version is incorrect )

   

     Linux BSP          : 2.6.35.3-1.1.0

     uboot version     :u-boot-2009.08

     Processor            :i.mx281

     SPI NOR Flash   :Spansion S25FL256S_64K

   

     I have applied the uboot and kernel patches which are specified in this thread How to enable SPI NOR boot for i.MX28 (Spansion s25fl256s)

     I have faced an issue while detecting the flash.

    

     Selection_030.png

     I have added ss1,ss2 pins to spi pin desc struct .( mx28_evk.c file )

    

     After that sf probe detected the SPANSION flash.

    sf probe 2:0

     sf set_config_reg 0x04

     sf erase 0x0 0x300000

     sf write 0x42000000 0x0 0x300000

    

     The linux boot stream image is written to flash.

     Then I set boot mode to 0010.But I am  getting 0x80501003 ROM error code.

     Regards

     Pt

Labels (2)
20 Replies

742 Views
BacemDaassi
Contributor II

Hello Pt,

1. Please refer to the following slide deck which describes in details how to fully boot from Spansion's SPI flash:

https://community.freescale.com/servlet/JiveServlet/download/299938-167438/2-i.MX28_Building_Blocks....

On this slide deck, you can also see that there is even some h/w modifications required on the i.MX28 EVK.

2. I see that you're relocating the parameter blocks (4kB) at the top of the array (high addresses) which is actually good for boot images.

Please double check that the configuration register was correctly set to 0x4 as you did using the command: "sf set_config_reg 0x04"

3. I suspect your system is not able to boot because of wrong image format programmed to the SPI flash (SPI config block, u-boot...).

Here is an example of how your flash content should look like at offset 0:

flash_content.png

On our system (also i.MX28 EVK) which should be similar to yours:

- At offset, we have the SPI config block,

- At offset 0x1000, you should be able to find your u-boot,

- At offset 0x50000, you should find your Linux Kernel.

Please dump your flash content after you program the boot images and make sure that you have the right image formats in there.

I see that you're copying your images from offset: "0x42000000" to the SPI flash using the following command: "sf write 0x42000000 0x0 0x300000". How are the boot images first loaded to this offset "0x42000000".

4. Where is your rootfs located. If you're willing to boot everything from SPI flash, then 3MB is definitely not enough for uboot+kernel+rootfs.

Thanks!

Best regards,

Bacem Daassi

Spansion Inc.

742 Views
pt
Senior Contributor I

Hi

     Thank you albert_b

     I will refer those patches which are specified by you.

     I have applied the patches which are specified in the following thread

          How to enable SPI NOR boot for i.MX28 (Spansion s25fl256s)

   

     Thank you BacemDaassi.

     1. I will refer that ppt.

     2. I had used sf get_config_reg command to check configuration register. The register is correctly set.

     3.My spansion flash content doesn't looks like the example that you shared here. At offset zero , I am writing linux boot stream image(imx28_ivt_linux.sb).

         My aim is to store linux boot stream image and rootfs.jffs2 on SPI flash.( not using uboot boot stream image (imx28_ivt_uboot.sb)).

        

       I don't have spi config block. In my linux BSP code, I couldn't found it.

        

          I have used 'loady' to download image to 0x42000000. I have tried another method too.

          Another method:

          Copied the boot stream image to sd card. (Created a fat partition in SD to store the file)

          And fatload command is used to load the image to "0x42000000".

    

     4.  I want to store rootfs.jffs2 on SPI. The 3MB is for linux boot stream image. 3MB partition is only for boot stream image,  not for boot-stream-image + rootfs.jffs2

          The rootfs is almost 20MB. I have partitioned SPI as mtd0(3MB) and mtd1(21MB).

               mtd0 : linux boot stream image

               mtd1: rootfs.jffs2

        

        

     Regards

     Pt A R

0 Kudos

742 Views
BacemDaassi
Contributor II

Hello Pt A R,


Yes, please refer to the slide deck I sent you in my previous post. There, you will find useful information about how to configure your system to make it boot out of SPI.

I think you must have the SPI config block at the very beginning of your flash since that's the first area that's being read by the ROM code in order to do the init first of your SPI (needed for code shadowing: SPI --> RAM). If this block is not there, then this might explain your issue.

I think you can reuse the SPI config block content I included in my previous post and give it a try.


Maybe you're missing the Boot setup in your BSP and you just need to tell it that you want to build it for a SPI boot. Once you configure it the right way, it should output the correct image format to be flashed to the SPI.


Booting completely out of our FL-S SPI is definitely possible and the partitioning (for Kernel+rootfs) you mentioned earlier should be fine.


Thanks!


Best regards,

Bacem Daassi

Spansion Inc.

0 Kudos

742 Views
pt
Senior Contributor I

Hi BacemDaassi

     I have seen spi-config-block file in the following link.

     https://github.com/embeddedarm/linux-2.6.35.3-imx28/blob/master/imx-bootlets-src-10.12.01/spi-build....

     Is the spi-config-block is similar to this file? Can I take this as an example to build spi-config-block?

Regards

Pt A R

0 Kudos

742 Views
BacemDaassi
Contributor II

Hello Pt A R,


This looks like a good alternative to generate the config block and include it in your boot image.

Please also refer to the following link which includes more details about how to integrate this extra module into your build:

https://github.com/embeddedarm/linux-2.6.35.3-imx28/commit/fbbc71030c5de8e054d1b5151703bbcb9076c419

There you can find: "Makefile", "spi-build.c" and even the binary "spi-build" were all included.


Please give it a try and let me know how things will work for you. Thanks!

Best regards,

Bacem Daassi

Spansion Inc.

0 Kudos

742 Views
pt
Senior Contributor I

Hi BacemDaassi

     The necessary changes has been applied to my bootlet code to build imx28_ivt_linux.spi.   

     But the hex dump of this file differs from the example that you have shared here. The file signature mismatches.  The hex content looks like that it is swapped.

Selection_036.png

     I checked the spi-build.c code and corrected it.

    

Selection_041.png

Selection_040.png

Now the hex dump looks similar to your example. But still I am getting that ROM error code H0x80501003 - The file signature or file version is incorrect.

Regards

Pt A R

0 Kudos

742 Views
BacemDaassi
Contributor II

Hello Pt A R,


I'm pretty sure that you're having an endianess issue here.

Please refer to the iMX28 reference manuel which you can get from here:

http://cache.freescale.com/files/dsp/doc/ref_manual/MCIMX28RM.pdf?fasp=1&WT_TYPE=Reference%20Manuals...

On page 1028 of the RM, you can find the format of the config block.


From the binary image you sent above, I can see that the BootStartAddr is 0x00000400. Did you write your u-boot to this address?


Could you please try to use the config block I included in my other post as it is and give it a try?


By the way, to make the SPI work on i.MX28 EVK, some resistors need to be added to the board. Did you already add those?


Thanks!

Best regards,

Bacem Daassi

Spansion Inc.

0 Kudos

742 Views
pt
Senior Contributor I

Hi BacemDaassi,


Thank you.


>From the binary image you sent above, I can see that the BootStartAddr is 0x00000400. Did you write your u-boot to this address?


In my project, we are using linux boot stream image and rootfs only. So that we have written imx28_ivt_linux.sb on 0x400.


Selection_042.png


>Could you please try to use the config block I included in my other post as it is and give it a try?


I didn't see any config block.You had shared its hex dump only.


>By the way, to make the SPI work on i.MX28 EVK, some resistors need to be added to the board. Did you already add those?


Selection_030.png

Regards

Pt A R

0 Kudos

742 Views
BacemDaassi
Contributor II

Hello Pt A R,


Please provide me with your email address so that I can send you the full flash image we used in our lab here to fully boot from our S25FL129S SPI device using the i.MX28 EVK.

I wasn't able to include the file in this thread.

This file will contain the config block, u-boot, Linux Kernel and rootfs.


Thanks!

Best regards,

Bacem Daassi

Spansion Inc.

0 Kudos

742 Views
pt
Senior Contributor I

Hi

     Thank you. I have sent you my email id. Please check your message.

Regards

Pt A R

0 Kudos

742 Views
pt
Senior Contributor I

Hi BacemDaassi

We have tested using the image that you had shared. But we are getting the same ROM error code - H0X80501003

Regards

Pt A R

0 Kudos

742 Views
BacemDaassi
Contributor II

Hello Pt A R,


Are you making sure to fully erase the flash every time you want to program something new to it?

Programming without a prior erase will definitely make you end up with a corrupted SPI flash content.

Therefore, you should use the erase command:

> sf erase 0x0 0x2000000

Then the program command:

> sf write 0x42000000 0 0x2000000

Please also double check that you have the right image loaded to address 0x42000000.

Thanks!

Best regards,

Bacem Daassi

Spansion Inc.

0 Kudos

742 Views
pt
Senior Contributor I

Hi BacemDaassi

I always erase the flash before writing  image to it. I have checked the hex format of image.

Also I have read back the image after resetting. Then I checked the first two-three blocks of it, and it matches with the flash image.

From this,it is sure that the image didn't get corrupted.

But still I am getting the "H0x80501003 - The file signature or file version is incorrect ".

Regards

Pt

0 Kudos

742 Views
BacemDaassi
Contributor II

Hello Pt A R,


Here is the official u-boot documentation about booting the i.MX28 EVK from SPI:

http://git.denx.de/?p=u-boot.git;a=blob;f=doc/README.mxs;h=ed2e5688562ac1af55a7c6213f5f3eb825e055b8;...

http://git.denx.de/?p=u-boot.git;a=blob;f=board/freescale/mx28evk/README;h=f9d6324114191f629fbc8b823...


Well, I think you already followed these steps. But let me ask you to double check the following:

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

To boot MX28EVK from SPI NOR flash, set the boot mode DIP switches as:

* Boot Mode Select: 0 0 1 0 (Boot from SSP2)

* JTAG PSWITCH RESET: To the right (reset disabled)

* Battery Source: Down

* Wall 5V: Up

* VDD 5V: To the left (off)

* Hold Button: Down (off)


"make mx28evk_spi_config"       - store enviroment variables into SPI NOR flash

Choose the target accordingly.

Note: mx28evk does not come with SPI NOR flash populated from the factory.

It is possible to solder a SOIC memory on U49 or use a DIP8 on J89.

To get SPI communication to work R320, R321,R322 and C178 need to be populated.

Look in the schematics for the proper component values.

Follow the instructions from doc/README.mxs to generate a bootable SD card or

to generate a binary to be flashed into SPI NOR.


Last step is to power up the board and U-boot should start from SPI NOR.

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

I hope this will help solving your issue. Thanks!

Best regards,

Bacem Daassi

Cypress / Spansion Inc.

0 Kudos

742 Views
pt
Senior Contributor I

Hi BacemDaassi

1. Is it mandatory to populate R320, R321,R322 and C178?

In MCIMX28EVK, I have successfully booted up from SPI (Numonyx N25Q128).The development board doesn't populate with these resistors and capacitor.

But in the custom board I am not able to boot from SPI( SPANSION S25FL256S_64K).

2.Do I have to use those resistors and capacitors for my custom board to boot up from SPI?

Selection_030.png

The figure shows the SPI connection in the custom board.

I am able to read and write on SPI flash.I have placed uImage and rootfs on SPI flash.Then successfully booted from SD card and read uImage from SPI and logged in.

iMX28 U-Boot > setenv bootargs_spi 'setenv bootargs root=/dev/mtdblock1 rootwait rw rootfstype=jffs2'    

iMX28 U-Boot > setenv bootcmd_spi 'run bootargs_spi;sf probe 0;sf read 0x42000000 0x0 0x300000;bootm'

iMX28 U-Boot > run bootcmd_spi


So I think there is no problem in erase,write and read.

3.Still it doesn't boot from SPI. Keep on getting that same error code H0x80501003.


Regards

Pt AR

Deep Thought Systems

0 Kudos

741 Views
lonsn
Contributor I

I meet with same issue as you. My problem is the HOLD pin of spi flash is connected to CPU directly without pull up. Then the spi flash is hold during power on. I fixed it by adding a pull up resistor in HOLD pin.

0 Kudos

742 Views
BacemDaassi
Contributor II

Hello Pt A R,


Did I understand correctly that you're able to boot from Nymonyx part but from Spansion's part?


On the i.MX28 EVK, the R320, R321 and R322 are pull-ups on WP#, CS# and HOLD#. These are not populated by default and need to be populated since these signals should not be left floating. C178 should be populated as well.

To enable Quad I/O on our board here, we had even to solder two additional wires to DQ2 and DQ3 (Hold# and WP#) to enable Quad I/O. Without those wires, you will not be able to use Quad I/O at all.


Thanks!

Best regards,

Bacem Daassi

Cypress / Spansion Inc.

0 Kudos

742 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi PtAR

what is size of linux boot stream image,

0x300000 is just 3MB, is it sufficient ?


Best regards

igor

0 Kudos

742 Views
pt
Senior Contributor I

Yes it is sufficient .

Linux boot stream image is 2.6MB.

Regards

Pt

0 Kudos

742 Views
albert_b
Contributor I

Hello Pt,

This is Spansion Engineering Solutions  (SES).  We have just been alerted of this issue, so please excuse me if the information detailed is redundant.

Just curious, did you attempt to use Linux MTD v3.0.15, u-boot patch for i.MX28 (08//09/2012, and u-boot patch for SPI FLASH (08/01/2013)?

Drive Software web page:

Software for NOR Flash, Serial Flash, SPI Flash, NAND Flash

Best regards,

AB