Provisioning: Using Serial Download Protocol (SDP) – Part 2

In our previous post, we have explored basic details about Introduction to Provisioning and it’s needs. In this post we will narrow down our use case and experiment how it works. As mentioned in our previous post, we will use

 

Hardware: Phytec Phycore imx6UL/ULL SoM

Storage: eMMC

 

We will assume that the hardware is shipped without any software (bootloader). If the hardware is shipped with Bootloader and BSP, then we need to force the hardware to boot from Serial Download Mode (SDP) using boot switch. Refer to imx6UL/ULL datasheet and Technical Reference manual to know more about boot mode selection.

 

imx6UL/ULL primarily comes with 2 USB OTG controllers and to use SDP, we need to use OTG1 controller. Setup to get into SDP is,

  • Connect the USB OTG to the host machine (Raspberry PI in our case)
  • Connect debug UART to see the functional booting of the target

When in SDP mode, connecting USB OTG enumerates the Freescale imx6UL/ULL device below (seen using lsusb)

Bus 001 Device 007: ID 15a2:0080 Freescale Semiconductor, Inc.

When expanded with we have,

To detail, Freescale USB device enumerated with one configuration with one Interrupt Endpoint. SDP protocol uses this USB configuration (interrupt endpoint) to communicate with the SoC and upload images over USB. This is implemented as open source imx_usb_loader. In our case, I have cloned and compiled the latest version from Github. This utility depends on libusb.

 

The most important part of imx USB loader is imx_usb.conf,

pi@raspberrypi:~/imx_usb_loader $ cat imx_usb.conf
#vid:pid, config_file
0x066f:0x3780, mx23_usb_work.conf
0x15a2:0x004f, mx28_usb_work.conf
0x15a2:0x0052, mx50_usb_work.conf
0x15a2:0x0054, mx6_usb_work.conf
0x15a2:0x0061, mx6_usb_work.conf
0x15a2:0x0063, mx6_usb_work.conf
0x15a2:0x0071, mx6_usb_work.conf
0x15a2:0x007d, mx6_usb_work.conf
0x15a2:0x0080, mx6ull_usb_work.conf
0x1fc9:0x0128, mx6_usb_work.conf
0x15a2:0x0076, mx7_usb_work.conf
0x1fc9:0x0126, mx7ulp_usb_work.conf
0x15a2:0x0041, mx51_usb_work.conf
0x15a2:0x004e, mx53_usb_work.conf
0x15a2:0x006a, vybrid_usb_work.conf
0x066f:0x37ff, linux_gadget.conf
0x1b67:0x4fff, mx6_usb_sdp_spl.conf
0x1b67:0x5ffe, mx6_usb_sdp_spl.conf
0x0525:0xb4a4, mx6_usb_sdp_spl.conf
0x1fc9:0x012b, mx8mq_usb_work.conf
0x1fc9:0x0134, mx8mm_usb_work.conf
0x3016:0x1000, mx8mm_usb_sdp_spl.conf

which stores the USB Vendor ID and Product ID and use respective configuration. Highlighted in RED is the Phytec’s imx6ULL SoC.

Loading U-boot bootloader image:

We are going to compile and load U-Boot using imx_usb_loader. To do so, we need to compile u-boot with SDP support. The mainline U-Boot version supports our board Phycore imx6UL/ULL and SDP is implemented as part of U-Boot. Please refer steps to compile u-boot and configuration option for your board/SoC in U-Boot documentation.

Configuration using: make ARCH=arm menuconfig

enable SDP in SPL and also in U-Boot and cross compile for ARM. Outcome of the compilation will be two images,

  • SPL – Secondary Program Loader (Executed directly by imx6 ROM Code)
  • U-Boot proper – Loaded by SPL

To load SPL first using imx_usb_loader,

sudo ./imx_usb ./SPL ./imx_usb.conf

which will load SPL into RAM and imx6 ROM code will start it. The next step is to load the U-Boot proper using,

sudo ./imx_usb ./u-boot-dtb.img ./imx_usb.conf

We can observe the same in imx6 targets UART Debug console,

U-Boot SPL 2019.10-00341-gffc379b42c-dirty (Oct 26 2019 - 21:54:46 +0200)
Trying to boot from USB SDP
SDP: initialize...
SDP: handle requests...
Downloading file of size 382 to 0x81000000... done
Downloading file of size 22262368 to 0x82000000... done
Downloading file of size 410113 to 0x877fffc0... done
Jumping to header at 0x877fffc0
Header Tag is not an IMX image

U-Boot 2019.10-00341-gffc379b42c-dirty (Oct 26 2019 - 21:54:46 +0200)

CPU: Freescale i.MX6ULL rev1.0 792 MHz (running at 396 MHz)
CPU: Industrial temperature grade (-40C to 105C) at 46C
Reset cause: POR
Model: Phytec phyBOARD-i.MX6ULL-Segin SBC
Board: PHYTEC phyCORE-i.MX6ULL
DRAM: 256 MiB
MMC: FSL_SDHC: 0, FSL_SDHC: 1
In: serial@2020000
Out: serial@2020000
Err: serial@2020000
Net:
Warning: ethernet@2188000 using MAC address from ROM
eth0: ethernet@2188000
Hit any key to stop autoboot: 0

Conclusion:

In this post we have viewed the basic details about SDP and it’s working when loading U-Boot using imx_usb_loader. In the next post we will explore in details about the Vendor ID and Product ID usage in U-Boot proper and relative configuration in imx_usb_load. This will help further to achieve our goal of automated flashing.

Written by

No Comment

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *