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.

AM5718: DFU on custom board

Part Number: AM5718

Hi All,

We are working on AM5718 custom board and trying to boot using DFU.

We are following below link to get started.

1) processors.wiki.ti.com/.../Linux_Core_U-Boot_User's_Guide
point : "Using USB Device Firmware Upgrade (DFU)"

We have prepared all the application on host which is mendatory for DFU.(like usbboot-stand-alone,dfu-util(version 0.9))

We will upload u-boor-spl.bin on board using following command.
$ sudo usbboot-stand-alone -S spl/u-boot-spl.bin

we got following result on HOST

reading ASIC ID
CHIP: 4a45
rom minor version: 01
IDEN: 0000000000000000000000000000000000000000
MPKH: 0000000000000000000000000000000000000000000000000000000000000000
CRC0: d017dd32
CRC1: 00000000
device is GP
sending 2ndstage to target...

on Device side using minicom we get

U-Boot SPL 2017.01 (Sep 21 2018 - 11:56:54)
DRA722-GP ES2.0

U-Boot SPL 2017.01 (Sep 21 2018 - 11:56:54)
DRA722-GP ES2.0
Trying to boot from DFU
Using default environment

But after this when we try to list devics using command "dfu-util -l OR sudo dfu-util -l"
We are getting following result all the time.

dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to sourceforge.net/.../


and after that we try to load u-boot.img on board using following command on HOST.
$ sudo dfu-util c 1 -i 0 -a 0 -D "u-boot.img" -R

Which gives following output on HOST

dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to sourceforge.net/.../

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
dfu-util: No DFU capable USB device available


We have tried it with rebooting the device after loading the u-boot-spl.bin on board as
per above link but no any log for device in "dfu-util -l"

Please suggest any further steps if require or we are missing.

Thanks You,
Simit

  • Simit,

    I got my am572x IDK evm modified to use DFU boot mode, and I can reproduce the same issue you have - SPL is unable to find the FIT image header in downloaded u-boot.img.

    I will debug it and will keep you updated. Currently I don't have an estimate of the effort.
  • Simit,

    I found the problem - the macro CONFIG_SPL_LOAD_FIT_ADDRESS used in common/spl/spl_ram.c is '0' for non-DFU use cases, but it should be 0x80200000 for DFU boot on AM57x. I have created the formal patch for fix the issue and sent it to our kernel dev team for review, I will share the patch to you once it gets approved.

    I also revised the patch you used to switch the USB1 port to device mode to make it more robust. I will share the new patch to you as well.
  • Hi Bin Liu

    We meet the same problem with Simit. Looking forward to your patch!

    Thanks

  • Hi Bin Liu,

    Thanks for the support.

    I am out of station for couple of day's so i will update you on this on Monday.

    Thanks,

    Simit

  • Hi Simit and Ricardo,

    Please apply the following two patches on the uboot code in Processor SDK v4.x, which should fix this DFU boot issue. The first patch configures the USB1 port to device mode so DFU can be used on USB1 port; the second patch fixes the issue that SPL is unable find the location of the downloaded image. Please let me know if you have any problem with the patches.

    0001-usb-enable-usb1-device-mode-for-am57x.patch.txt
    From e001cf4a95bf93115fcfe91e9bb7c448763a4aa1 Mon Sep 17 00:00:00 2001
    From: Bin Liu <b-liu@ti.com>
    Date: Mon, 2 Jul 2018 15:12:51 -0500
    Subject: [PATCH 1/2] usb: enable usb1 device mode for am57x
    
    Also configure usb2 to host mode. The dr_mode in board dts has to be set
    to "host" use usb2 in host mode.
    
    Signed-off-by: Bin Liu <b-liu@ti.com>
    ---
     arch/arm/dts/am57xx-beagle-x15-common.dtsi |  2 +-
     arch/arm/dts/am57xx-idk-common.dtsi        |  2 +-
     board/ti/am57xx/board.c                    | 30 +++++++++++++++++++---
     include/configs/am57xx_evm.h               |  2 +-
     include/linux/usb/xhci-omap.h              |  6 +----
     5 files changed, 31 insertions(+), 11 deletions(-)
    
    diff --git a/arch/arm/dts/am57xx-beagle-x15-common.dtsi b/arch/arm/dts/am57xx-beagle-x15-common.dtsi
    index a6216b5ec94e..8dcabd4ef21d 100644
    --- a/arch/arm/dts/am57xx-beagle-x15-common.dtsi
    +++ b/arch/arm/dts/am57xx-beagle-x15-common.dtsi
    @@ -482,7 +482,7 @@
     };
     
     &usb1 {
    -	dr_mode = "host";
    +	dr_mode = "peripheral";
     };
     
     &omap_dwc3_2 {
    diff --git a/arch/arm/dts/am57xx-idk-common.dtsi b/arch/arm/dts/am57xx-idk-common.dtsi
    index 62954c7ebfad..2d3044a6cb82 100644
    --- a/arch/arm/dts/am57xx-idk-common.dtsi
    +++ b/arch/arm/dts/am57xx-idk-common.dtsi
    @@ -294,7 +294,7 @@
     };
     
     &usb1 {
    -	dr_mode = "host";
    +	dr_mode = "peripheral";
     };
     
     &usb2 {
    diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
    index af6b7f6303a0..d1dacf4f1ce2 100644
    --- a/board/ti/am57xx/board.c
    +++ b/board/ti/am57xx/board.c
    @@ -701,6 +701,26 @@ int spl_start_uboot(void)
     #endif
     
     #ifdef CONFIG_USB_DWC3
    +static struct dwc3_device usb_otg_ss1 = {
    +	.maximum_speed = USB_SPEED_SUPER,
    +	.base = DRA7_USB_OTG_SS1_BASE,
    +	.tx_fifo_resize = false,
    +	.index = 0,
    +};
    +
    +static struct dwc3_omap_device usb_otg_ss1_glue = {
    +	.base = (void *)DRA7_USB_OTG_SS1_GLUE_BASE,
    +	.utmi_mode = DWC3_OMAP_UTMI_MODE_SW,
    +	.index = 0,
    +};
    +
    +static struct ti_usb_phy_device usb_phy1_device = {
    +	.pll_ctrl_base = (void *)DRA7_USB3_PHY1_PLL_CTRL,
    +	.usb2_phy_power = (void *)DRA7_USB2_PHY1_POWER,
    +	.usb3_phy_power = (void *)DRA7_USB3_PHY1_POWER,
    +	.index = 0,
    +};
    +
     static struct dwc3_device usb_otg_ss2 = {
     	.maximum_speed = USB_SPEED_HIGH,
     	.base = DRA7_USB_OTG_SS2_BASE,
    @@ -738,9 +758,13 @@ int board_usb_init(int index, enum usb_init_type init)
     	switch (index) {
     	case 0:
     		if (init == USB_INIT_DEVICE) {
    -			printf("port %d can't be used as device\n", index);
    -			disable_usb_clocks(index);
    -			return -EINVAL;
    +#ifdef CONFIG_USB_DWC3
    +			usb_otg_ss1.dr_mode = USB_DR_MODE_PERIPHERAL;
    +			usb_otg_ss1_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID;
    +			ti_usb_phy_uboot_init(&usb_phy1_device);
    +			dwc3_omap_uboot_init(&usb_otg_ss1_glue);
    +			dwc3_uboot_init(&usb_otg_ss1);
    +#endif
     		}
     		break;
     	case 1:
    diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
    index fa443df51d17..8a77984a9f24 100644
    --- a/include/configs/am57xx_evm.h
    +++ b/include/configs/am57xx_evm.h
    @@ -93,7 +93,7 @@
     #define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2
     
     #define CONFIG_OMAP_USB_PHY
    -#define CONFIG_OMAP_USB3PHY1_HOST
    +#define CONFIG_OMAP_USB2PHY2_HOST
     
     /* SATA */
     #define CONFIG_BOARD_LATE_INIT
    diff --git a/include/linux/usb/xhci-omap.h b/include/linux/usb/xhci-omap.h
    index 9de80d738ecd..0a0a19df47a8 100644
    --- a/include/linux/usb/xhci-omap.h
    +++ b/include/linux/usb/xhci-omap.h
    @@ -10,14 +10,10 @@
     #ifndef _ASM_ARCH_XHCI_OMAP_H_
     #define _ASM_ARCH_XHCI_OMAP_H_
     
    -#ifdef CONFIG_TARGET_DRA7XX_EVM
    +#if defined(CONFIG_TARGET_DRA7XX_EVM) || defined(CONFIG_TARGET_AM57XX_EVM)
     #define OMAP_XHCI_BASE 0x488d0000
     #define OMAP_OCP1_SCP_BASE 0x4A081000
     #define OMAP_OTG_WRAPPER_BASE 0x488c0000
    -#elif defined CONFIG_TARGET_AM57XX_EVM
    -#define OMAP_XHCI_BASE 0x48890000
    -#define OMAP_OCP1_SCP_BASE 0x4A084c00
    -#define OMAP_OTG_WRAPPER_BASE 0x48880000
     #elif defined CONFIG_AM43XX
     #define OMAP_XHCI_BASE 0x483d0000
     #define OMAP_OCP1_SCP_BASE 0x483E8000
    -- 
    2.17.1
    
    

    0002-configs-am57xx_evm-define-CONFIG_SPL_LOAD_FIT_ADDRES.patch.txt
    From b7b7155a4fcebadcff05d05ba51a64a01bbd6248 Mon Sep 17 00:00:00 2001
    From: Bin Liu <b-liu@ti.com>
    Date: Thu, 15 Nov 2018 09:11:44 -0600
    Subject: [PATCH 2/2] configs: am57xx_evm: define CONFIG_SPL_LOAD_FIT_ADDRESS
     for SPL-DFU
    
    Define CONFIG_SPL_LOAD_FIT_ADDRESS to enable SPL-DFU for am57x platform.
    
    Signed-off-by: Bin Liu <b-liu@ti.com>
    ---
     include/configs/am57xx_evm.h | 22 ++++++++++++++++++++++
     1 file changed, 22 insertions(+)
    
    diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
    index 8a77984a9f24..b59b0b963b89 100644
    --- a/include/configs/am57xx_evm.h
    +++ b/include/configs/am57xx_evm.h
    @@ -59,11 +59,33 @@
     	"name=ipu2,size=1M,uuid=${uuid_gpt_ipu2};" \
     	"name=userdata,size=-,uuid=${uuid_gpt_userdata}"
     
    +#ifndef CONFIG_SPL_BUILD
     #define DFUARGS \
     	"dfu_bufsiz=0x10000\0" \
     	DFU_ALT_INFO_MMC \
     	DFU_ALT_INFO_EMMC \
     	DFU_ALT_INFO_RAM \
    +	DFU_ALT_INFO_QSPI
    +#else
    +/* Discard fastboot in SPL build, to spare some space */
    +#undef CONFIG_FASTBOOT
    +#undef CONFIG_USB_FUNCTION_FASTBOOT
    +#undef CONFIG_CMD_FASTBOOT
    +#undef CONFIG_ANDROID_BOOT_IMAGE
    +#undef CONFIG_FASTBOOT_BUF_ADDR
    +#undef CONFIG_FASTBOOT_BUF_SIZE
    +#undef CONFIG_FASTBOOT_FLASH
    +#endif
    +
    +#ifdef CONFIG_SPL_BUILD
    +#undef CONFIG_CMD_BOOTD
    +#ifdef CONFIG_SPL_DFU_SUPPORT
    +#define CONFIG_SPL_LOAD_FIT_ADDRESS 0x80200000
    +#define DFUARGS \
    +	"dfu_bufsiz=0x10000\0" \
    +	DFU_ALT_INFO_RAM
    +#endif
    +#endif
     
     #include <configs/ti_omap5_common.h>
     
    -- 
    2.17.1
    
    

  • Hi Bin Liu

    Thanks for your reply!

    I applied the upper patches on my uboot. But it seems that the u-boot.img still can't start.I got the following message after downloading the u-boot-spl.bin and u-boot.img:

    U-Boot SPL 2017.01-00001-g3ea47ee-dirty (Nov 19 2018 - 18:52:53)
    DRA752-GP ES2.0
    Trying to boot from DFU
    Using default environment
    
    #########DOWNLOAD ... OK
    Ctrl+C to exit ...

    The following attachment is the diff file of this modification.We are using a custom board and Processor SDK is 4.01.00.06.

    usb-dfu.diff.txt
    diff --git a/arch/arm/dts/am57xx-beagle-x15-common.dtsi b/arch/arm/dts/am57xx-beagle-x15-common.dtsi
    index a6216b5..8dcabd4 100644
    --- a/arch/arm/dts/am57xx-beagle-x15-common.dtsi
    +++ b/arch/arm/dts/am57xx-beagle-x15-common.dtsi
    @@ -482,7 +482,7 @@
     };
     
     &usb1 {
    -	dr_mode = "host";
    +	dr_mode = "peripheral";
     };
     
     &omap_dwc3_2 {
    diff --git a/arch/arm/dts/am57xx-idk-common.dtsi b/arch/arm/dts/am57xx-idk-common.dtsi
    index 81c9f55..a7c6465 100644
    --- a/arch/arm/dts/am57xx-idk-common.dtsi
    +++ b/arch/arm/dts/am57xx-idk-common.dtsi
    @@ -300,7 +300,7 @@
     };
     
     &usb1 {
    -	dr_mode = "host";
    +	dr_mode = "peripheral";
     };
     
     &usb2 {
    diff --git a/board/embest/som_am572x/board.c b/board/embest/som_am572x/board.c
    index 5eddb7e..2381f26 100644
    --- a/board/embest/som_am572x/board.c
    +++ b/board/embest/som_am572x/board.c
    @@ -705,6 +705,26 @@ int spl_start_uboot(void)
     #endif
     
     #ifdef CONFIG_USB_DWC3
    +static struct dwc3_device usb_otg_ss1 = {
    +	.maximum_speed = USB_SPEED_SUPER,
    +	.base = DRA7_USB_OTG_SS1_BASE,
    +	.tx_fifo_resize = false,
    +	.index = 0,
    +};
    +
    +static struct dwc3_omap_device usb_otg_ss1_glue = {
    +	.base = (void *)DRA7_USB_OTG_SS1_GLUE_BASE,
    +	.utmi_mode = DWC3_OMAP_UTMI_MODE_SW,
    +	.index = 0,
    +};
    +
    +static struct ti_usb_phy_device usb_phy1_device = {
    +	.pll_ctrl_base = (void *)DRA7_USB3_PHY1_PLL_CTRL,
    +	.usb2_phy_power = (void *)DRA7_USB2_PHY1_POWER,
    +	.usb3_phy_power = (void *)DRA7_USB3_PHY1_POWER,
    +	.index = 0,
    +};
    +
     static struct dwc3_device usb_otg_ss2 = {
     	.maximum_speed = USB_SPEED_HIGH,
     	.base = DRA7_USB_OTG_SS2_BASE,
    @@ -742,9 +762,13 @@ int board_usb_init(int index, enum usb_init_type init)
     	switch (index) {
     	case 0:
     		if (init == USB_INIT_DEVICE) {
    -			printf("port %d can't be used as device\n", index);
    -			disable_usb_clocks(index);
    -			return -EINVAL;
    +#ifdef CONFIG_USB_DWC3
    +			usb_otg_ss1.dr_mode = USB_DR_MODE_PERIPHERAL;
    +			usb_otg_ss1_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID;
    +			ti_usb_phy_uboot_init(&usb_phy1_device);
    +			dwc3_omap_uboot_init(&usb_otg_ss1_glue);
    +			dwc3_uboot_init(&usb_otg_ss1);
    +#endif
     		}
     		break;
     	case 1:
    diff --git a/include/configs/som_am572x.h b/include/configs/som_am572x.h
    index 08acbad..1603c5b 100644
    --- a/include/configs/som_am572x.h
    +++ b/include/configs/som_am572x.h
    @@ -60,11 +60,33 @@
     	"name=ipu2,size=1M,uuid=${uuid_gpt_ipu2};" \
     	"name=userdata,size=-,uuid=${uuid_gpt_userdata}"
     
    +#ifndef CONFIG_SPL_BUILD
     #define DFUARGS \
     	"dfu_bufsiz=0x10000\0" \
     	DFU_ALT_INFO_MMC \
     	DFU_ALT_INFO_EMMC \
     	DFU_ALT_INFO_RAM \
    +	DFU_ALT_INFO_QSPI
    +#else
    +/* Discard fastboot in SPL build, to spare some space */
    +#undef CONFIG_FASTBOOT
    +#undef CONFIG_USB_FUNCTION_FASTBOOT
    +#undef CONFIG_CMD_FASTBOOT
    +#undef CONFIG_ANDROID_BOOT_IMAGE
    +#undef CONFIG_FASTBOOT_BUF_ADDR
    +#undef CONFIG_FASTBOOT_BUF_SIZE
    +#undef CONFIG_FASTBOOT_FLASH
    +#endif
    +
    +#ifdef CONFIG_SPL_BUILD
    +#undef CONFIG_CMD_BOOTD
    +#ifdef CONFIG_SPL_DFU_SUPPORT
    +#define CONFIG_SPL_LOAD_FIT_ADDRESS 0x80200000
    +#define DFUARGS \
    +	"dfu_bufsiz=0x10000\0" \
    +	DFU_ALT_INFO_RAM
    +#endif
    +#endif
     
     #include <configs/ti_omap5_common.h>
     
    @@ -94,7 +116,7 @@
     #define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2
     
     #define CONFIG_OMAP_USB_PHY
    -#define CONFIG_OMAP_USB3PHY1_HOST
    +#define CONFIG_OMAP_USB2PHY2_HOST
     
     /* SPL SATA */
     #define CONFIG_SPL_SATA_SUPPORT
    diff --git a/include/linux/usb/xhci-omap.h b/include/linux/usb/xhci-omap.h
    index 9de80d7..b169402 100644
    --- a/include/linux/usb/xhci-omap.h
    +++ b/include/linux/usb/xhci-omap.h
    @@ -10,14 +10,15 @@
     #ifndef _ASM_ARCH_XHCI_OMAP_H_
     #define _ASM_ARCH_XHCI_OMAP_H_
     
    -#ifdef CONFIG_TARGET_DRA7XX_EVM
    +//#ifdef CONFIG_TARGET_DRA7XX_EVM
    +#if defined(CONFIG_TARGET_DRA7XX_EVM) || defined(CONFIG_TARGET_SOM_AM572X)
     #define OMAP_XHCI_BASE 0x488d0000
     #define OMAP_OCP1_SCP_BASE 0x4A081000
     #define OMAP_OTG_WRAPPER_BASE 0x488c0000
    -#elif defined CONFIG_TARGET_AM57XX_EVM
    -#define OMAP_XHCI_BASE 0x48890000
    -#define OMAP_OCP1_SCP_BASE 0x4A084c00
    -#define OMAP_OTG_WRAPPER_BASE 0x48880000
    +//#elif defined CONFIG_TARGET_AM57XX_EVM
    +//#define OMAP_XHCI_BASE 0x48890000
    +//#define OMAP_OCP1_SCP_BASE 0x4A084c00
    +//#define OMAP_OTG_WRAPPER_BASE 0x48880000
     #elif defined CONFIG_AM43XX
     #define OMAP_XHCI_BASE 0x483d0000
     #define OMAP_OCP1_SCP_BASE 0x483E8000
    

  • Hi Bin,

    Thanks for support. 

    Now i am able to successfully upload u-boot.img and got the u-boot on device side.

    But now when i will trying to load MLO to eMMC as per following link

    processors.wiki.ti.com/index.php/Linux_Core_U-Boot_User%27s_Guide#Using_USB_Device_Firmware_Upgrade_.28DFU.29

    Topic : Partitioning eMMC from U-Boot


    i am getting following error :

    => printenv partitions
    partitions=uuid_disk=${uuid_gpt_disk};name=bootloader,start=384K,size=1792K,uuid=${uuid_gpt_bootloader};name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}
    => setenv uuid_gpt_disk b63f056a-731b-49b1-bdcf-aab840416bc4
    => setenv uuid_gpt_rootfs 96870b74-a7f7-4929-8b0a-3d9cc6f86aad
    => gpt write mmc 1 ${partitions}
    Writing GPT: CACHE: Misaligned operation at range [bdf3ef30, bdf3f130]
    CACHE: Misaligned operation at range [bdf3f138, bdf43138]
    CACHE: Misaligned operation at range [bdf3f138, bdf43138]
    CACHE: Misaligned operation at range [bdf3ef30, bdf3f130]
    success!

    is it a problem? 

    Because after this when i tried to upload another file like MLO from host it will stuck in following command ;

    $ U-Boot # setenv dfu_alt_info ${dfu_alt_info_mmc}

    $ U-boot # dfu 1 mmc 0

    On Host side i am not getting any device after this.

    After this i am not getting any print.

    I have also tried this using SD card but the same result i got.

    Is there still anything missing?

    Thanks,

    Simit

  • Hi Ricardo,

    Ricardo Jie said:
    I applied the upper patches on my uboot. But it seems that the u-boot.img still can't start.

    Can you please click the orange "+ Ask a related question" button on the top of this page to create a new e2e thread for your issue? We don't want to diverge this thread in case your issue has different root cause. Thanks.

  • Hi Simit,

    Simit Ghane said:
    Now i am able to successfully upload u-boot.img and got the u-boot on device side.

    Glad we made progress.

    Simit Ghane said:

    is it a problem? 

    Because after this when i tried to upload another file like MLO from host it will stuck in following command ;
    ... ...
    Is there still anything missing?

    What I tested on DFU was as that in the training video I referred in the beginning of this thread, to ensure we have proper hw and sw configurations to use DFU, but I didn't do anything beyond flashing a file (zImage) to the SD card. So I cannot comment on what your new issue is at the moment. Please let me do some research to see if I can find some clue.

  • Hi Simit,

    Simit Ghane said:
    $ U-boot # dfu 1 mmc 0

    I just realized this command has to be modified for your use case. The parameter '1' means the second USB port (index base is 0), which is the USB device port on the AM57x GP EVM. But your board uses the first USB port as the device port, so you should use '0' as the parameter instead. Please try command 'dfu 0 mmc 0', and let me know if it works.

  • Hi Bin,

    Yes off caurse we did it and it works fine.

    But now the issue is when we tried to make partition of eMMC using following command it is not working at all.

    => printenv partitions
    partitions=uuid_disk=${uuid_gpt_disk};name=bootloader,start=384K,size=1792K,uuid=${uuid_gpt_bootloader};name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}
    => setenv uuid_gpt_disk b63f056a-731b-49b1-bdcf-aab840416bc4
    => setenv uuid_gpt_rootfs 96870b74-a7f7-4929-8b0a-3d9cc6f86aad
    => gpt write mmc 1 ${partitions}
    Writing GPT: CACHE: Misaligned operation at range [bdf3ef30, bdf3f130]
    CACHE: Misaligned operation at range [bdf3f138, bdf43138]
    CACHE: Misaligned operation at range [bdf3f138, bdf43138]
    CACHE: Misaligned operation at range [bdf3ef30, bdf3f130]
    success!

    => mmc part

    Partition Map for MMC device 1 -- Partition Type: EFI
    Part       Start LBA          End LBA          Name
                  Attributes
                  Type GUID
                  Partition GUID
    1            0x00000300 0x000010ff      "bootloader"
                  attrs: 0x0000000000000000
                  type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
                  guid: 21200400-0804-0146-9dcc-a8c51255994f
    2           0x00001500 0x01d59fde      "rootfs"
                 attrs: 0x0000000000000000
                 type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
                guid: 408d9af6-9d4d-2b4d-9f1a-555f8c19a613

    => ls mmc 1:1
    Failed to mount ext2 filesystem...
    ** Unrecognized filesystem type **
    => ls mmc 1:2
    <DIR> 1024 .
    <DIR> 1024 ..
    <DIR> 12288 lost+found
    <DIR> 1024 sys
    <DIR> 1024 media
    <DIR> 2048 sbin
    <DIR> 1024 dev
    <DIR> 2048 etc
    <DIR> 1024 tmp
    <DIR> 1024 usr
    <DIR> 3072 lib
    <DIR> 1024 home
    <DIR> 1024 var
    <DIR> 1024 boot
    <DIR> 1024 run
    <DIR> 3072 bin
    <DIR> 1024 proc
    <DIR> 1024 include
    <DIR> 1024 mnt

    On Host 

    $ sudo ./usbboot-stand-alone -S spl/u-boot-spl.bin

    $ sudo dfu-util c 1 -i 0 -a 0 -D "u-boot.img" -R

    $ sudo dfu-util c 1 -i 0 -a 1 -D "../TEMP/rootfs.ext4" -R

    we are able to load rootfs in second partition but don't know the exact reason why it is not creating first partition in eMMC.

    While we try to trasfer MLO using following command on HOST

    $ sudo dfu-util c 1 -i 0 -a 2 -D "../TEMP/MLO" -R

    We are getting following error on device

    => setenv dfu_alt_info ${dfu_alt_info_mmc}
    => dfu 0 mmc 1:1
    #CACHE: Misaligned operation at range [bdf39ed0, bdf39f10]
    CACHE: Misaligned operation at range [bdf39ed0, bdf39f10]
    #MMC: no card present
    ** Bad device mmc 0 **
    dfu: Read error!
    ERROR: Deferred dfu_flush() failed!
    at common/dfu.c:78/run_usb_dnl_gadget()

    So will you please look into this and suggest me if i am wrong.


    Thanks,
    Simit

  • Hi Bin,

    This is just gentle reminder.

    Thanks,

    Simit

  • This isn't resolved my issue.
  • Hi Bin,

    If we are following the video and try to load zimage but while checking on host side using,

    $ dfu-util -l

    we are not at all get any entry for zImage from device that you shown in video.

    will you please guide me in this.

    Thanks,

    Simit

  • Simit,

    Sorry for the delay response. Last week was holidays in US.

    Simit Ghane said:
    $ sudo dfu-util c 1 -i 0 -a 1 -D "../TEMP/rootfs.ext4" -R

    You shouldn't have '-R' here. '-R' means USB reset after finish the command. '-R' is used only when downloading u-boot.img.

    Simit Ghane said:

    $ sudo dfu-util c 1 -i 0 -a 2 -D "../TEMP/MLO" -R

    We are getting following error on device

    Also don't use '-R' here either.

    Can you use this command to download MLO right after 'sudo dfu-util -c1 -i0 -a0 -D u-boot.img -R'?

  • Simit Ghane said:

    $ dfu-util -l

    we are not at all get any entry for zImage from device that you shown in video.

    'dfu-util -l' command is used to list the dfu devices, not for checking for sd card contents.

  • Hi Bin,

    Thanks for the reply.

    Yes Offcaurse will try this command without -R for sure.

    Now we just want the proper steps for the eMMC partition and load the MLO,u-boot.img and rootfs in eMMC using DFU.

    Because, in our final product there isn't any SD card available on board, so will you please give me proper steps for the same.

    Thanks,

    Simit

  • Hi Simit,

    Simit Ghane said:
    => printenv partitions
    partitions=uuid_disk=${uuid_gpt_disk};name=bootloader,start=384K,size=1792K,uuid=${uuid_gpt_bootloader};name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}
    => setenv uuid_gpt_disk b63f056a-731b-49b1-bdcf-aab840416bc4
    => setenv uuid_gpt_rootfs 96870b74-a7f7-4929-8b0a-3d9cc6f86aad
    => gpt write mmc 1 ${partitions}
    Writing GPT: CACHE: Misaligned operation at range [bdf3ef30, bdf3f130]
    CACHE: Misaligned operation at range [bdf3f138, bdf43138]
    CACHE: Misaligned operation at range [bdf3f138, bdf43138]
    CACHE: Misaligned operation at range [bdf3ef30, bdf3f130]
    success!

    I tried these commands, but don't get the messages in bold above. I only got the following one line for command '=> gpt write mmc 1 ${partitions}':

    Writing GPT: success!

    You set rootfs uuid to

    => setenv uuid_gpt_rootfs 96870b74-a7f7-4929-8b0a-3d9cc6f86aad

    but it doesn't match to the 'mmc part' output:

    Simit Ghane said:

    => mmc part

    Partition Map for MMC device 1 -- Partition Type: EFI
    ... ...
    2           0x00001500 0x01d59fde      "rootfs"
                 attrs: 0x0000000000000000
                 type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
                guid: 408d9af6-9d4d-2b4d-9f1a-555f8c19a613

    So I suspect you have emmc hw design issues. Please create a new e2e thread for it.

  • Hi Bin;

    We make partition on eMMC using Firmware(OS) booting from SD card using below command and we found that eMMC has correct partition as per below log.

    $ am57xx-evm login: root
    $ echo 0 > /sys/block/mmcblk1boot0/force_ro
    $ echo 0 > /sys/block/mmcblk1boot1/force_ro
    $ dd if=/dev/zero of=/dev/mmcblk1boot0 bs=512
    $ dd if=/dev/zero of=/dev/mmcblk1boot1 bs=512
    $ umount /dev/mmcblk1p1
    $ umount /dev/mmcblk1p2
    $ fdisk /dev/mmcblk1
    Type:
    1. p - print the partition table
    2. o - create a new empty DOS partition table
    3. p - print the partition table
    4. n - add a new partition
    5. p - primary
    6. 1 - default
    7. 2048 - default
    8. 145407 - sectors
    9. t - change a partition type
    10. c - W95 FAT32 (LBA)
    11. p - print the partition table
    12. a - toggle a bootable flag
    13. p - print the partition table
    14. n - add a new partition
    15. Press 4 times Enter and take the default values
    16. p - print the partition table
    17. w - write table to disk and exit
    $ umount /dev/mmcblk1p1
    $ umount /dev/mmcblk1p2
    $ mkfs.vfat /dev/mmcblk1p1
    $ mkfs.ext4 /dev/mmcblk1p2
    Press 'y' if it ask you to proceed anyway.
    $ mkdir boot
    $ mount -t vfat /dev/mmcblk1p1 boot/
    $ cp MLO-am57xx-evm boot/MLO
    $ cp u-boot-am57xx-evm.img boot/u-boot.img
    $ mkdir rootfs
    $ mount -t ext4 /dev/mmcblk1p2 rootfs/
    $ tar xvf tisdk-rootfs-image-am57xx-evm.tar.xz -C rootfs/
    $ sync
    $ sync

    root@am57xx-evm:/boot# fdisk -l /dev/mmcblk1
    Disk /dev/mmcblk1: 14.7 GiB, 15758000128 bytes, 30777344 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x600033cf

    Device Boot Start End Sectors Size Id Type
    /dev/mmcblk1p1 * 2048 145407 143360 70M c W95 FAT32 (LBA)
    /dev/mmcblk1p2 145408 30777343 30631936 14.6G 83 Linux

    while tested on u-boot using "mmc partcommand we got following result

    => mmc part

    Partition Map for MMC device 1 -- Partition Type: DOS

    Part    Start Sector       Num Sectors     UUID      Type
    1         2048                    143360       24e8b548-01 0c Boot
    2         145408                30631936   24e8b548-02 83

    Then after we verify with removing sdcard and booting from eMMC and it working perfect. so there is no any hardware issue.
    Now we are facing the issue of first time partitioning of eMMC because after doing GPT partition EMMC does not properly partitioned because as per our research we found that the first partition should be FAT and second partition should be ext4 for proper booting image from eMMC.

    so Please provide total steps which you follow to bootup the eMMC without sdcard  using u-boot.


    Thanks,

    SImit

  • Simit,

    I validated the process that I am able to use dfu to download a text file and write it to the first vfat partition on emmc. I found a few pointers which could lead to failure in the process.

    1. first of all, it seems those 'CACHE: Misaligned operation at range' messages are harmless. I sometimes got those, but the text file written to emmc is not corrupted;

    2.

    Simit Ghane said:

    We are getting following error on device

    => setenv dfu_alt_info ${dfu_alt_info_mmc}
    => dfu 0 mmc 1:1
    #CACHE: Misaligned operation at range [bdf39ed0, bdf39f10]
    CACHE: Misaligned operation at range [bdf39ed0, bdf39f10]
    #MMC: no card present
    ** Bad device mmc 0 **
    dfu: Read error!
    ERROR: Deferred dfu_flush() failed!
    at common/dfu.c:78/run_usb_dnl_gadget()

    This error is because the default ${dfu_alt_info_mmc} is for mmc 0 device, which is the sdcard on my board. I have to modify it to point to emmc which is mmc 1 device on my board. In its syntax '<name> fat 0 <partition>' '0' means mmc 0 device, so I changed it to '1'. To simply the test, I did

    => setenv dfu_alt_info 'u-boot.img fat 1 1;uEnv.txt fat 1 1'
    => dfu 0 mmc 1
    

    Then on the host, to download a text file to emmc first vfat partition, I did

    $ sudo dfu-util -c1 -i0 -a uEnv.txt -D ~/am57x/uEnv.txt
    

    3. We have to format the emmc partitions if we don't want to download the raw format image to it. Since uboot is not capable to format devices, I formatted them in Linux, after 'gpt write mmc 1 ${partitions}' command in uboot. But in your production, you suppose to use raw image format, so formatting emmc is not an issue.

    => setenv dfu_alt_info 'boot part 1 1;rootfs part 1 2'
    => dfu 0 mmc 1
    
    $ sudo dfu-util -c1 -i0 -a boot -D _your-boot-partition-image_
    $ sudo dfu-util -c1 -i0 -a rootfs -D _yoor-rootfs-image_
    

    Hope information helps.

  • HI Bin,
    As per your third point i understand that we can't format eMMC using u-boot.

    We have ready our production board in which we have only eMMC support. so please provide us the complete steps of how to load the raw files and boot the rootfs.
    also do one more help for how to generate the raw files for all (like.mlo,uboot,rootfs)

    Thanks & Best Regards;
    Simit

  • I have already provided the instructions how to flash the raw partition images using dfu in my previous post.

    To create the partition raw images, you can boot your dev board from SD card, then
    - create the emmc partitions in UBoot;
    - format the emmc partitions in Linux;
    - copy MLO, Uboot, and rootfs into the emmc partitions in Linux;
    - ensure you can boot the dev board from emmc;
    - finally boot the dev board from SD card again, and dump the emmc partitions in raw format. You can use Linux dd command.
  • Hi Bin,

    Now i am able to load image on eMMC successfully using following command.

    $ sudo dfu-util -D YoctoImage.img -c 1 -i 0 -a 0 -R

    where YoctoImage.img is the image prepared using windows tool "windiskimage" from SD card.

    Now i just want to know is there any tool available for Windows from which i can do the same thing.

    Means to load the image using DFU on Device with Windows PC.

    Is there any document available for it that i can follow?

    Thanks & Best Regards,

    Simit

  • Simit,

    Sorry, currently we don't have such equivalent tool for Windows.
  • Hi Bin,

    As per Below thread we got to know that it is possible to use Windows for DFU.

    Link : e2e.ti.com/support/processors/f/791/p/574865/2128963#pi320627=1

    Will you please brief me on this.

    Thanks,

    Simit

  • Simit,

    The tool mentioned in the e2e link you referred above is from a different TI Business Unit, the tool cannot be released to public for AM57x devices.