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.

Issue with Writing to QSPI flash from u-boot in AM437x based board

Other Parts Discussed in Thread: AM4377, TPS65218, SYSBIOS

Hi,

I am trying to write uboot into QSPI NOR flash from uboot on AM4377 based custom board.

I am using following uboot commands to write into QSPI flash and boot mode is SD boot

mmc rescan
fatload mmc 0 ${loadaddr} u-boot.img
sf probe 0
sf erase 0x0 0x100000
sf write ${loadaddr} 0x0 ${filesize}

I have also referred below link for a reference

http://processors.wiki.ti.com/index.php/Linux_Core_U-Boot_User's_Guide

Then I verified the written contents using sf read and md commands

sf read ${loadaddr} 0x0 ${filesize}
md.b ${loadaddr} ${filesize}

But when I try to boot from QSPI(boot setting changed to QSPI), It is not booting, When I checked the Flash content form CCS studio through JTAG interface using memory browser, Its not showing the written content on the respective addess.

Following are my observations

1. I flashed uboot from CCS Studio through JTAG and then I tried to boot from QSPI - QSPI boot is working fine. Even memory browser showing correct content

2. Read the Flash contents through sf read and md command and compared with the boot file. It is exactly same.

3. Now I wrote the boot file using uboot commands(sf write). Read the flash contents through sf read and md command and comapred with the boot file. It is exactly same.

Then why board is not booting in QSPI mode even though Flash written contents are proper and even CCS studio memory browser also not displaying correct content.

Please let me know If I am missing anything

Regards,

Krishna

  • Hi,

    Please post the log file from when you try to write to QSPI in U-boot.
  • Hi Biser,

    Thanks for the reply.
    Please find the log below

    --------------------Log start---------------

    U-Boot SPL 2015.04-rc1 (Aug 27 2015 - 16:30:10)
    reading u-boot.img
    reading u-boot.img


    U-Boot 2015.07-dirty (Oct 15 2015 - 12:02:36 +0530)

    I2C: ready
    DRAM: 512 MiB
    PMIC: TPS65218
    MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
    reading uboot.env

    Using default environment

    -------- genphy_config ---------SSDFB
    cpsw
    Hit any key to stop autoboot: 1 0
    switch to partitions #0, OK
    mmc0 is current device
    SD/MMC found on device 0
    reading uEnv.txt
    U-Boot#
    U-Boot#
    U-Boot#
    U-Boot#
    U-Boot#
    U-Boot# ls mmc rescan
    U-Boot# fatload mmc 0 ${loadaddr} u-boot.bin
    reading u-boot.bin
    409056 bytes read in 46 ms (8.5 MiB/s)
    U-Boot# sf probe 0
    SF: Detected MX25L51235F with page size 256 Bytes, erase size 64 KiB, total 64 MiB, mapped at 30000000
    U-Boot# sf erase 0x0 0x100000
    SF: 1048576 bytes @ 0x0 Erased: OK
    U-Boot# sf write ${loadaddr} 0x0 ${filesize}
    device 0 offset 0x0, size 0x63de0
    SF: 409056 bytes @ 0x0 Written: OK
    U-Boot# sf read ${loadaddr} ${filesize}
    device 0 offset 0x0, size 0x63de0
    SF: 409056 bytes @ 0x0 Read: OK
    U-Boot# md.b ${loadaddr} 0x20
    82000000: 30 00 00 40 00 00 00 00 00 00 0f e1 1f 00 c0 e3 0..@............
    82000010: d3 00 80 e3 e1 2f f0 00 07 00 a0 e3 46 cf a0 e3 ...../......F...
    U-Boot#
    ------------------Log End----------------

    Regards,
    Krishna
  • Thanks, I will forward this to the software team.
  • Hi,

    I have analyzed the uboot code and following are my observation.
    1. I have written the boot code using sf write command , then if I see the memory content using Code composer memory browser(JTAG interface) it shows junk values. Then I execute sf read for 4 bytes read , md command for 4 bytes display. After that if I see memory content on memory browser it shows same 4 bytes repeated in all memory regions. How sf read/ md command execution changing the memory content on CCS studio?

    2. QSPI flash is of 64 MB size. I did not find enabling 4 byte addressing mode in the uboot code ( I guess by default QSPI device will be in 3 bytes addressing mode). So I added code to enable 4 byte addressing mode (B7 command) and checked the written contens using sf read. But I am getting output as follows which shows that erase not happened properly.
    -------------------------Log start ---------------------------------------------
    sf read ${loadaddr} 0x0 0x400
    device 0 offset 0x0, size 0x400
    SF: 1024 bytes @ 0x0 Read: OK
    U-Boot# md.b ${loadaddr} 0x400
    82000000: 00 ff ff ff 00 ff ff ff 00 ff ff ff 00 ff ff ff ................
    82000010: 00 ff ff ff 00 ff ff ff 00 ff ff ff 00 ff ff ff ................
    82000020: 00 ff ff ff 00 ff ff ff 00 ff ff ff 00 ff ff ff ................
    82000030: 00 ff ff ff 00 ff ff ff 00 ff ff ff 00 ff ff ff ................
    82000040: 00 ff ff ff 00 ff ff ff 00 ff ff ff 00 ff ff ff ................
    82000050: 00 ff ff ff 00 ff ff ff 00 ff ff ff 00 ff ff ff ................
    82000060: 00 ff ff ff 00 ff ff ff 00 ff ff ff 00 ff ff ff ................
    82000070: 00 ff ff ff 00 ff ff ff 00 ff ff ff 00 ff ff ff ................
    82000080: 00 ff ff ff 00 ff ff ff 00 ff ff ff 00 ff ff ff ................
    82000090: 00 ff ff ff 00 ff ff ff 00 ff ff ff 00 ff ff ff ................
    820000a0: 00 ff ff ff 00 ff ff ff 00 ff ff ff 00 ff ff ff ................
    ----------------------Log End----------------------------------------

    Regards,
    Krishna
  • Hi,

    Log for previous mail Section 1 is as below where CCS studio memory browser displaying the last 4 byte contents read using sf read.
    If I don't do sf read, Memory browser displays all memory content as "00". What could be the issue?
    ---------------------------Log Start---------------------------------------
    sf probe 0
    SF: Detected MX25L51235F with page size 256 Bytes, erase size 64 KiB, total 64 MiB, mapped at 30000000
    U-Boot# sf read ${loadaddr} 0x0 0x40 10
    device 0 offset 0x0, size 0x10
    SF: 16 bytes @ 0x0 Read: OK
    U-Boot# md.b ${loadaddr} 0x4 10
    82000000: 30 00 00 40 00 00 00 00 00 00 0f e1 1f 00 c0 e3

    Memory contents in CCS studio (It is displaying last 4 bytes which is read to RAM using sf read)

    30000000: 1F00C0E3 1F00C0E3 1F00C0E3 1F00C0E3
    30000010: 1F00C0E3 1F00C0E3 1F00C0E3 1F00C0E3
    30000020: 1F00C0E3 1F00C0E3 1F00C0E3 1F00C0E3
    30000030: 1F00C0E3 1F00C0E3 1F00C0E3 1F00C0E3
    30000040: 1F00C0E3 1F00C0E3 1F00C0E3 1F00C0E3
    30000050: 1F00C0E3 1F00C0E3 1F00C0E3 1F00C0E3
    30000060: 1F00C0E3 1F00C0E3 1F00C0E3 1F00C0E3


    Regards,
    Krishna
  • Hi,

    Now I am able to write to QSPI flash from uboot. I referred am437x_sysbios_ind_sdk_2.0.0.2 sdk code for QSPI flashing and added the code to enable the quad mode that has to be enabled while flashing image. After adding the code to change to quad mode, I am able to program the binaries to QSPI flash and observe the memory content from JTAG.

    Thanks for the support.

    Regards,

    Krishna