This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

U-boot is not detecting the SPI flash memory connected to SPI0 in an AM1705 processor

Other Parts Discussed in Thread: OMAP-L137, AM1705

Hello Titus, Shankari and Norman,

As you could already know I finally was able to boot using U-boot.

https://e2e.ti.com/support/dsp/omap_applications_processors/f/42/p/542505/1980690#1980690

I created this new post to solve a new problem related to SPI flash.

After re-applying power to the PCB, the data displayed in my terminal is the following:


U-Boot 2009.11 (Sep 19 2016 - 17:36:38)

I2C: ready
DRAM: 32 MB
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
ARM Clock : 300000000 Hz
Read from EEPROM @ 0x50 failed
Ethernet switch start failed!
Net: Ethernet PHY: GENERIC @ 0x00

Hit any key to stop autoboot: 0
Failed to initialize SPI flash at 0:0
No SPI flash selected. Please run `sf probe'
Wrong Image Format for bootm command
ERROR: can't get kernel image!
U-Boot >

I tried to save the enviroment variables, but I realized that the SPI flash IC is not being detected by U-boot.

Failed to initialize SPI flash at 0:0
No SPI flash selected. Please run `sf probe'

Running sf probe doesn't help either. 

I know that the memory is OK because I was able to flash it with the sfh_OMAP-L137.exe without issues.

I would like to have U-boot and its enviroment variables located in the same SPI flash memory connected IC to SPI0. I don't know if this is possible.

The brand of my Flash memory is SPANSION and its part number is S25FL132K0XMFI011

The datasheet can be seen here:

 http://www.cypress.com/file/196886/download

I'm using DaVinci-PSP-SDK-03.20.00.14.
The U-boot directory is: DaVinci-PSP-SDK-03.20.00.14-custom/src/u-boot/uboot-03.20.00.14/

I also have modified the following file “include/configs/da830evm.h:”

Where I changed CONFIG_SPI_FLASH_WINBOND to CONFIG_SPI_FLASH_SPANSION to support my memory.

 

#ifdef CONFIG_USE_SPIFLASH
#undef CONFIG_ENV_IS_IN_FLASH
#undef CONFIG_ENV_IS_IN_NAND
#define CONFIG_ENV_IS_IN_SPI_FLASH
#define CONFIG_ENV_SIZE (16 << 10)
#define CONFIG_ENV_OFFSET (256 << 10)
#define CONFIG_ENV_SECT_SIZE 4096
#define CONFIG_SYS_NO_FLASH
#define CONFIG_SPI
#define CONFIG_SPI_FLASH
#define CONFIG_SPI_FLASH_SPANSION
#define CONFIG_DAVINCI_SPI
#define CONFIG_SYS_SPI_BASE DAVINCI_SPI0_BASE
#define CONFIG_SYS_SPI_CLK clk_get(DAVINCI_SPI0_CLKID)
#define CONFIG_SF_DEFAULT_SPEED 30000000
#define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
#endif


After compiling and flashing the new image to the AM1705, the problem continues. I haven't been able to use SPI flash under U-boot.

As always, your help will be very much appreciated.

Best regards,

