Flashing eMMC on Hummingboard Edge using fastboot? part 1
Introduction
Flashing an eMMC of produced board is one of the crucial manufacturing
procedures. This post series presents how one can take advantage of i.MX6
features and open source tools to prepare themselves with quite robust and easy
to use process.
The general concept is inspired by
this great bootlin (former FreeElectrons) post:
I’ve run into some issues while trying to do something similar on Hummingbard
Edge, so decided to share my experience.
The general flow looks like:
Load U-Boot to DDR using Serial Download Protocol
U-Boot enters fastboot mode
Pull in the image via fastboot protocol
In the first post, we will focus on loading U-Boot to DDR using SDP.
Hardware preparation
Before we start, we need to prepare hardware first. HB Edge has USBOTG signals
connected to the upper back USB-A connector:
To utilize it we should prepare cable as suggested by the
SolidRun wiki
They suggest cutting two USB cables in half to create USB-A male-male cable. To
make things easier we can buy one of those directly. An example of such is
this one
We still need one more rework:
Remove the main insulation from the middle of the cable,
Cut the power wire (usually the read one),
Solder it back with additional series resistance. SolidRun suggest to use 1-10
Ohms. I am using 2x10 Ohm resistors in parallel which gives me around 5 Ohms.
Resistors soldered on prototype board:
Additional series resistance in power wire path:
Connect USB A host to host cable to USB OTG port (upper port of U5 USB connector
on HB Edge board).
Now we should check whether the cable was prepared correctly. If it is, the USB
device should be detected as Freescale SoC in Recovery Mode:
1
Bus 002 Device 002: ID 15a2:0061 Freescale Semiconductor, Inc. i.MX 6Solo/6DualLite SystemOnChip in RecoveryMode
It may be convenient to set up an udev rule right away, so we can have access
to device as a user later:
This is an open-source alternative to NXP mfgtool, which allows sending
binaries over UART or USB.
Getting imx_usb_loader:
1
2
3
4
sudo apt-get install libusb-dev libusb-1.0
git clone git@github.com:boundarydevices/imx_usb_loader.git
cd imx_usb_loader
make
Output are 2 files: imx_uart and imx_usb that allow to send files to
platform using UART or USB respectively.
imx_usb_loader is able to download a single file u-boot.imx. In case of
boards with SPL support, we have 2 binaries: SPL and u-boot.img. Loading
of both of them is possible using imx_usb_loader, but it is required to take
advantage of the
U-Boot Serial Download Protocol support
U-Boot SDP support was introduced in October 2017. So we need at least v2017.11
release. I’m using the most recent v2018.01.
Following additional configuration options have to be selected to enable SDP
support in U-Boot:
We are getting following error message from the tool:
1
2
3
4
vid/pid cannot be 0: mx6_usb_sdp_spl.conf
[0x0000:0x0fff, mx6_usb_sdp_spl.conf
]
no matching USB device found
The
U-Boot SDP documentation
states that those values should be set by configuration options:
CONFIG_G_DNL_(VENDOR|PRODUCT)_NUM and it should default to:
1
0x1b67:0x4fff, mx6_usb_sdp_spl.conf
Grepping U-Boot sources shows only a few of those options in some of the board
config files:
Quick search through configuration options shows that gadget USB VID / PID is
set through following options:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
config USB_GADGET_VENDOR_NUM
hex "Vendor ID of the USB device"
default 0x1f3a if ARCH_SUNXI
default 0x0
help
Vendor ID of the USB device emulated, reported to the host device.
This is usually the board or SoC vendor's, unless you've registeredfor one.
config USB_GADGET_PRODUCT_NUM
hex "Product ID of the USB device"
default 0x1010 if ARCH_SUNXI
default 0x0
help
Product ID of the USB device emulated, reported to the host device.
The strange thing to me is that PID defaults to 0x0, while in my case it is
detected as 0x0000:0x0fff.
Setting those to the ones as described in the documentation:
U-Boot SPL 2018.01-00272-g0434429f989d (Jan 182018 - 12:56:59)
Trying to boot from USB SDP
SDP: initialize...
SDP: handle requests...
Downloading file of size 357536 to 0x177fffc0... done
Jumping to the header at 0x177fffc0
Header Tag is not an IMX image
U-Boot 2018.01-00272-g0434429f989d (Jan 182018 - 12:56:59 +0100)
CPU: Freescale i.MX6DL rev1.3 996 MHz (running at 792 MHz)
CPU: Commercial temperature grade (0C to 95C) at 60C
Reset cause: POR
Board: MX6 Hummingboard2
DRAM: 1 GiB
MMC: FSL_SDHC: 0
Card did not respond to voltage select!
mmc_init: -95, time58
*** Warning - MMC init failed, using default environment
No panel detected: default to HDMI
Display: HDMI (1024x768)
In: serial
Out: serial
Err: serial
Net: FEC
Hit any key to stop autoboot: 0
Card did not respond to voltage select!
mmc_init: -95, time58
** Bad device mmc 0 **
Card did not respond to voltage select!
mmc_init: -95, time57
Device 0: Model: Firm: Ser#:
Type: Hard Disk
Capacity: not available
... is now current device
** Bad device size - sata 0 **
starting USB...
USB0: Port not available.
USB1: USB EHCI 1.00
scanning bus 1for devices... 2 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Device 0: device type unknown
... is now current device
** Bad device usb 0 **
** Bad device usb 0 **
FEC Waiting for PHY auto negotiation to complete.
The interesting thing is that whenever we enter U-Boot prompt and enter SDP
mode:
1
2
3
4
5
6
7
8
9
10
=> sdp
sdp - Serial Downloader Protocol
Usage:
sdp <USB_controller>
- serial downloader protocol via <USB_controller>
=> sdp 0
SDP: initialize...
SDP: handle requests...
The USB PID seen by my host PC changes to the one set in the configuration:
1
Bus 003 Device 025: ID 1b67:4fff
Load SPL and u-boot.img in one run
It is possible to download both SPL and u-boot.img with one imx_usb
command execution. To do that, we need to create configuration files with
following content:
Engineering Manager at 3mdeb with years of experience in engineering and management. Open-source software enthusiast and contributor. Interested in embedded systems in general, build systems, security.