-
Notifications
You must be signed in to change notification settings - Fork 67
Unbrick the cam
roleo edited this page Jul 14, 2020
·
15 revisions
If the camera no longer starts, wait before throwing it out the window. Probably the home partition is broken but the bootloader is ok, therefore you have a last chance to restore it. To do this, however, you need to connect the serial port and type some commands using the console.
Probably your home partition is broken, so you need a backup copy to restore it. If you followed the backup procedure then you should have the mtdblock3.bin file, which is the home partition you need. Copy the file to the SD card and insert it to the cam.
- Open the cam removing screws.
- Find the 3 uart pads (TX, RX and GND). Where are they? It depends on the model, on the y20ga model there are the labels. Example:
- Connect the pads to a ttl-rs232/usb adapter (rx, tx and GND).
- Open putty with logging enabled.
- Switch on the cam. Now, if the connection is ok, you will see the uboot and kernel logs on the screen. Otherwise, restart from point 2.
- Stop the boot at the U-Boot prompt (should be "=>") pressing "Enter".
Now you have a physical connection to the cam and you can use all the uboot commands.
Type the following commands and check the output response:
- Enable the SD card:
=> sunxi_card0_probe
[23.298]get mem for descripter OK !
card_caps:0x30000002
host_caps:0x3000003f
- List the content of the SD card:
=> fatls mmc 0
Factory.done/
3246161 home_y20gam.done
record/
67108864 swapfile
fw_upgrade/
log/
newhome/
12058624 mtdblock3.bin
9 file(s), 8 dir(s)
- Load the file mtdblock3.bin from SD to RAM memory (address 0x45000000):
=> fatload mmc 0 45000000 mtd3.bin
12058624 bytes read in 1002 ms (11.5 MiB/s)
- Enable SPI bus and detect flash chip:
=> sf probe
sf: bus-0 cs-0 spedd-50000000Hz mode-3000
SF: Detected en25qh128 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
- Get the parameters for write command To run the last command you need 3 parameters:
- address: the RAM address used above (45000000)
- offset: is the offset in flash where mtdblock3 starts According to the table below:
root@xiaoyi:/# cat /proc/mtd
dev: start size erasesize name
mtd0: 00000000 00080000 00010000 "uboot"
mtd1: 00080000 00240000 00010000 "boot"
mtd2: 002C0000 00180000 00010000 "rootfs"
mtd3: 00440000 00b80000 00010000 "home"
mtd4: 00fc0000 00020000 00010000 "env"
mtd5: 00fe0000 00010000 00010000 "mfg"
mtd6: 00ff0000 00010000 00010000 "conf"
mtd7: 00000000 00000000 00000000 "UDISK"
is 80000 + 240000 + 180000 = 440000
- len: len of the file mtd3block.bin copy it from the output of the fatload command and convert it to hexadecimal (12058624 => b80000)
- Write the file from RAM memory to SPI flash using parameters above:
=> sf write 45000000 440000 b80000
device 0 offset 0x440000, size 0xb80000
SF: 12058624 bytes @ 0x440000 time:14825 ms Written: OK