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.

66AK2G12: Linux-rt: Flash QSPI via DFU

Part Number: 66AK2G12

Hi,

I am developing a custom board with 66ak2g12 and at the moment I am executing some test with the k2g-evm with linux-rt as OS, the sdk release is v.06_01_00_08. One of my taskes is to Flash QSPI via DFU. Generally the custom board will boot with QSPI but when a software modification is required, the boot will be executed via USB with DFU that shall flash the QSPI for the next boots.

After connecting to USB1 port and DB9 connector (UART0) from the board to PC and set SW3 for USB boot mode (0110), I sent the command "dfu-util.exe -l" and I obtained the following 

Found DFU: [0451:bb06] devnum=0, cfg=1, intf=0, alt=0, name="UNDEFINED"

After sending the command "dfu-util.exe -c 1 -i 0 -a 0 -D u-boot.img"; I accessed to u-boot and executed the following steps:

> env default -a
## Resetting to default environment

=> setenv dfu_alt_info ${dfu_alt_info_qspi}

=> sf probe 4:0
SF: Detected s25fl512s_256k with page size 256 Bytes, erase size 256 KiB, total 64 MiB

=> dfu 0 sf "4:0"
SF support not available!
DFU entities configuration failed!
(partition table does not match dfu_alt_info?)

How I can resolve this issue?

Before executing this steps I rebuilt the u-boot doing the following modifications:

I added  #include <environment/ti/dfu.h> in /include/configs/k2g_evm.h;

I added DFU_ALT_INFO_QSPI under #define DFUARGS  in /include/configs/ti_armv7_keystone2.h

and commented #define DFU_ALT_INFO_MMC because is already defined in dfu.h.

Thanks to this modification I resolved a previuos error in u-boot "Unknown command 'dfu_alt_info_qspi' - try 'help'"

Please I wait for a feedback to understand the problem and resolve it.

Regards

Graziano Rufolo

Hardware/Firmware Engineer

Hitachi Rail

  • Hi, Graziano,

    We have never tested DFU update on K2G platform. I am not sure if this feature is even supported. Let  me check internally and get back to you.

    Rex

  • Hi,

    in order to resolve the error "SF support not available! DFU entities configuration failed! (partition table does not match dfu_alt_info?)", I added "CONFIG_DFU_SF=y" in k2g_evm_defconfig file and rebuilt the u-boot.

    At this point I executed the steps below:

    u-boot=> env default -a
    ## Resetting to default environment


    u-boot=> setenv dfu_alt_info ${dfu_alt_info_qspi}


    u-boot=> dfu 0 sf "4:0:64000000:0"
    SF: Detected s25fl512s_256k with page size 256 Bytes, erase size 256 KiB, total 64 MiB

    From ubuntu PC: Using dfu-util utilities to flash the binares to QSPI flash.

    # sudo dfu-util -l
    
    Found DFU: [0451:d022] devnum=0, cfg=1, intf=0, alt=0, name="MLO"
    Found DFU: [0451:d022] devnum=0, cfg=1, intf=0, alt=1, name="u-boot.img"
    Found DFU: [0451:d022] devnum=0, cfg=1, intf=0, alt=2, name="u-boot-spl-os"
    Found DFU: [0451:d022] devnum=0, cfg=1, intf=0, alt=3, name="u-boot-env"
    Found DFU: [0451:d022] devnum=0, cfg=1, intf=0, alt=4, name="u-boot-env.backup"
    Found DFU: [0451:d022] devnum=0, cfg=1, intf=0, alt=5, name="kernel"

    Flash the binaries to the respective regions using alternate interface number (alt=<x>).

    # sudo dfu-util -c 1 -i 0 -a 0 -D MLO

    u-boot=>##########DOWNLOAD ... OK

    Ctrl+C to exit ...

    # sudo dfu-util -c 1 -i 0 -a 1 -D u-boot.img

    u-boot=>##########DOWNLOAD ... OK
    Ctrl+C to exit ...

    # sudo dfu-util -c 1 -i 0 -a 2 -D u-boot.dtb

    u-boot=>#DOWNLOAD ... OK
    Ctrl+C to exit ...

    # sudo dfu-util -c 1 -i 0 -a 5 -D Image

    uboot=>#####################################################################################################################################################################################################################################################################DOWNLOAD ... OK
    Ctrl+C to exit ...


    At this point I switched to 96MHz QSPI boot but nothing happened (I can't see anything on TeraTerm).

    Do you think that the steps above are correct to flash the QSPI?

    Do you suggest any other action?

    I wait for your feedback.


    Regards

    Graziano


    
    
    
    


  • Graziano,

    I am checking internally and will post back once i hear back.

    Rex

  • Hi Rex,

    have you received any feedback from your colleagues about this topic?

    I am waiting for your support to go on my activity.  Thank you for your collaboration.

    Regards

    Graziano

  • Hi, Graziano,

    I haven't heard back any. However, I spent some time yesterday on this issue. I don't think just enabling DFU_SF is enough. But other DFU configuration options are not available for K2G. I haven't been able to compile the u-boot yet. So, I have some doubt on the support of DFU on K2G. I will spend some more time to try different configuration and see if I can at least pass the compilation.

    Rex

  • Hi Rex,

    in order to be sure to modify correctly the u-boot sources for my task, I have not modified the sources as described in my past messages but I have used make menuconfig. Below you can see my actions:

      

    But this actions produce the following errors during the u-boot build:

    ...

    LD spl/drivers/usb/dwc3/dwc3.o
    CC spl/drivers/usb/dwc3/gadget.o
    CC spl/drivers/usb/dwc3/ep0.o
    CC spl/drivers/usb/dwc3/dwc3-generic.o
    drivers/usb/dwc3/dwc3-generic.c: In function ‘dwc3_generic_probe’:
    drivers/usb/dwc3/dwc3-generic.c:51:12: warning: assignment to ‘struct device *’ from incompatible pointer type ‘struct udevice *’ [-Wincompatible-pointer-types]
    dwc3->dev = dev;
    ^
    At top level:
    drivers/usb/dwc3/dwc3-generic.c:87:12: warning: ‘dwc3_generic_ofdata_to_platdata’ defined but not used [-Wunused-function]
    static int dwc3_generic_ofdata_to_platdata(struct udevice *dev)
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/usb/dwc3/dwc3-generic.c:75:12: warning: ‘dwc3_generic_remove’ defined but not used [-Wunused-function]
    static int dwc3_generic_remove(struct udevice *dev,
    ^~~~~~~~~~~~~~~~~~~
    drivers/usb/dwc3/dwc3-generic.c:44:12: warning: ‘dwc3_generic_probe’ defined but not used [-Wunused-function]
    static int dwc3_generic_probe(struct udevice *dev,
    ^~~~~~~~~~~~~~~~~~
    LD spl/drivers/usb/dwc3/built-in.o
    LD spl/dts/built-in.o
    CC spl/fs/fs_internal.o
    LD spl/fs/built-in.o
    LDS spl/u-boot-spl.lds
    LD spl/u-boot-spl
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: common/built-in.o: in function `run_usb_dnl_gadget':
    /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/common/dfu.c:73: undefined reference to `usb_gadget_handle_interrupts'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/common/dfu.c:83: undefined reference to `usb_gadget_handle_interrupts'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: env/built-in.o:(.data.env_htab+0xc): undefined reference to `env_flags_validate'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: lib/built-in.o: in function `hsearch_r':
    /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/lib/hashtable.c:379: undefined reference to `env_callback_init'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/lib/hashtable.c:381: undefined reference to `env_flags_init'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: drivers/usb/dwc3/built-in.o: in function `dwc3_glue_remove':
    /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/drivers/usb/dwc3/dwc3-generic.c:414: undefined reference to `dev_get_platdata'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: drivers/usb/dwc3/built-in.o: in function `dwc3_ti_select_dr_mode':
    /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/drivers/usb/dwc3/dwc3-generic.c:226: undefined reference to `dev_get_platdata'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/drivers/usb/dwc3/dwc3-generic.c:229: undefined reference to `device_is_compatible'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: drivers/usb/dwc3/built-in.o: in function `dev_read_u32_default':
    /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/include/dm/read.h:551: undefined reference to `ofnode_read_u32_default'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: drivers/usb/dwc3/built-in.o: in function `dwc3_glue_probe':
    /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/drivers/usb/dwc3/dwc3-generic.c:379: undefined reference to `dev_get_driver_data'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/drivers/usb/dwc3/dwc3-generic.c:380: undefined reference to `dev_get_platdata'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: drivers/usb/dwc3/built-in.o: in function `dev_read_addr':
    /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/include/dm/read.h:629: undefined reference to `devfdt_get_addr'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: drivers/usb/dwc3/built-in.o: in function `dwc3_glue_probe':
    /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/drivers/usb/dwc3/dwc3-generic.c:395: undefined reference to `device_find_first_child'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/drivers/usb/dwc3/dwc3-generic.c:402: undefined reference to `usb_get_dr_mode'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/drivers/usb/dwc3/dwc3-generic.c:403: undefined reference to `device_find_next_child'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: drivers/usb/dwc3/built-in.o: in function `dwc3_glue_bind':
    /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/drivers/usb/dwc3/dwc3-generic.c:290: undefined reference to `fdt_first_subnode'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/drivers/usb/dwc3/dwc3-generic.c:292: undefined reference to `fdt_get_name'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/drivers/usb/dwc3/dwc3-generic.c:299: undefined reference to `usb_get_dr_mode'
    /home/rufolog/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: /home/rufolog/workspace/hpc/linux-rt/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/drivers/usb/dwc3/dwc3-generic.c:291: undefined reference to `fdt_next_subnode'
    scripts/Makefile.spl:377: recipe for target 'spl/u-boot-spl' failed
    make[1]: *** [spl/u-boot-spl] Error 1
    Makefile:1659: recipe for target 'spl/u-boot-spl' failed
    make: *** [spl/u-boot-spl] Error 2

    Probably something shall be added/removed in menuconfig  in order to solve the issues above. Based on your experience, what are the actions to resolve the errors? 

    Regards

    Graziano

  • Hi, Graziano,

    Looking at the ProcSDK U-Boot User's Guide, for the DFU support, it needs to enable SPL-DFU feature. However, it is not an option kn K2G menuconfig. I suspect that is what is missing, and not supported by K2G.

    Rex

  • Rex,

    I  considered to  modify manually the u-boot sources (without using menuconfig) and in this way I restablished the situation described on the 3rd February, i.e.:

    u-boot=> env default -a

    ## Resetting to default environment


    u-boot=> setenv dfu_alt_info ${dfu_alt_info_qspi}


    u-boot=> dfu 0 sf "4:0:64000000:0"
    SF: Detected s25fl512s_256k with page size 256 Bytes, erase size 256 KiB, total 64 MiB

    From ubuntu PC: Using dfu-util utilities to flash the binares to QSPI flash.

    # sudo dfu-util -l
    
    Found DFU: [0451:d022] devnum=0, cfg=1, intf=0, alt=0, name="MLO"
    Found DFU: [0451:d022] devnum=0, cfg=1, intf=0, alt=1, name="u-boot.img"
    Found DFU: [0451:d022] devnum=0, cfg=1, intf=0, alt=2, name="u-boot-spl-os"
    Found DFU: [0451:d022] devnum=0, cfg=1, intf=0, alt=3, name="u-boot-env"
    Found DFU: [0451:d022] devnum=0, cfg=1, intf=0, alt=4, name="u-boot-env.backup"
    Found DFU: [0451:d022] devnum=0, cfg=1, intf=0, alt=5, name="kernel"

    Flash the binaries to the respective regions using alternate interface number (alt=<x>).

    # sudo dfu-util -c 1 -i 0 -a 0 -D MLO

    u-boot=>##########DOWNLOAD ... OK

    Ctrl+C to exit ...

    # sudo dfu-util -c 1 -i 0 -a 1 -D u-boot.img

    u-boot=>##########DOWNLOAD ... OK
    Ctrl+C to exit ...

    # sudo dfu-util -c 1 -i 0 -a 2 -D u-boot.dtb

    u-boot=>#DOWNLOAD ... OK
    Ctrl+C to exit ...

    # sudo dfu-util -c 1 -i 0 -a 5 -D Image

    uboot=>#####################################################################################################################################################################################################################################################################DOWNLOAD ... OK
    Ctrl+C to exit ...

     At this point nothing happens on TeraTerm when I switch on QSPI boot. I checked with the oscilloscope some QSPI flash pins (for examples the chip select) and I verified that they moved down and up  during the download. I suppose that DFU is working.

    Than I tried to flash the QSPI via MMC using the following steps:

    U-Boot # mmc rescan
    U-Boot # fatload mmc 0 ${loadaddr} MLO
    U-Boot # sf probe 4:0
    U-Boot # sf erase 0x00000 0x100000
    U-Boot # sf write ${loadaddr} 0x00000 0x10000
    U-Boot # fatload mmc 0 ${loadaddr} u-boot.img
    U-Boot # sf write ${loadaddr} 0x40000 0x60000

    but when I switched to QSPI boot nothing happens.

    At this point I believe that DFU is working correctly but the QSPI boot has something wrong.

    I will check deeply by enabling debug messages but I would like to know from you any advice or action in order to find out the issue related to the QSPI boot failure.

    I am sorry that I am stressing you regarding this topic but I think that the solution is  is upon us.

    Regards
    Graziano

  • Hi Rex,

    any suggestion regarding QSPI boot failure?

    Regards

    Graziano

  • Hi, Graziano,

    We have tried to program to QSPI NAND with the following commands:

    => mmc rescan

    => fatload mmc 0 ${loadaddr} MLO

    reading MLO

    497884 bytes read in 28 ms (17 MiB/s)

    => 

    Then erase the erase the content in QSPI flash and burnt the image to the QSPI flast

    => sf probe 4:0
    SF: Detected s25fl512s_256k with page size 512 Bytes, erase size 256 KiB, total 64 MiB
    => sf erase 0 80000     (note: size need to round it up to the next 64KB)
    SF: 524288 bytes @ 0x0 Erased: OK
    => sf write ${loadaddr} 0 798dc
    device 0 offset 0x0, size 0x798dc
    SF: 497884 bytes @ 0x0 Written: OK

    [Power off the K2G, Set the dip switch, power back on]

    Once the programming is completed, we need to change the SW3 dip switch to QSPI boot

    You can see how-to video which includes this process in https://training.ti.com/demonstrating-u-boot-spiqspi-66ak2g

    Rex

  • Hi Rex,

    Thank you for your response. 

    My project does not comply mmc and nand device support, we have designed the custom board with only qspi flash as storage support and USB for first boot.

    However your example has given me the idea to change the way to proceed regarding the QSPI flash via DFU. First of all I verified that QSPI is flashed properly  via DFU in u-boot but unfortunaly the MLO and u-boot.img is not donwloaded (the .dtb yes instead). Therefore I use the DFU to download the binaries in RAM and save them in QSPI. In this way I was able to flash the QSPI.

    Below the steps to do

    in u-boot 

    => env default -a;setenv dfu_alt_info ${dfu_alt_info_ram};dfu 0 ram 0   

    in host PC

    # sudo dfu-util -c 1 -i 0 -a x -D y (where x is the alt partition in RAM address and y is the binary - MLO, u-boot.img, .dtb, kernel, filesystem) 

    in u-boot

    => sf probe 4:0; sf write <RAM address> <QSPI offset> <byte length>

    After these steps the boot hangs at this point

    ## Flattened Device Tree blob at 88000000
    Booting using the fdt blob at 0x88000000
    Loading Device Tree to 8fff5000, end 8ffff3a6 ... OK

    Starting kernel ...

    and no more output on UART console. I will open a new thread for this issue but I consider resolved the thread regarding the QSPI Flash via DFU although I have to use the RAM to download the binaries and not directly flash the QSPI.

    Thank you for your support.

    Regards

    Graziano