Problems in flashing Android Images to VIM3

it doesnt seem very likely to me, but i would try a different cable just in case the one you are using has issues. its either that or possibly an issue with how windows handles usb device hardware changes

@zonggestsu
I have tried with another USB 2 to 3 cable but the result was the same. In addition, USB Burning tool for Windows works Ok with the same cable, which means the cable is not a problem?

Let me be more specific.
As USB is always disconnected at the Step3, I suspect the ‘update run’ commmand do something wrong. It looks to me that the command is to run the bl2 bin code from the VIM3 RAM. So does it mean the Step3 entirely depend on the bootloader image transfered at the Step2? Is there possibility that ‘update run’ gommand fails due to some pre-configuration? Is Step2 parameters are all good?

Thanks.

That I’m not sure of, usually when I do flash the bootloader i do the whole process on Linux, bare metal, and haven’t run into this sort of issue. Maybe @tenk.wang could say more as to what may be going on.

@tenk.wang
Can you advise me if ‘update run’ command makes my VIM3 exit from the upgrade mode so tha I’m unable to program bl2 bootloader? I tried with several versions of bootloader images built by myself, uploaded in khadas repository with which someone had successfully flashed his own device. But no work till now.

Thanks.

@aeropia you can try this USB dirver.
You can use Ubuntu flash ROM yet.

@tenk.wang
Thanks for the reply but I can’t download the USB driver but you mean this?

But trying to install this driver doesn’t seem to go any further. I tried to right click the INF file and select ‘install’ but I can’t see anything in progress. I’m not sure it is installed or not.

When I enter the upgrade mode, the device management screen looks like this;
image

Are you suggesting to update this driver?

Strange thing is after I execte the ‘update run’ command, the USB is connected as Adb devices like below.
image

@aeropia
This is my falsh bat,you can refer to it.
flash_uboot_vim3.bat

@update write u-boot_kvim3_noab.bin 0xfffa0000 0x10000
@if NOT %errorlevel%==0 goto :error

@update run 0xfffa0000
@if NOT %errorlevel%==0 goto :error

@update bl2_boot u-boot_kvim3_noab.bin
@if NOT %errorlevel%==0 goto :error

@fastboot oem format
@if NOT %errorlevel%==0 goto :error


@fastboot flash bootloader u-boot_kvim3_noab.bin
@if NOT %errorlevel%==0 goto :error

@fastboot erase bootenv
@if NOT %errorlevel%==0 goto :error


@fastboot reboot bootloader
@echo !!!!!!!!Flash uboot successfully!!!!!!!!
@goto :exit

:error
@echo errorlevel %errorlevel%
@echo !!!!!!!!Flash uboot failed!!!!!!!!
@pause

:exit

flash_img.bat

@fastboot flash boot boot.img
@if NOT %errorlevel%==0 goto :error


@fastboot flash super super.img
@if NOT %errorlevel%==0 goto :error

@fastboot flash cache cache.img
@if NOT %errorlevel%==0 goto :error


@fastboot flash userdata userdata.img
@if NOT %errorlevel%==0 goto :error

@fastboot flash recovery recovery.img
@if NOT %errorlevel%==0 goto :error

@fastboot flash dtbo dtbo-unsigned.img
@if NOT %errorlevel%==0 goto :error


@fastboot reboot
@echo !!!!!!!!Flash some img successfully!!!!!!!!
@goto :exit

:error
@echo errorlevel %errorlevel%
@echo !!!!!!!!Flash some img failed!!!!!!!!
@pause

:exit

It can be seen from the log that it is the problem of USB driver

Thanks for the update. I’ll try with your .bat file when I come back to home.

As I explained, I found that the run command at the Step3 makes the VIM3 exit from the upgrade mode and it gets connected as adb device, so I think the USB driver issue at the Step4 is as expected. So, I guess the problem is at the Step3, not Step4. Why on earth VIM3 exit the upgrade mode by ‘update run’ command?

Is it normal that the VIM3 is seen either WorldCup device or adb device exclusively?

Thanks again!

@aeropia
The normal mode is

update write u-boot_kvim3_noab.bin 0xfffa0000 0x10000     // **WorldCup Device**
update run 0xfffa0000      // **WorldCup Device**
update bl2_boot u-boot_kvim3_noab.bin    // **WorldCup Device**

After this command(update bl2_boot u-boot_kvim3_noab.bin) was executed.
The VIM3 will enter “Android ADB mode”.

So, in my case the first ‘update write’ works and I can see “transfer complete” message but the 2nd ‘update run’ command fails but no error message. Only I can recognize is the USB disconnection sound and short blink of red LED. Then the USB device is changed from WorldCup to ADB. I guess the device reset at ths point?

