If you’ve ever looked closely at the Sabre Lite or Nitrogen6X boards, you’ll see that there are two DIP switches and some notation on the silk screen indicating their use.
- 00 – Fuses
- 01 – USB
- 10 – Internal
These switches can be used to override the normal boot flow and force a boot to the USB OTG port.
If you set the switches to the USB setting and reset the board or cycle power, you should see a “Freescale” device show up in lsusb:
~/$ lsusb Bus 008 Device 002: ID 044e:3017 Alps Electric Co., Ltd BCM2046 Bluetooth Device Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub --> Bus 006 Device 012: ID 15a2:0054 Freescale Semiconductor, Inc. Bus 006 Device 006: ID 06cd:0119 Keyspan USA-19QW PDA Bus 006 Device 004: ID 04f2:0841 Chicony Electronics Co., Ltd
Combined with the right tools, this can be used to un-brick a board whose serial EEPROM has been trashed, or to program the serial EEPROM on a board which has never been programmed.
Freescale has a tool (the Manufacturing tool) that will do this. It will allow you to program not only the serial EEPROM on a board, but also SD cards, NAND, and NOR flash you might have attached to your device.
That’s pretty heavy-weight though. It also requires Windows, which isn’t present on many development machines, and it won’t run on an i.MX board.
To address these issues, we built our own, and made the sources available on GitHub:
This tool is much more lightweight. In normal use, it simply loads a named file into RAM and executes it. If you run it like so, you can launch a U-Boot binary directly.
~/imx_usb_loader$ ./imx_usb u-boot.imx
If you’re running the older U-Boot (2009.08 code base), you’ll need to specify u-boot.bin.
~/imx_usb_loader$ ./imx_usb u-boot.bin
If everything goes as planned, you should see U-Boot launch (output on the serial console)
If you’ve gone through all of this, you might ask how this un-bricks the board.
It doesn’t. But once you have U-Boot running, you can use U-Boot to upgrade the serial EEPROM using the upgradeu command as discussed in this blog post:
To run imx_usb, you’ll need to have libusb installed on your machine.
If you’re using an Ubuntu or Debian machine, you should be able to do this:
~$ sudo apt-get install libusb-1.0-0
To compile it, you’ll need the libusb headers, which can be installed by grabbing the -dev package:
~$ sudo apt-get install libusb-1.0-0-dev
And compiling it should just be a matter of grabbing the sources and invoking make:
~$ git clone git://github.com/boundarydevices/imx_usb_loader Cloning into 'imx_usb_loader'... remote: Counting objects: 131, done. remote: Compressing objects: 100% (61/61), done. remote: Total 131 (delta 71), reused 127 (delta 68) Receiving objects: 100% (131/131), 44.69 KiB, done. Resolving deltas: 100% (71/71), done. ~$ cd imx_usb_loader/ ~/imx_usb_loader$ make cc -c imx_usb.c -o imx_usb.o -Wstrict-prototypes -Wno-trigraphs -pipe -ggdb `pkg-config --cflags libusb-1.0` cc -o imx_usb imx_usb.o -lusb-1.0
See this post for details on how to use sb_loader.exe under Windows.
The function is essentially the same: sb_loader.exe can be used to download and run a U-Boot image and U-Boot can handle the rest.