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.

AM3358: Flashing u-boot to the empty eMMC

Part Number: AM3358
Other Parts Discussed in Thread: UNIFLASH

Hi,

We are making a custom board with AM335x but not ready yet and I´m doing a flashing process to manufacturing using a BeagleBone Black. The custom board will have eMMC without SDCard.
I already have all images prepared with Yocto and a tried flashing using the CCS Uniflash v3.4.1 according to software-dl.ti.com/.../Flash_Tools.html. In this procedure there is a link for Linux flashing, but the link does not exist.

In the BBB, I erased the emmc:
- mmc dev 1 0
- mmc erase 0 1024
Powering the BBB, the console gives "CCCCC".

At Windows, I installed the driver Ethernet/RNDIS Gadget. I configured the IP in the interface and in the Uniflash. I run the Uniflash but nothing happens.

What am I doing wrong?
Is the BBB able to run u-boot in RAM for flashing, correct?
Is there any document describing the flashing process, including u-boot?
What´s the best way to flashing using Windows and Linux?

  • Hi,

    U-Boot on AM335x can do some flashing tasks, but it depends on where to flash to. But flashing eMMC in Linux is recommended than doing it in U-Boot, because it is easier to partition eMMC in Linux.

    However, the most important thing to consider is to know which boot mode to use for flashing. Uniflash supports flashing AM335x through CPSW ethernet or USB gadget mode ethernet. When you see 'CCCCC' on the console, BBB is booting in UART boot mode, it has nothing to do with Ethernet/RNDIS.

    For your information, here is a doc showing flashing eMMC on AM335x using a Linux host.

    https://software-dl.ti.com/processor-sdk-linux/esd/docs/07_03_00_005/linux/How_to_Guides/Host/Program_the_eMMC_on_Beaglebone_Black.html

  • Hi,

    I followed the doc and I loaded the SPL from SDK 07.03.00.005 but the USB not restart:

    CCCCCCCC
    U-Boot SPL 2020.01-g3c9ebdb87d (Jul 20 2021 - 19:10:35 +0000)
    Trying to boot from USB eth

    Warning: eth_cpsw using MAC address from ROM
    eth0: eth_cpsw
    Warning: usb_ether using MAC address from ROM
    , eth1: usb_ether
    using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
    MAC de:ad:be:ef:00:01
    HOST MAC de:ad:be:ef:00:00
    RNDIS ready
    musb-hdrc: peripheral reset irq lost!
    eth_cpsw Waiting for PHY auto negotiation to complete................................................................................................................................................................................................................................................................................................................................................................................................................. TIMEOUT !
    Problem booting with BOOTP
    SPL: failed to boot from all boot devices
    ### ERROR ### Please RESET the board ###

    No USB connection appears on Windows/Linux.

    Any idea?

  • Hi,

    I fixed the USB timeout to 20 and it´s works.

  • Hi,

    Glad the issue is fixed. Thanks for the update.

    Do you mind to provide the details on where the USB timeout is set?

  • Hi,

    I changed the file drivers/usb/gadget/ether.c:95

    From:

              #define USB_CONNECT_TIMEOUT (3 * CONFIG_SYS_HZ)

    To:
              #define USB_CONNECT_TIMEOUT (20 * CONFIG_SYS_HZ)

  • Thanks for sharing the solution. It will be helpful.

  • Hi,

    I followed the doc https://software-dl.ti.com/processor-sdk-linux/esd/docs/07_03_00_005/linux/How_to_Guides/Host/Program_the_eMMC_on_Beaglebone_Black.html 

    but it doesn´t start:

    U-Boot 2020.01-g3102049-dirty (Nov 30 2021 - 06:15:52 -0300)

    CPU : AM335X-GP rev 2.1
    Model: TI AM335x BeagleBone Black
    DRAM: 512 MiB
    WDT: Started with servicing (60s timeout)
    NAND: 0 MiB
    MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
    Loading Environment from FAT... <ethaddr> not set. Validating first E-fuse MAC
    Net:
    Warning: usb_ether MAC addresses don't match:
    Address in ROM is de:ad:be:ef:00:01
    Address in environment is 34:14:b5:66:37:47
    eth0: usb_ether
    Hit any key to stop autoboot: 0
    => setenv autoload no
    => dhcp
    using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
    MAC de:ad:be:ef:00:01
    HOST MAC de:ad:be:ef:00:00
    RNDIS ready
    Change timeout...
    musb-hdrc: peripheral reset irq lost!
    high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
    USB RNDIS network up!
    BOOTP broadcast 1
    BOOTP broadcast 2
    BOOTP broadcast 3
    BOOTP broadcast 4
    BOOTP broadcast 5
    BOOTP broadcast 6
    *** Unhandled DHCP Option in OFFER/ACK: 7
    *** Unhandled DHCP Option in OFFER/ACK: 7
    DHCP client bound to address 192.168.100.11 (6831 ms)
    => tftp 0x81000000 zImage

    Warning: usb_ether MAC addresses don't match:
    Address in ROM is de:ad:be:ef:00:01
    Address in environment is 34:14:b5:66:37:47
    using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
    MAC de:ad:be:ef:00:01
    HOST MAC de:ad:be:ef:00:00
    RNDIS ready
    Change timeout...
    musb-hdrc: peripheral reset irq lost!
    high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
    USB RNDIS network up!
    Using usb_ether device
    TFTP from server 192.168.100.1; our IP address is 192.168.100.11
    Filename 'zImage'.
    Load address: 0x81000000
    Loading: #################################################################
    #################################################################
    #################################################################
    #################################################################
    #################################################################
    #################################################################
    #################################################################
    #########################
    1014.6 KiB/s
    done
    Bytes transferred = 7041536 (6b7200 hex)
    => tftp 0x82000000 am335x-boneblack.dtb

    Warning: usb_ether MAC addresses don't match:
    Address in ROM is de:ad:be:ef:00:01
    Address in environment is 34:14:b5:66:37:47
    using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
    MAC de:ad:be:ef:00:01
    HOST MAC de:ad:be:ef:00:00
    RNDIS ready
    Change timeout...
    musb-hdrc: peripheral reset irq lost!
    high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
    USB RNDIS network up!
    Using usb_ether device
    TFTP from server 192.168.100.1; our IP address is 192.168.100.11
    Filename 'am335x-boneblack.dtb'.
    Load address: 0x82000000
    Loading: #####
    11.7 KiB/s
    done
    Bytes transferred = 61337 (ef99 hex)
    => bootz 0x81000000 0x82000000
    ## Loading ramdisk from FIT Image at 82000000 ...
    Bad FIT ramdisk image format!
    Ramdisk image is corrupt or invalid

  • Hi,

    => bootz 0x81000000 0x82000000

    I believe this command should be

    bootz <addr1> - <addr2>

    There is an '-' between the addresses of zImage and dtb.

  • Hi again,

    I think the doc https://software-dl.ti.com/processor-sdk-linux/esd/docs/07_03_00_005/linux/How_to_Guides/Host/Program_the_eMMC_on_Beaglebone_Black.html is incomplete.

    I had to generate a initramfs to boot:

    cd /opt/ti-processor-sdk-linux-am335x-evm-07.03.00.005/filesystem/arago-tiny-image-am335x-evm
    find . | cpio -H newc -o > ../initramfs.cpio
    cd ..
    cat initramfs.cpio | gzip > initramfs.gz
    sudo apt install u-boot-tools
    mkimage -A arm -O Linux -T ramdisk -C none -a 0x80800000 -n "RootFilesystem" -d initramfs.gz initramfs
    cp initramfs /media/sf_Share/

    At u-boot:

    dhcp;setenv bootargs 'console=ttyO0,115200n8 root=/dev/ram0 rw ip=dhcp';tftpboot 0x82000000 zImage;tftpboot 0x88080000 initramfs;tftpboot 0x88000000 am335x-boneblack.dtb;bootz 0x82000000 0x88080000 0x88000000

    One more problem: After kernel boot, I can´t start a g_ether. I configured the USB support according the doc, but I noticed in the menuconfig in a "Ethernet Gadget" option, there is only the "M" option (module), not "*" (built-in).

    Are there a way to start Ethernet Gadget in kernel RamDisk?

    I tried run g_ether.ko, but there is no support for load module in this zImage.

  • Hi,

    To be able to build g_ether gadget driver to kernel image, more kernel module should be changed to '*' first in kernel config. Please refer to the document attached below for details.

    MUSB Linux Driver Configuration - Texas Instruments Wiki.pdf

    This document mentions CPPI41DMA should be disabled for build-in USB gadget drivers, I think the information is out of date and no longer applicable to kernel v5.4 (I am not 100% positive though, I thought I used this a couple years ago and I don't remember I have to disable CPPI41DMA), but please give it a try.

  • Hi,

    I changed manually in the .config and it worked. After I altered the VID/PID because it´s was opening another network interface. I had to add mkfs.ext4 and mkfs.vfat in initramfs too.

    Now I have the linux console and USB Ethernet OK.

    I tried flashing MLO, u-boot.img and rootfs.tar.gz but after RESET it´s not booting.

    dd if=/dev/zero of=/dev/mmcblk1 bs=4k count=1
    fdisk /dev/mmcblk1
    ...
    sync
    sync
    ...
    Disk /dev/mmcblk1: 3648 MB, 3825205248 bytes, 7471104 sectors
    116736 cylinders, 4 heads, 16 sectors/track
    Units: sectors of 1 * 512 = 512 bytes

    Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
    /dev/mmcblk1p1 0,1,1 320,0,16 16 20495 20480 10.0M 83 Linux
    /dev/mmcblk1p2 320,1,1 1023,3,16 20496 7471103 7450608 3637M 83 Linux

    mkfs.vfat /dev/mmcblk1p1
    mkfs.ext4 /dev/mmcblk1p2

    I copied MLO and u-boot.img in p1 and extract rootfs.tar.gz in p2. After RESET it´s not booting.

    After a tried:

    dd if=/dev/zero of=/dev/mmcblk1 bs=4k count=1
    if=MLO of=/dev/mmcblk1 count=2 seek=1 conv=notrunc bs=128k
    if=u-boot.img of=/dev/mmcblk1 count=4 seek=1 conv=notrunc bs=384k

    I created the p1 in first_sector = 8192. RESET and it´s not booting.

    What´s wrong?

  • Did you set the bootable flag to the first partition?

    This step is done as following in the flasher.sh script in the Flashing BBB document I linked above. You can set it in fdisk command too.

    parted -s $DRIVE set 1 boot on