Patricio Cohen

 

 

  • The brand of my Flash memory is SPANSION and its part number is S25FL132K0XMFI011

    The datasheet can be seen here:

    I'm using DaVinci-PSP-SDK-03.20.00.14.

    The U-boot directory is: DaVinci-PSP-SDK-03.20.00.14-custom/src/u-boot/uboot-03.20.00.14/

    I also have modified the following file “include/configs/da830evm.h:”

    Where I changed CONFIG_SPI_FLASH_WINBOND to CONFIG_SPI_FLASH_SPANSION to support my memory.

    Please do make sure that u-boot has the support for your SPI memory.

    #ifdef CONFIG_SPI_FLASH_SPANSION /* SPANSION */

    {"S25FL008A",   0x010213, 0x0, 64 * 1024,    16, RD_NORM,  0},

    {"S25FL016A",   0x010214, 0x0, 64 * 1024,    32, RD_NORM,  0},

    {"S25FL032A",   0x010215, 0x0, 64 * 1024,    64, RD_NORM,  0},

    {"S25FL064A",   0x010216, 0x0, 64 * 1024,   128, RD_NORM,  0},

    {"S25FL116K",   0x014015, 0x0, 64 * 1024,   128, RD_NORM,  0},

    {"S25FL132K",   0x014016, 0x0140, 64 * 1024,   128, RD_FULL,  0},

    {"S25FL164K",   0x014017, 0x0140, 64 * 1024,   256, RD_FULL,  0},

    {"S25FL128P_256K", 0x012018, 0x0300,   256 * 1024,    64, RD_FULL,     WR_QPP},

    {"S25FL128P_64K",  0x012018, 0x0301,    64 * 1024,   256, RD_FULL,     WR_QPP},

    {"S25FL032P",   0x010215, 0x4d00,    64 * 1024,    64, RD_FULL,     WR_QPP},

    {"S25FL064P",   0x010216, 0x4d00,    64 * 1024,   128, RD_FULL,     WR_QPP},

    {"S25FL128S_256K", 0x012018, 0x4d00,   256 * 1024,    64, RD_FULL,     WR_QPP},

    {"S25FL128S_64K",  0x012018, 0x4d01,    64 * 1024,   256, RD_FULL,     WR_QPP},

    {"S25FL256S_256K", 0x010219, 0x4d00,   256 * 1024,   128, RD_FULL,     WR_QPP},

    {"S25FL256S_64K",  0x010219, 0x4d01, 64 * 1024,   512, RD_FULL,     WR_QPP},

    {"S25FS512S",      0x010220, 0x4D00,   128 * 1024,   512, RD_FULL,                   WR_QPP},

    {"S25FL512S_256K", 0x010220, 0x4d00,   256 * 1024,   256, RD_FULL,     WR_QPP},

    {"S25FL512S_64K",  0x010220, 0x4d01,    64 * 1024,  1024, RD_FULL,     WR_QPP},

    {"S25FL512S_512K", 0x010220, 0x4f00,   256 * 1024,   256, RD_FULL,     WR_QPP},

    #endif

  • I have checked the SDK (u-boot) which you are using and sorry, the above code will not be available in u-boot source.

    1) In SPI data sheet, normal read speed is 50MHz clock rate but we mentioned as 30MHz, could you try to increase to 50MHz and see.

    #define CONFIG_SF_DEFAULT_SPEED 50000000
    #define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED

    2) If 1st point is not worked out, try to debug the "spi_flash_probe_spansion" function while you do "sf probe 0"
  • Hello Titus,

    I have tried number 1) and it did not work.

    I searched the web on how to debug U-boot but I did not find anything useful. Can you please explain me how to do it?

    Thank you
    Best regards,

    Patricio
  • You can try to put some prints and check the code flow, and see where the code is stuck or not executing as expected.
  • Hello Titus,

    OK, I seem I have solved it by modifying the spansion.c file located in “drivers/mtd/spi/”.

    I added a new item to the spansion_spi_flash_params spansion_spi_flash_table[].

    Now I'm using DaVinci-PSP-SDK-03.22.00.04 because the older version had issues when saving environment variables to SPI flash. With this new version the problem is solved.

    Detail shown below:

    #define SPSN_ID_S25FL132K 0x4016

    #define SPSN_EXT_ID_S25FL132K 0x0140

    static const struct spansion_spi_flash_params spansion_spi_flash_table[] = {

    {

    .idcode1 = SPSN_ID_S25FL008A,

    .idcode2 = 0,

    .page_size = 256,

    .pages_per_sector = 256,

    .nr_sectors = 16,

    .name = "S25FL008A",

    },

    {

    .idcode1 = SPSN_ID_S25FL016A,

    .idcode2 = 0,

    .page_size = 256,

    .pages_per_sector = 256,

    .nr_sectors = 32,

    .name = "S25FL016A",

    },

    {

    .idcode1 = SPSN_ID_S25FL032A,

    .idcode2 = 0,

    .page_size = 256,

    .pages_per_sector = 256,

    .nr_sectors = 64,

    .name = "S25FL032A",

    },

    {

    .idcode1 = SPSN_ID_S25FL064A,

    .idcode2 = 0,

    .page_size = 256,

    .pages_per_sector = 256,

    .nr_sectors = 128,

    .name = "S25FL064A",

    },

    {

    .idcode1 = SPSN_ID_S25FL128P,

    .idcode2 = SPSN_EXT_ID_S25FL128P_64KB,

    .page_size = 256,

    .pages_per_sector = 256,

    .nr_sectors = 256,

    .name = "S25FL128P_64K",

    },

    {

    .idcode1 = SPSN_ID_S25FL128P,

    .idcode2 = SPSN_EXT_ID_S25FL128P_256KB,

    .page_size = 256,

    .pages_per_sector = 1024,

    .nr_sectors = 64,

    .name = "S25FL128P_256K",

    },

    {

    .idcode1 = SPSN_ID_S25FL132K,

    .idcode2 = SPSN_EXT_ID_S25FL132K,

    .page_size = 256,

    .pages_per_sector = 16,

    .nr_sectors = 1024,

    .name = "S25FL132K",

    },

    };

    Best regards,

    Patricio Cohen

  • Sounds good.
    Thanks for the update.