Hikey board recovery not working


#1

I have a Hikey board that is is not entering fastboot mode when I close jumper 5-6. When I power on the board, I see this on the serial port (/dev/ttyUSB0):

debug EMMC boot: print init OK
debug EMMC boot: send RST_N .
debug EMMC boot: start eMMC boot......
load fastboot1!

I have a micro-USB cable connected to my laptop. Running “sudo fastboot devices” on my laptop’s shell prompt returns nothing.

So I thought I’d reinstall the board from scratch and I’m following the instructions here:

https://github.com/96boards/documentation/blob/master/ConsumerEdition/HiKey/Installation/BoardRecovery.md

I boot the board with jumper 1-2 and 3-4 closed and when I power the board on, I see this on the serial port:

usb reset intr
reset device done.
start enum.
enum done intr
Enum is starting.
usb reset intr
enum done intr
NULL package
NULL package
USB ENUM OK.
init ser device done....
USB:: Err!! Unknown USB setup packet!
NULL package

Then I run the commands to recover the board using the 16.06 release and I see this on my terminal:
(I put the commands into a script, so the + lines are the commands that are run)

+ sudo python hisi-idt.py -d /dev/ttyUSB1 --img1=l-loader.bin
+----------------------+
(' Serial: ', '/dev/ttyUSB1')
(' Image1: ', 'l-loader.bin')
(' Image2: ', '')
+----------------------+

('Sending', 'l-loader.bin', '...')
Done

+ ret=0
+ '[' 0 '!=' 0 ']'
+ sudo fastboot flash ptable ptable-linux-4g.img
< waiting for any device >
target reported max download size of 268435456 bytes
sending 'ptable' (17 KB)...
OKAY [  0.002s]
writing 'ptable'...
OKAY [  0.509s]
finished. total time: 0.511s
+ '[' 0 '!=' 0 ']'
+ sudo fastboot flash fastboot fip.bin
target reported max download size of 268435456 bytes
sending 'fastboot' (1382 KB)...
OKAY [  0.059s]
writing 'fastboot'...
OKAY [  0.701s]
finished. total time: 0.760s
+ sudo fastboot flash nvme nvme.img
target reported max download size of 268435456 bytes
sending 'nvme' (128 KB)...
OKAY [  0.006s]
writing 'nvme'...
OKAY [  0.516s]
finished. total time: 0.522s
+ sudo fastboot flash boot hikey-boot-linux-20160629-120.uefi.img
target reported max download size of 268435456 bytes
sending 'boot' (65536 KB)...
OKAY [  2.650s]
writing 'boot'...
OKAY [  9.703s]
finished. total time: 12.352s
+ '[' 0 '!=' 0 ']'
+ sudo fastboot devices
0123456789ABCDEF	fastboot
+ '[' 0 '!=' 0 ']'

Meanwhile, I see this additional output on the serial port:

USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
uFileAddress=ss=f9800800

So I power off the board, move jumper 3-4 across to 5-6, power on and I see this on the serial port:

debug EMMC boot: print init OK
debug EMMC boot: send RST_N .
debug EMMC boot: start eMMC boot......
load fastboot1!

I also see the same output if I power the board on with only jumper 1-2 closed.
At this point, “sudo fastboot devices” returns nothing.

Any advice on what to do next?


#2

Hi there,

I saw you have burned boot images successfully on the target. But you are using wrong UART port, I think you are using J16 on the board for UART port, this port is output from SoC bootROM. After the boot images have been burned successfully and close jumper 1-2, and open jumper 3-4, 5-6, you could see the output log from UART3 (aka. LS Expansion UART1): https://www.seeedstudio.com/96Boards-UART-p-2525.html

Thanks,
Leo Yan


#3

Hi Leo,

Thanks for letting me know about the serial port output moving to UART3. Unfortunately, I don’t have access to it, so I can’t tell if it’s working or not.

But fastboot mode isn’t working when I close jumper 5-6, so I’m unable to flash my board with something useful. Am I supposed to do something on UART3 for fastboot to work?

Thanks,
Ryan.


#4

Hi Ryan,

Looks like you did everything right so not sure what could be the problem here. It shouldn’t matter anyway but just curious if you have anything connected to the regular usb ports like a mouse and/or keyboard?

In any case, you can obviously get to fastboot mode via recovery (1-2, 3-4 closed and after running hisi-idt), but not via uefi (1-2, 5-6 closed and reboot). It would be somewhat inconvenient, but a workaround is to get into fastboot mode via recovery every time you need to flash some images of your own, flash the images, power off, remove the 3-4 jumper and boot up again to the images you just flashed.

Btw, where did you get your fip.bin from? If it’s not from http://builds.96boards.org/releases/reference-platform/debian/hikey/16.06/bootloader/fip.bin, please try flashing fip.bin again with the one from this link to see if it helps.

Good luck!


#5

Hi Victor,

"curious if you have anything connected to the regular usb ports"
No, nothing connected at all. I have an SD card plugged in with the 16.06 ALIP image on it.

"workaround is to get into fastboot mode via recovery every time you need to flash"
I have to admit, I didn’t try that. I assumed it wouldn’t work, saying as flashing the recovery didn’t work either.

"where did you get your fip.bin from?"
I got it from the 16.06 release link, same one as you posted. I downloaded everything from the 16.06 release before I started.

I’ll try to put the board into fastboot via recovery and flash hikey-rootfs-debian-jessie-alip-20160629-120.emmc.img.

Thanks,
Ryan.


#6

So I flashed the emmc ALIP image, it seemed to work:

$ sudo fastboot flash system hikey-rootfs-debian-jessie-alip-20160629-120.emmc.img
target reported max download size of 268435456 bytes
sending sparse ‘system’ 1/8 (262140 KB)…
OKAY [ 10.770s]
writing ‘system’ 1/8…
OKAY [ 38.785s]
sending sparse ‘system’ 2/8 (262140 KB)…
OKAY [ 10.570s]
writing ‘system’ 2/8…
OKAY [ 38.415s]
sending sparse ‘system’ 3/8 (262140 KB)…
OKAY [ 10.523s]
writing ‘system’ 3/8…
OKAY [ 38.416s]
sending sparse ‘system’ 4/8 (262140 KB)…
OKAY [ 10.609s]
writing ‘system’ 4/8…
OKAY [ 38.412s]
sending sparse ‘system’ 5/8 (262140 KB)…
OKAY [ 10.642s]
writing ‘system’ 5/8…
OKAY [ 38.373s]
sending sparse ‘system’ 6/8 (262140 KB)…
OKAY [ 10.602s]
writing ‘system’ 6/8…
OKAY [ 38.599s]
sending sparse ‘system’ 7/8 (256552 KB)…
OKAY [ 10.263s]
writing ‘system’ 7/8…
OKAY [ 39.691s]
sending sparse ‘system’ 8/8 (200704 KB)…
OKAY [ 8.059s]
writing ‘system’ 8/8…
OKAY [ 29.438s]
finished. total time: 382.165s

Now, I remove jump 3-4 and power cycle the board with a HDMI monitor and mouse plugged in and I’m seeing nothing. How do I tell if the board is working?


#7

Hi Ryan,

But fastboot mode isn’t working when I close jumper 5-6, so I’m unable to flash my board with something
useful. Am I supposed to do something on UART3 for fastboot to work?

If close jumper 5-6 and reset the board, the board will automatically run into fastboot mode. I can see the info with “fastboot devices”. Could you check one thing is: in your boot image, could you confirm you have included fastboot stub in it? I’m not quite sure this is problem or not, but it’s the only thing I can think may introduce issue.

Thanks,
Leo Yan


#8

Hi Leo,

I’m using the images from 16.06, I haven’t built my own. How do I check if they have fastboot in them?


#9

"I assumed it wouldn’t work, saying as flashing the recovery didn’t work either."
Flashing images from recovery seems to be working fine. It’s just getting the pc to see the device in fastboot mode (1-2, 5-6) after a reboot seems to be the problem.

"How do I tell if the board is working?"
The only think I can think of is to perhaps try removing the SD card but at this point it does seem like access to the uart3 serial console would be very helpful.

"How do I check if they have fastboot in them?"
The 16.06 boot image should have the fastboot stub in it. Perhaps you can run a checksum on it to verify you don’t have a corrupted download? I got c60a9188be75111b0fe1f93bff750541 on the .gz file.


#10

I have checked the boot image: http://builds.96boards.org/releases/hikey/linaro/aosp/latest/boot_fat.uefi.img.tar.xz,

it has included fastboot stub and by default it should boot kernel for Android. You could use below command to check the boot image:

tar xvf boot_fat.uefi.img.tar.xz
mkdir boot-fat
sudo mount -o loop,rw,sync boot-linux.uefi.img boot-fat

Edit what you want

sudo umount boot-fat/

Could you try my uploaded file boot_fat.uefi.img: http://people.linaro.org/~leo.yan/boot_fat.uefi.img.tgz, after download you could use command: tar zxvf boot_fat.uefi.img.tgz then to burn it. Which I change console from ttyAMA3 to ttyAMA0 in grub.cfg. so it’s possible you can see log if kernel is booting on uart port you are using. And if kernel is booting, usually you can see the LED lights between two USB host port.

Thanks,
Leo Yan


#11

Yes, that did it! Thanks :slight_smile:

It doesn’t like my (very old) HDMI monitor, the display only shows occasionally. I’ll try a different monitor. But I can see that I have a desktop flashing up every few seconds, so it’s booted!

Yes, I get the same checksum.


#12

Hi Leo,
Thanks for doing that. I don’t think I need it, though, because Victor’s help has got the ALIP image booting for me.
Mind you, if I ever want to flash the board again, I could be back in trouble…


#13

Cool! So please ignore my replying :slight_smile:


#14

Actually Leo just provided a great (free! :D) way for you to get access to the serial console, so you can try to debug the fastboot devices issue IF you want to. If you can get it to work, it’s much easier than flashing from recovery each time, especially if you have to do it a lot for development.

We used to recommend creating /etc/udev/rules.d/51-android.rules in the pc with the following contents to try to get fastboot mode to work. You don’t really need it though since you’re using sudo with fastboot devices, but just wondering if it might just make a difference.

# fastboot protocol on HiKey
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="d00d", MODE="0666"
# adb/rndis protocol on HiKey
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"

#15

Hi Victor/Leo,

Just for information…

Now that I have the ALIP image flashed and working, fastboot mode works on the board when I power on with jump 5-6 closed.

Very strange, but at least it’s working again.

Thanks for all your help!