BeagleBoardRecovery

From eLinux.org
Jump to: navigation, search

This page is how to recover ("unbrick") a broken BeagleBoard. It should help you if you messed your boot configuration and BeagleBoard doesn't boot any more the normal way ("bricked").

Symptoms

Normally, if you boot from MMC, you will get something like

...40T...

in terminal program connected to UART (115200 8N1). This is output from OMAP3's bootrom while scanning the UART for boot source before trying to boot from MMC card. If you don't get this, but want to boot from MMC, most probably bootrom doesn't reach the MMC boot stage any more. If you played with NAND before getting this, most probably NAND contains some broken content.

What has happened?

Depending on user button OMAP3 on BeagleBoard uses different boot order. Normal order if user button isn't pressed at power up is boot from

NAND -> USB -> UART -> MMC

in this order. Depending on the boot medium (e.g. MMC) this might fail if something bad is in NAND flash which confuses OMAP3 bootrom thus stopping it to reach MMC boot stage.

This might happen if you e.g. mess your NAND, e.g. something went wrong with NAND boot.

What to do now?

First, we have to press user button at power up to switch boot order to

USB -> UART -> MMC -> NAND

to have option to boot from other sources than broken NAND (which is first if user button is not pressed).

Then, there are three options to boot from:

  • MMC
  • USB
  • UART

Below, MMC and USB recovery will be done in detail. The goal is to get a U-Boot prompt and then to erase the non-booting NAND.

MMC recovery

For the most up to date instruction to restore any BeagleBoard version SD card to the factory image see the CircuitCo Wiki.

The procedure to put your board into the "factory fresh state" used on all boards being made now is at http://code.google.com/p/beagleboard/wiki/BeagleboardRevCValidation. The original recovery method is described below.

MMC recovery should be straight forward. Press user button at power up and according to above boot order MMC boot is before NAND. With this, we should be able to boot as we did without pressing the user button before bricking the board. But:

There are some broken MLO (x-loader) out there which fail to boot if something wrong is in NAND. E.g.:

...40T.........

Texas Instruments X-Loader 1.41
Starting on with MMC
Reading boot sector

150832 Bytes Read from MMC
Starting OS Bootloader from MMC...

U-Boot 1.3.3 (Jun 20 2008 - 17:06:22)

OMAP3530-GP rev 2, CPU-OPP2 L3-165MHz
OMAP3 Beagle Board + LPDDR/NAND
RAM Configuration:
Bank #0: 80000000 128 MB
Bank #1: 88000000  0 kB
NAND:  NAND device: Manufacturer ID: 0x2c, Chip ID: 0x01 ( AND 128MiB 3,3V 8-bit)
NAND bus width 16 instead 8 bit
0 MiB
<hang, no prompt>

This seems to happen with both MLO's from Beagle source code page (381MHz and 500MHz one) independent of U-Boot version.

Thus, you have to use a special (?) MLO for recovery to get a U-Boot prompt. Replacing MLO used above on MMC/SD card with this recovery MLO we get a U-Boot prompt while pressing the user button at power up:

...40T.........

Texas Instruments X-Loader 1.41
Starting on with MMC
Reading boot sector

150832 Bytes Read from MMC
Starting OS Bootloader from MMC...

U-Boot 1.3.3 (Jun 20 2008 - 17:06:22) 

OMAP3530-GP rev 2, CPU-OPP2 L3-165MHz
OMAP3 Beagle Board + LPDDR/NAND
RAM Configuration:
Bank #0: 80000000 128 MB
Bank #1: 88000000  0 kB
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
OMAP3 beagleboard.org #

U-Boot version doesn't seem to matter. Then you can erase NAND start:

OMAP3 beagleboard.org # nand unlock
device 0 whole chip
nand_unlock: start: 00000000, length: 268435456!
NAND flash successfully unlocked
OMAP3 beagleboard.org # nand erase 0 80000

NAND erase: device 0 offset 0x0, size 0x80000
Erasing at 0x60000 -- 100% complete.
OK
OMAP3 beagleboard.org #

If you now re-power your board without pressing the user button it should work as before. Happily unbricked!

Next, you can also restore the NAND flash by preparing an SDCard image that automatically flashes all software components correctly.

MMC recovery Troubleshooting

Some have encountered problems with trying to boot from MMC, but it wasn't booting from MMC because of a bad formating and/or copy of the MLO. This example demonstrates booting from NAND even if the user button (40T) has been pressed.

...40T...      

Texas Instruments X-Loader 1.41
Starting OS Bootloader... 

Instead, the correct and expected result with user button pressed is booting from MMC and this should be printed:

...40T...

Texas Instruments X-Loader 1.41
Starting on with MMC
Reading boot sector

150832 Bytes Read from MMC
Starting OS Bootloader from MMC...

If MMC is not displayed, this means that the MLO (x-loader for the MMC) has not been properly copied or the partition has not been done properly. Or simply that there is something wrong with what is on the MMC.

The first thing to do is to follow step by step the Linux Boot Disk Format Procedure then after formating the FIRST STEP TO DO AFTER FORMATING IS TO COPY MLO. Which one? MLO_restore from Downloads list the one previously discuss in MCC recovery section.

For u-boot we suggest to use u-boot.bin_autoflash from Downloads list.

Summary:

1- Partition MMC // Last cylinder or +size or +sizeM or +sizeK (1-245, default 245): [+50] ENTER 51 not 50!

2- Format MMC //

3- Copy MLO // Change MLO_restore name for MLO

4- Copy u-boot.bin // Change u-boot.bin_autoflash for u-boot.bin

5- Insert SD into beagleboard hold user button and plug the power you should boot from MMC.

NOTE:The difference between the MLO and x-load.bin.ift is that the first is used for the MMC and the other one for NAND boot.