So, can you explain what happens if ‘update run’ command is sent to VIM3? Is there any possible scenario to make the connection drop?

Sorry for so many repeated questions.
Thanks!

@aeropia
It is my result.

Um… why my VIM does not keep being connected…?

Does ‘update run’ command let VIM3 execute the u-boot image file just transfered? If that is true, the u-boot image file is problem…? Is there any precondition not to allow run the image?

Can you share your u-boot image file so that I would try by chance?

Thanks.

You can download it.

I have tried with the image file and the batch file included in the post. The result looks the same but there are error codes;

What do these mean?

C:\Users\aerop\work\fastboot_update\VIM3_R_AOSP_V210604\Android>flash_uboot_vim3.bat

Transfer Complete! total size is 65536 Bytes
[update]:Run at Addr fffa0000
AmlUsbRunBinCode:ram_addr=fffa0000
[LUSB]ERR(L1069):Fail in start cmd, ret=-5
[LUSB]ERR(L1172):fail in parse cmd, ret=-1070
errorlevel -1173
!!!Flash uboot failed!!!

Thanks.

@aeropia
This error means that your board is not VIM3, it may be VIM3L.
VIM3L need u-boot_kvim3l_noab.bin file.

Really? No way!!:scream:

This is my board with A331D. How can it be VIM3L?

Mine is VIM3 Pro with 32GB eMMC from official Khadas store at Aliexpress.

@tenk.wang @zonggestsu
Strange enough, I have just flashed the u-boot successfully!!!

I removed the USB burning tool 2.2.0 from PC, remove the USB driver, downloaded new version of USB burning tool 2.2.4 and install it. And… run the same command again. The result looks good to me!

C:\Users\aerop\work\fastboot_update\VIM3_R_AOSP_V210604\Android>flash_uboot_vim3

Transfer Complete! total size is 65536 Bytes
[update]:Run at Addr fffa0000
AmlUsbRunBinCode:ram_addr=fffa0000
[LUSB]:[AMLC]dataSize=16384, offset=65536, seq 0
[LUSB]:requestType=0
[LUSB]:before wait sum
[LUSB]:check sum OKAY
[LUSB]:[AMLC]dataSize=49152, offset=393216, seq 1
[LUSB]:requestType=0
[LUSB]:before wait sum
[LUSB]:check sum OKAY
[LUSB]:[AMLC]dataSize=16384, offset=229376, seq 2
[LUSB]:requestType=0
[LUSB]:before wait sum
[LUSB]:check sum OKAY
[LUSB]:[AMLC]dataSize=49152, offset=245760, seq 3
[LUSB]:requestType=0
[LUSB]:before wait sum
[LUSB]:check sum OKAY
[LUSB]:[AMLC]dataSize=49152, offset=294912, seq 4
[LUSB]:requestType=0
[LUSB]:before wait sum
[LUSB]:check sum OKAY
[LUSB]:[AMLC]dataSize=16384, offset=65536, seq 5
[LUSB]:requestType=0
[LUSB]:before wait sum
[LUSB]:check sum OKAY
[LUSB]:[AMLC]dataSize=1122160, offset=81920, seq 6
[LUSB]:requestType=0
[LUSB]:before wait sum
[LUSB]:check sum OKAY
[LUSB]:BL2 END, waiting TPL plug-in…
< waiting for any device >

OKAY [ 0.005s]
finished. total time: 0.005s
target reported max download size of 117440512 bytes
sending ‘bootloader’ (1175 KB)…
OKAY [ 0.058s]
writing ‘bootloader’…
OKAY [ 0.120s]
finished. total time: 0.183s
erasing ‘bootenv’…
OKAY [ 0.173s]
finished. total time: 0.173s
rebooting into bootloader…
OKAY [ 0.047s]
finished. total time: 0.047s
!!!Flash uboot successfully!!!

1 Like

I can finally flash every images to VIM3.
Thanks @tenk.wang, @zonggestsu for your advices!!

