Unbricking a Nitrogen6X or Sabre Lite i.MX6 board

Boot mode switches on Nitrogen6X 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:
  • u-boot-conventions-for-i-mx6-nitrogen6x-and-sabrelite

Details

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

Tags:

43 Responses to “Unbricking a Nitrogen6X or Sabre Lite i.MX6 board”

  1. ericn July 18, 2012 2:22 pm #

    It appears that we inadvertently checked in a file named ‘mx6_usb_work.conf’ that contained support for auto-programming devices.

    If you downloaded before now and run across error messages about missing binary files, please grab the latest copy of the configuration file.

  2. Lili.Wang December 1, 2012 8:52 pm #

    hello , I have a question about auto load uboot from spi nor of i.mx6 sabre-lite board, would you give me same tip that I can auto boot from spi, i have MFG Tools and can download uboot to Ram and run it , but when i write uboot to addr 0 on SPI Nor, but Can’t run it on boot. please give me same help!! Thanks!!

  3. ericn December 1, 2012 10:37 pm #

    Our boards should have the boot fuses blown to select SPI NOR boot at reset time.

    Are you running a u-boot.imx file though USB or u-boot.bin. Since the u-boot.imx file doesn’t contain the 0×400 bytes of padding at the start, it wants to be programmed to offset 0×400.

    • Lili.Wang December 2, 2012 7:33 pm #

      Hello Ericn: Thanks for you reply, I have download the u-boot.imx by usb tools, and run it all right , but how can i write it to SPI NOR , i have use sf command to write it to 0 address, is’t right ? or it should write it to 400 addr ? Thank you !!

      • ericn December 3, 2012 6:34 am #

        u-boot.imx should be programmed at 0×400
        u-boot.bin should be programmed at 0

    • Lili.Wang December 2, 2012 7:40 pm #

      Another Question , I don’t find the boot fuses on the sabre lite board ,Can you tell me how can i Set the Boot fuses,Thank you .

      • ericn December 3, 2012 6:35 am #

        We’ve already programmed the fuses. You shouldn’t need to touch them.

        • Lili.Wang December 4, 2012 12:14 am #

          ok, I think i know about it, but how to programmed the fuses ??? by which tools ? or a software? Would you give me a tip. Thank you!!

          Best Regards .

          Lili.Wang

  4. ericn December 4, 2012 11:43 am #

    imxotp is the U-Boot command.

    You can get some details by searching for imxotp here:
    http://www.freescale.com/infocenter/index.jsp

  5. Ed January 11, 2013 7:07 am #

    Has anyone used this imx_usb tool on a Windows machine? I have the source for both imx_usb.c and libusb and I’m able to build successfully on both windows and linux; however, on windows (W7) the call to libusb_open() fails with LIBUSB_ERROR_NOT_SUPPORTED (-12). It works fine on Linux.

    • ericn January 11, 2013 7:11 am #

      Hi Ed,

      No. Nobody has tested this under Windows (until now). Troy confirmed compilation under Cygwin, but hasn’t had a chance to test.

      Do you know if you have libusb installed under Cygwin?

      • Ed Sutter January 18, 2013 6:41 am #

        Eric,
        Sorry for the late reply (I didn’t get an email notice that you responded)…
        The libusb that I am linking to is one that I got from libusb.org and built from scratch (on cygwin).
        I assume that, if anything, that version would be newer than anything I would get from cygwin.
        Ed

        • ericn January 18, 2013 7:42 am #

          Hi Ed,

          We’ll look into this when we can, but it’s pretty low on our priority list at the moment.

          Can you run a VM or borrow a Linux machine until then?

          If not, do you have multiple i.MX boards? Since imx_usb is Linux-based, we can put together
          a userspace that includes it.

          • Ed January 18, 2013 7:51 am
            #

            Eric,
            Its really no problem. I’ve been working on a linux box, and using imx_usb there. Which, by the way, I built the exact same way on linux as I did under cygwin). Its just a convenience because when we start building up raw boards, it would be nice to be able to use a typical lab pc which in most cases for us is some old Windows box. I know the MfgTool from freescale can be used there if really necessary.

            If you (or I) figure out how to get imx_usb running on windows lets post that info here.
            Thanks much for the help,
            Ed

          • ericn January 18, 2013 9:50 am
            #

            That was also our motivation for Cygwin (old Lab PCs).

  6. greg herman January 25, 2013 10:18 am #

    Trying to unbrick the board,
    ran ./imx_usb u-boot-otp.bin and got:
    main:Could not open device vid=0x15a2 pid0x54 err-3

    • ericn January 25, 2013 12:14 pm #

      You’ll need to run this using sudo or change the permissions for the /dev entry.

      • Ed January 25, 2013 12:35 pm #

        Eric,
        I use sudo all the time, would be nice to just change permissions to eliminate this.
        This is probably a dumb question but, how do you know which /dev entry to change?
        The logical thing I did was compare ls -l of /dev with and without the board plugged in
        and it shows usbdev1.13_3p00 and usbdev1.13_ep81
        Ed

        • ericn January 25, 2013 12:48 pm #

          There’s a way to do this using udev, and I’ve seen some related notes for Android fastboot devices (which also use libusb), but I don’t have anything off-hand.

          I cheat and have imx_usb owned by root and set the suexec flag.

  7. Jason January 29, 2013 6:47 am #

    If I put the switches in what looks like (according to the board artwork) the USB position it doesn’t seem to work. However if I put the switches in the “Internal” position I can use the imx_usb program and boot the board fine. Is the artwork backwards or am I backwards? :)

    • ericn January 29, 2013 7:12 am #

      Krowtra is backwards.

  8. kumar March 6, 2013 2:44 pm #

    From the posts above I see that this utility is not tested in cygwin environment, it would be nice, if available there, as our lab pcs are all windows.

    I got it to compile after installing libusb in cygwin–>dev, and if I comment out sys/io.h it compiles.
    running it takes segmentation fault. I am not familiar with cygwin environment and not user if libusb is doing its job. is sys/io.h required in cygwin environment ?

    Any timeframe that you are planning to release cygwin version

    • ericn March 6, 2013 2:53 pm #

      Hi Kumar,

      Cycles with a working Windows install in our office are a rare commodity, so we don’t have anything planned immediately.

      As for the compilation error, this may be a Cygwin version thing. It’s been a while since we’ve even compiled for Cygwin.

  9. Bhimsen March 8, 2013 3:53 am #

    Hello,
    I have flashed a wrong u-boot.bin version on the SPI-NOR flash of imx6q-sabrelite board, in-which sf command support has been removed.

    I have another issue that, when I set the boot switches for OTG mode, i.e., SW1 – 1 & SW1 – 0. Connected the USB cable to OTG port of the board, but I am not able to see it getting detected as HID device in the device manager on Windows-7 machine. I also connected the same to Ubuntu machine, and checked lsusb. There also it is not getting detected.

    Is there any solution? I think that probably the HID complient detection part of the code has been removed from the SPI-NOR flash, because of my last u-boot update. Is my understanding correct.

    Help me please.

    • ericn March 8, 2013 6:54 am #

      Hello Bhimsen,

      I suspect that you’re seeing the backwards artwork that Jason reported. Please try the alternate switch setting.

      No changes to SPI-NOR can affect the ability to get into serial boot mode because that decision happens in the internal ROM before deciding to look at SPI-NOR.

  10. Muhammad Faisal March 18, 2013 4:54 am #

    Hi All,

    I want to download my .bin file on the Nitrogen board, I produced this .bin file with imx_sdk from freescale. I dont want to use mfg tool as I am using ubuntu so I tried to dowloand my .bin file on the Nitrogen board using imx_usb_loader, I did the following.

    I downloaded the imx_usb_loader_master.zip from the repository and then I extract all the files,
    Then I run the make command , after that I could see imx_usb (application or exe file).
    then I copied my uart_check_test.bin file and execute the following command

    sudo su ./imx_usb uart_check_test.bin

    and I got the following result:

    =======================================================================

    parse mx6_usb_work.conf
    15a2:0054(mx6_qsb) bConfigurationValue =1
    Interface 0 claimed
    report 1, wrote 16 bytes, err=0
    report 3, read 4 bytes, err=0
    read=56 78 78 56
    uart_check_test.bin 0 0 1 0 1 2
    main dcd length 2b8
    sub dcd length 2b4
    dcd_ptr=0×10000430

    loading binary file(uart_check_test.bin) to 10000000, skip=0, fsize=1a108 type=aa

    <<>>
    jumping to 0×10000400

    =====================================================================

    but nothing appears on my serial port that was supposed to be sent through uart.

    I also tried other .bin files (that i compiled for different test) but every time , I was getting the same result with exactly same information…

    can anybody guide me in this regard,

    Muhammad Faisal.

  11. smike April 24, 2013 5:53 am #

    Hi All,

    I tried to download my u-boot.bin file on the Sabre Lite board using imx_usb_loader:

    sudo ./imx_usb u-boot.bin

    and I got the following result:

    parse mx6_usb_work.conf
    15a2:0054(mx6_qsb) bConfigurationValue =1
    Interface 0 claimed
    report 1, wrote 16 bytes, err=0
    report 3, read 4 bytes, err=0
    read=56 78 78 56
    u-boot.bin 0 0 1 0 1 2
    main dcd length 2d8
    sub dcd length 2d4
    dcd_ptr=0x2780042c
    
    loading binary file(u-boot.bin) to 27800000, skip=0, fsize=2bb40 type=aa
    out err=-7, last_trans=0 cnt=0x4000 max=0x400 transferSize=0x0 retry=0
    out err=-7, last_trans=0 cnt=0x4000 max=0x200 transferSize=0x0 retry=1
    ...
    Giving up
    report 1, wrote 0 bytes, err=-7
    ....
    report 3, read 0 bytes, err=-7
    read=00 00 00 00
    4 in err=-7, last_trans=0  00 00 00 00
    

    can anybody help me?

    BR, Michael

    • ericn April 24, 2013 6:42 am #

      Hi Michael,

      It appears that you weren’t connected over USB properly.
      Did you run lsusb before-hand and verify that a “Freescale” device showed up?

      • smike April 24, 2013 9:30 am #

        Hi Ericn!
        Yes, I run lsusb and verify that the “Freescale” device is defined correctly.
        ID 15a2:0054 Freescale Semiconductor, Inc.

        • ericn April 24, 2013 9:42 am #

          Hi Mike,

          Can you try with one of our U-Boot binaries? There’s a complete set (for various processor/memory configurations) on-line here:

          If you’re running a standard SABRE Lite or Nitrogen6X with Quad-core, you’ll want to use ‘u-boot.nitrogen6q’:

          ~/imx_usb_loader$ sudo ./imx_usb u-boot.nitrogen6q
          
          • smike April 24, 2013 11:00 am
            #

            Thanks, ericn.
            I will try u-boot-nitrogen-20130422.zip tomorrow

          • smike April 25, 2013 1:13 am
            #

            Hi Ericn!
            Yesterday I didn’t tell you that I try to load u-boot on a board of our own development, almost identical saber lite (sorry for bad English).

            Today I once again run lsusb as “lsusb -v -d 15a2:0054″ with our board:

            Bus 001 Device 021: ID 15a2:0054 Freescale Semiconductor, Inc.
            Device Descriptor:
            bLength 18
            bDescriptorType 1
            bcdUSB 2.00
            bDeviceClass 0 (Defined at Interface level)
            bDeviceSubClass 0
            bDeviceProtocol 0
            bMaxPacketSize0 64
            idVendor 0x15a2 Freescale Semiconductor, Inc.
            idProduct 0×0054
            bcdDevice 0.01
            iManufacturer 1 Freescale SemiConductor Inc
            iProduct 2 SE Blank ARIK
            iSerial 0
            bNumConfigurations 1
            Configuration Descriptor:
            bLength 9
            bDescriptorType 2
            wTotalLength 34
            bNumInterfaces 1
            bConfigurationValue 1
            iConfiguration 4 Freescale Flash
            bmAttributes 0xc0
            Self Powered
            MaxPower 10mA

            ………………………….

            and so on …

            I try to load ./imx_usb u-boot.nitrogen6q to Sabre Lite – everything is ok.

            when I try to load ./imx_usb u-boot.nitrogen6q to our devboard, I receive an error: “out err=-7″
            out err=-7 is libusb_control_transfer error code LIBUSB_ERROR_TIMEOUT – transfer timed out.

            in what there can be a problem (in processor, in RAM memory, in USB)?

            Thanks.
            BR, Michael

          • ericn April 25, 2013 6:34 am
            #

            Hi Michael,

            Any number of problems could be present, but RAM issues are the most likely.

            You might want to create a binary that runs from IRAM as a test.

          • smike April 29, 2013 3:01 am
            #

            Hi, Ericn!
            I loaded u-boot.nitrogen6q on my board, but now other problem:
            ==================================================
            imx_usb_loader-master$ sudo ./imx_usb u-boot.nitrogen6q
            parse mx6_usb_work.conf
            15a2:0054(mx6_qsb) bConfigurationValue =1
            Interface 0 claimed
            report 1, wrote 16 bytes, err=0
            report 3, read 4 bytes, err=0
            read=56 78 78 56
            u-boot.nitrogen6q 0 0 1 0 1 2
            main dcd length 308
            sub dcd length 304
            dcd_ptr=0x177ffc2c

            loading binary file(u-boot.nitrogen6q) to 177ffc00, skip=0, fsize=50620 type=aa

            <<>>
            jumping to 0x177ffc00

            ==================================================

            but nothing appears on my serial console port after the message “jumping to 0x177ffc00″ :(
            can you help me?

            BR, Michael

  12. smike April 24, 2013 9:58 am #

    Thanks, ericn.
    I will try u-boot-nitrogen-20130422.zip tomorrow

  13. Rob May 2, 2013 7:37 am #

    Hi Michael and Eric

    Was there ever a resolution to this? I am also receiving the same “jumping to 0x177ffc00″ error

    • ericn May 2, 2013 7:52 am #

      Hi Rob,

      I’m presuming a hardware error on Mike’s custom board, since this isn’t an issue we’ve seen.

      Are you also running against a custom board?

  14. Rob May 2, 2013 8:25 am #

    This is just a stock sabre lite board rev D 5-9-12 mac: 00:19:B8:00:F1:01

  15. Rob May 2, 2013 8:51 am #

    This is just a stock sabre lite board rev D 5-9-12

    • ericn May 2, 2013 10:24 am #

      The ‘jumping to x’ message indicates success, and should be followed immediately by data on the serial console.

      Are you seeing anything on the serial port?

      • smike May 6, 2013 6:06 am #

        Hi, Eric!
        Now I run u-boot.imx on my custom board, the problem was that the console port UART2 moved from standard pins EIM_D26, EIM_D27 to pins SD4_DAT7, SD4_DAT4 :(
        Next question: I want that u-boot booted from eeprom spi memory. I wrote u-boot in eeprom memory to the address 0×400.
        And now, how can I set eFUSEs to indicate (to say) boot ROM that the boot device is eeprom spi memory? (sorry for my bad English).
        Or what I need to do that my board booted from eeprom spi memory? (now boot ROM at once jumps directly to the Serial Downloader)

        Thanks!
        BR, Michael

        • ericn May 6, 2013 1:43 pm #

          Hi Michael,

          At the risk of bricking your board, I can only say that
          we use the imxotp command.

          U-Boot > imxotp blow --force 5 0x18000030
          U-Boot > imxotp blow --force 6 0x00000010 
          

          Please double-check the validity for your board (no warranty implied).

  16. Rob May 2, 2013 10:48 am #

    Thanks for following up eric.

    I resolved the issue by using the manufactures tool in windows with a putty serial console open. The mfgtool in windows required: a restart of the pc, plugging in the device, then open the manufacturing tool in order for it to work.

Leave a Reply