Reference: Problem discuss

USB recovery

See USB_Boot for a patch to x-loader to boot all the way to Linux via USB.

You can use USB boot utility together with U-Boot V2 and then use U-Boot V2's loadb to load U-Boot (V1). Binary: U-boot V2

Note: USB download can only load programs into OMAP3's internal SRAM. This is 64k, so too small for U-Boot (V1). But unfortunately, U-Boot V2 currently lacks NAND support. So we have to use:

USB download -> U-Boot V2 (SRAM) loadb -> U-Boot (V1) (SDRAM) NAND erase

For this, get usbload and U-Boot V2 using above links, start usbload tool at PC and while ... plug in USB OTG (power) cable. At host, this will result in:

> ./omap3_usbload uboot_v2.bin

TI OMAP3 USB boot ROM tool, version 0.1
(c) 2008 Martin Mueller <martinmm@pfump.org>

..........................................

found device!
download ok
>

And at target you will get:

U-Boot 2.0.0-rc5-git (Jun 30 2008 - 20:16:02)

Board: Texas Instrument's SDP343x
Malloc Space: 0x87bfff10 -> 0x87ffff10 (size  4 MB)
running /env/bin/init...
not found
X-load 343x>

Now, you can use this running U-Boot V2 to download U-Boot (V1) using loadb command:

X-load 343x> devinfo
devices:
|----uart3
|----ram0
|----filesystem: /
|----filesystem: /dev

drivers:
serial_ns16550
    ramfs
    devfs
      ram
X-load 343x> help loadb
[OPTIONS]
 -d device - which device to download - defaults to /dev/mem
 -o offset - what offset to download - defaults to 0
 -b baud   - baudrate at which to download - defaults to console baudrate

X-load 343x> loadb -d /dev/ram0
## Ready for binary (kermit) download to 0x00000000 offset on /dev/ram0 device at 115200 bps...

Now, send U-Boot (V1) binary (i.e. u-boot.bin) using kermit download of you terminal program. When this is finished:

## Total Size      = 0x00023d64 = 146788 Bytes

X-load 343x> help go
addr [arg ...]
   - start application at address 'addr'
     passing 'arg' as arguments

X-load 343x> go 0x80000000
## Starting application at 0x80000000 ...

U-Boot 1.3.3 (Jul  6 2008 - 10:33:59)

OMAP3530-GP rev 2, CPU-OPP2 L3-165MHz
OMAP3 Beagle Board + LPDDR/NAND
RAM Configuration:
Bank #0: 80000000 128 MB
Bank #1: 88000000  0 kB
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
OMAP3 beagleboard.org #

Now, you have your U-Boot (V1) prompt. This can be used now to erase (broken) parts in NAND:

OMAP3 beagleboard.org # nand unlock
device 0 whole chip
nand_unlock: start: 00000000, length: 268435456!
NAND flash successfully unlocked
OMAP3 beagleboard.org # nand erase 0 80000

NAND erase: device 0 offset 0x0, size 0x80000
Erasing at 0x60000 -- 100% complete.
OK
OMAP3 beagleboard.org #

If you now re-power your board without pressing the user board it should work as before. Happily unbricked!

UART recovery

Note: you can download a tarball with all the tools needed here.

1 - Generate an x-loader with serial support

mkdir serial_boot
cd serial_boot
git clone http://git.omapzoom.org/repo/u-boot.git
git clone http://git.omapzoom.org/repo/x-loader.git
cd x-loader
make distclean
make omap3430labradordownload_config
make
cd ..

now you've got an ~13k x-load.bin in the x-loader directory.

2 - Generate Nishant Menon's tools

git clone http://github.com/nmenon/omap-u-boot-utils.git
cd omap-u-boot-utils
make distclean
make

now you've got two tools: pserial and ukermit

3 - Pick up the U-Boot you'd like to put in SDRAM

You can either use the one generated by OE, or you can quickly generate a new one:

cd ..
git clone http://git.denx.de/u-boot.git u-boot-denx
cd u-boot-denx
make distclean
make omap3_beagle_config
make
cd ..

now you've got an ~160k u-boot.bin in the u-boot-denx directory.

4 - Prepare the boot

cd omap-u-boot-utils
cp ../x-loader/x-load.bin .
cp ../u-boot-denx/u-boot.bin .

5 - Boot (use the right tty for your setup of course)

Power off the board.

Run pserial to put the x-loader in the internal SRAM:

./pserial -p /dev/ttyS0 -f x-load.bin

If you already have an x-loader in NAND, you must push the User Button so that the NAND boot is tried after the UART boot, then power-on the board.

If you don't have one, simply power-on the board.

You see:

Waiting For Device ASIC ID: Press Ctrl+C to stop
ASIC ID Detected.
Sending 2ndFile:
Downloading file: 100.000% completed(12700/12700 bytes)
File download completed.

Then run ukermit, to transmit the u-boot to the x-loader and then the x-loader puts it in SDRAM:

./ukermit -p /dev/ttyS0 -f u-boot.bin

You see:

Downloading file: 100.000% completed(162656/162656 bytes)
File Download completed

And then you have an U-Boot prompt like this:

## Start Addr      = 0x80008000
Starting OS Bootloader from UART ...

U-Boot 2009.03-rc2-00013-gefb4734 (C3A4r 18 2009 - 10:55:33)

OMAP3530-GP rev 2, CPU-OPP2 L3-165MHz
OMAP3 Beagle board + LPDDR/NAND
DRAM:  128 MB
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Board revision Ax/Bx
Die ID #047a00030000000004013f780601000c
Hit any key to stop autoboot:  0

Now you can erase the flash and restore U-Boot as explained in the previous section.