C:\Users\aerop\work\ VIM3_R_AOSP>flash_vim3
..
Transfer Complete! total size is 65536 Bytes
[update]:Run at Addr fffa0000
AmlUsbRunBinCode:ram_addr=fffa0000
[LUSB]:[AMLC]dataSize=16384, offset=65536, seq 0
[LUSB]:requestType=0
[LUSB]:before wait sum
[LUSB]:check sum OKAY
[LUSB]:[AMLC]dataSize=49152, offset=393216, seq 1
[LUSB]:requestType=0
[LUSB]:before wait sum
[LUSB]:check sum OKAY
[LUSB]:[AMLC]dataSize=16384, offset=229376, seq 2
[LUSB]:requestType=0
[LUSB]:before wait sum
[LUSB]:check sum OKAY
[LUSB]:[AMLC]dataSize=49152, offset=245760, seq 3
[LUSB]:requestType=0
[LUSB]:before wait sum
[LUSB]:check sum OKAY
[LUSB]:[AMLC]dataSize=49152, offset=294912, seq 4
[LUSB]:requestType=0
[LUSB]:before wait sum
[LUSB]:check sum OKAY
[LUSB]:[AMLC]dataSize=16384, offset=65536, seq 5
[LUSB]:requestType=0
[LUSB]:before wait sum
[LUSB]:check sum OKAY
[LUSB]:[AMLC]dataSize=1110384, offset=81920, seq 6
[LUSB]:requestType=0
[LUSB]:before wait sum
[LUSB]:check sum OKAY
[LUSB]:BL2 END, waiting TPL plug-in...
< waiting for any device >
...
OKAY [  0.010s]
finished. total time: 0.010s
target reported max download size of 117440512 bytes
sending 'bootloader' (1164 KB)...
OKAY [  0.051s]
writing 'bootloader'...
OKAY [  0.120s]
finished. total time: 0.180s
erasing 'bootenv'...
OKAY [  0.180s]
finished. total time: 0.185s
rebooting into bootloader...
OKAY [  0.010s]
finished. total time: 0.010s
!!!!!!!!Flash uboot successfully!!!!!!!!
!!!!!!!!Press the vim3 board reset key!!!!!!!!
< waiting for any device >
target reported max download size of 117440512 bytes
sending 'boot' (21196 KB)...
OKAY [  0.940s]
writing 'boot'...
OKAY [  1.130s]
finished. total time: 2.070s
target reported max download size of 117440512 bytes
sending sparse 'super' 1/12 (114684 KB)...
OKAY [  5.219s]
writing 'super' 1/12...
OKAY [  6.144s]
sending sparse 'super' 2/12 (101712 KB)...
OKAY [  4.651s]
writing 'super' 2/12...
OKAY [  5.536s]
sending sparse 'super' 3/12 (114500 KB)...
OKAY [  5.212s]
writing 'super' 3/12...
OKAY [  6.433s]
sending sparse 'super' 4/12 (114684 KB)...
OKAY [  5.248s]
writing 'super' 4/12...
OKAY [  6.132s]
sending sparse 'super' 5/12 (114674 KB)...
OKAY [  5.343s]
writing 'super' 5/12...
OKAY [  6.255s]
sending sparse 'super' 6/12 (114684 KB)...
OKAY [  6.004s]
writing 'super' 6/12...
OKAY [  8.830s]
sending sparse 'super' 7/12 (106368 KB)...
OKAY [  4.862s]
writing 'super' 7/12...
OKAY [  5.766s]
sending sparse 'super' 8/12 (114684 KB)...
OKAY [  5.228s]
writing 'super' 8/12...
OKAY [  6.316s]
sending sparse 'super' 9/12 (114684 KB)...
OKAY [  5.242s]
writing 'super' 9/12...
OKAY [  6.242s]
sending sparse 'super' 10/12 (107468 KB)...
OKAY [  4.885s]
writing 'super' 10/12...
OKAY [  5.849s]
sending sparse 'super' 11/12 (104966 KB)...
OKAY [  5.069s]
writing 'super' 11/12...
OKAY [  7.008s]
sending sparse 'super' 12/12 (94052 KB)...
OKAY [  4.316s]
writing 'super' 12/12...
OKAY [  4.980s]
finished. total time: 136.846s
target reported max download size of 117440512 bytes
erasing 'cache'...
OKAY [  0.601s]
sending 'cache' (56 KB)...
OKAY [  0.000s]
writing 'cache'...
OKAY [  0.015s]
finished. total time: 0.616s
target reported max download size of 117440512 bytes
erasing 'userdata'...
OKAY [ 26.500s]
sending 'userdata' (128 KB)...
OKAY [  0.000s]
writing 'userdata'...
OKAY [  0.032s]
finished. total time: 26.547s
target reported max download size of 117440512 bytes
sending 'recovery' (27572 KB)...
OKAY [  1.234s]
writing 'recovery'...
OKAY [  1.424s]
finished. total time: 2.674s
target reported max download size of 117440512 bytes
sending 'dtbo' (8 KB)...
OKAY [ -0.000s]
writing 'dtbo'...
OKAY [ -0.000s]
finished. total time: 0.016s
rebooting...

finished. total time: -0.000s
!!!!!!!!Flash some img successfully!!!!!!!!

1 Like

@aeropia
Is it caused by USB burning tool? Thank you. We’ll pay attention next time.