Dafang-Hacks / uboot

Other
23 stars 16 forks source link

Uboot fails to initalize spi flash on Wyze V2 #18

Open Real-Time-Kodi opened 3 years ago

Real-Time-Kodi commented 3 years ago

I flashed dafang_128mb_v2.bin to my camera successfully. MD5 Sum of the downloaded file matches what is listed in the repository. Camera boots to uboot and gets stuck there. This camera uses a ZB25VQ128 flash and I guess that isn't supported. It's one of the cameras that requires cfw-1.2 to work properly.

U-Boot> sf probe
SF: Unsupported manufacturer 5e
Failed to initialize SPI flash at 0:0
--->probe spend 6 ms

I managed to load a demo.bin and flash the original bootloader back onto the camera to unbrick it. Here is the boot log from serial:

U-Boot SPL 2013.07-gba03eeb (Dec 04 2018 - 21:41:16)
pll_init:365
l2cache_clk = 375000000
pll_cfg.pdiv = 8, pll_cfg.h2div = 4, pll_cfg.h0div = 4, pll_cfg.cdiv = 1, pll_cfg.l2div = 3
nf=36 nr = 1 od0 = 1 od1 = 1
cppcr is 02404900
CPM_CPAPCR 0470890d
nf=42 nr = 1 od0 = 1 od1 = 1
cppcr is 02a04900
CPM_CPMPCR 07d0c90d
nf=50 nr = 1 od0 = 1 od1 = 1
cppcr is 03204900
CPM_CPVPCR 0320490d
cppcr 0x9a794410
apll_freq 860160000 
mpll_freq 1000000000 
vpll_freq = 1200000000
ddr sel mpll, cpu sel apll
ddrfreq 500000000
cclk  860160000
l2clk 286720000
h0clk 250000000
h2clk 250000000
pclk  125000000
DDRC_DLP:0000f003

U-Boot 2013.07-gba03eeb (Dec 04 2018 - 21:41:16)

Bootloader-Version: Dafanghacks v2
Board: Dafang 128MB (Ingenic XBurst T20 SoC)
DRAM:  128 MiB
Top of RAM usable for U-Boot at: 84000000
Reserving 419k for U-Boot at: 83f94000
Reserving 32784k for malloc() at: 81f90000
Reserving 32 Bytes for Board Info at: 81f8ffe0
Reserving 124 Bytes for Global Data at: 81f8ff64
Reserving 128k for boot params() at: 81f6ff64
Stack Pointer at: 81f6ff48
Now running in RAM - U-Boot at: 83f94000
MMC:   msc: 0
SF: Unsupported manufacturer 5e
*** Warning - spi_flash_probe() failed, using default environment

In:    serial
Out:   serial
Err:   serial
Setting yellow_gpio to off:
gpio_request lable = cmd_gpio gpio = 38
gpio: pin 38 (gpio 38) value is 1
Setting blue_gpio to off:
gpio_request lable = cmd_gpio gpio = 39
gpio: pin 39 (gpio 39) value is 1
Setting night_gpios:
gpio_request lable = cmd_gpio gpio = 81
gpio: pin 81 (gpio 81) value is 0
gpio_request lable = cmd_gpio gpio = 49
gpio: pin 49 (gpio 49) value is 0
gpio_request lable = cmd_gpio gpio = 25
gpio: pin 25 (gpio 25) value is 0
Setting USB enable:
gpio_request lable = cmd_gpio gpio = 47
gpio: pin 47 (gpio 47) value is 1
Setting Speaker enable:
gpio_request lable = cmd_gpio gpio = 63
gpio: pin 63 (gpio 63) value is 1
Setting Enable SDCARD:
gpio_request lable = cmd_gpio gpio = 43
gpio: pin 43 (gpio 43) value is 1
gpio_request lable = cmd_gpio gpio = 48
gpio: pin 48 (gpio 48) value is 0
Running SDupdate....
Interface:  MMC
  Device 0: Vendor: Man 000027 Snr 241e7301 Rev: 13.10 Prod: SD16GP
            Type: Removable Hard Disk
            Capacity: 14784.0 MB = 14.4 GB (30277632 x 512)
Filesystem: FAT32 "NO NAME    "
SF: Unsupported manufacturer 5e
Failed to initialize SPI flash
sdupdate - auto upgrade file from mmc to flash

Usage:
sdupdate LOAD_ID ADDR_START ADDR_END
LOAD_ID: 0-->u-boot
     1-->kernel
     2-->rootfs
     3-->demo.bin
ex:
    sdupdate   (update all)
or 
    sdupdate 0 0x0 0x40000
Hit any key to stop autoboot:  0 
MMC Found
Trying to find FAT uEnv.txt
reading uEnv.txt
580 bytes read in 5 ms (113.3 KiB/s)
uEnv found - Booting from microsd ...
gpio_request lable = cmd_gpio gpio = 39
gpio: pin 39 (gpio 39) value is 0
SF: Unsupported manufacturer 5e
Failed to initialize SPI flash at 0:0
--->probe spend 6 ms
No SPI flash selected. Please run `sf probe'
Wrong Image Format for bootm command
ERROR: can't get kernel image!
Trying to find EXT3 uEnv.txt
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
Trying to find EXT3 uEnv_dafang128.txt
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
Booting from NAND....
gpio_request lable = cmd_gpio gpio = 38
gpio: pin 38 (gpio 38) value is 0
SF: Unsupported manufacturer 5e
Failed to initialize SPI flash at 0:0
--->probe spend 6 ms
No SPI flash selected. Please run `sf probe'
Wrong Image Format for bootm command
ERROR: can't get kernel image!
U-Boot>

To anyone who runs into this problem, you can load your firmware off of your sd card like this

fatload mmc 0:1 0x80600000 cfw-1.2.bin 0xa8ffc0 0x40
bootm 0x80600000

login root ismart12
flash_eraseall /dev/mtd0
dd if=original-bootloader.bin of=/dev/mtd0

original-bootloader.zip

lacojim commented 3 years ago

Nice catch. I will attempt this later today. Thanks! I almost trashed the camera thinking it was a lost cause. EDIT: Gave this a try. It worked well until I realized I forgot to add the original-bootloader.bin to the sdcard AFTER I erased /dev/mtd0. Now I am left with zero bootloader, so the camera is certainly trash material now. Lesson learned. If anyone else is in the position to have to do this procedure, MAKE SURE you have the original-bootloader on your sdcard before attempting this. I assumed it would pull it from the local folder on the computer. Don't make the same mistake.

Real-Time-Kodi commented 3 years ago

You could still save it with a flash programmer, though it probably isn't worth it for a $20 camera.

lacojim commented 3 years ago

You could still save it with a flash programmer, though it probably isn't worth it for a $20 camera.

My thoughts exactly. Simply not worth it.