HiKey620: In recovery mode there is no ttyUSB devices available

We got the HiKey960, board for some testing. However, we are running into issues.
In the process of AOSP fastboot interrupted in the middle of it and I got this output

target reported max download size of 524288000 bytes sending ‘xloader’ (151 KB)…
OKAY [ 0.013s]
writing ‘xloader’…
FAILED (remote: No such partition.)
finished. total time: 0.016s
target reported max download size of 524288000 bytes sending ‘ptable’ (196 KB)…
OKAY [ 0.018s]
writing ‘ptable’…
FAILED (remote: Error flashing partition.) finished. total time: 0.020s target reported max download size of 524288000 bytes sending ‘fastboot’ (3346 KB)…
OKAY [ 0.214s]
writing ‘fastboot’…
OKAY [ 0.121s]
finished. total time: 0.335s
rebooting into bootloader…
OKAY [ 0.001s]
finished. total time: 0.051s
< waiting for device > The process of the fastboot interrupted in the middle of it and I got this output
target reported max download size of 524288000 bytes sending ‘xloader’ (151 KB)…
OKAY [ 0.013s]
writing ‘xloader’…
FAILED (remote: No such partition.)
finished. total time: 0.016s
target reported max download size of 524288000 bytes sending ‘ptable’ (196 KB)…
OKAY [ 0.018s]
writing ‘ptable’…
FAILED (remote: Error flashing partition.) finished. total time: 0.020s target reported max download size of 524288000 bytes sending ‘fastboot’ (3346 KB)…
OKAY [ 0.214s]
writing ‘fastboot’…
OKAY [ 0.121s]
finished. total time: 0.335s
rebooting into bootloader…
OKAY [ 0.001s]
finished. total time: 0.051s
< waiting for device >

I have tried to recover the board by using the recovery mode.
However, there is no “ttyUSB devices” available after connecting the MicroUSB to my Host PC and powering the board on.

Here is my dmeg log.

[72124.769092] usb 7-1: new full-speed USB device number 19 using uhci_hcd
[72124.924204] usb 7-1: New USB device found, idVendor=12d1, idProduct=3609, bcdDevice= 0.00
[72124.924210] usb 7-1: New USB device strings: Mfr=1, Product=4, SerialNumber=0
[72124.924215] usb 7-1: Product: \xffffffe3\xffffff84\xffffffb0㌲㔴㜶㤸
[72124.924219] usb 7-1: Manufacturer: 䕇䕎䥎

I connected UART YP-01 adapter to the HiKey board’s DGND, UART3_RX, UART3_TX to my Host PC

|J1802-01|DGND|
|J1802-13|UART3_RX|
|J1802-11|UART3_TX|

And got the following dmegs
[73208.325204] usb 7-2: new full-speed USB device number 20 using uhci_hcd
[73208.484366] usb 7-2: New USB device found, idVendor=067b, idProduct=2303, bcdDevice= 3.00
[73208.484373] usb 7-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[73208.484377] usb 7-2: Product: USB-Serial Controller
[73208.484381] usb 7-2: Manufacturer: Prolific Technology Inc.
[73208.486516] pl2303 7-2:1.0: pl2303 converter detected
[73208.498664] usb 7-2: pl2303 converter now attached to ttyUSB0

So now I get ttyUSB0 through the UART
Using this readme “Board Recovery for HiKey960 - 96Boards
I have tried to recover the board but unsuccessful. I get the following output after running

sudo ./hikey_idt -c config -p /dev/ttyUSB0
this command

Config name: config
Port name: /dev/ttyUSB0
0: Image: hisi-sec_usb_xloader.img Downalod Address: 0x20000
1: Image: hisi-sec_uce_boot.img Downalod Address: 0x6a908000
2: Image: recovery.bin Downalod Address: 0x1ac00000
Serial port open successfully!
Start downloading hisi-sec_usb_xloader.img@0x20000…
file total size 99584
downlaod address 0x20000
retry: ack 0, len 0, err 0
retry: ack 0, len 0, err 5
retry: ack 0, len 0, err 5
retry: ack 0, len 0, err 5
retry: ack 0, len 0, err 5
retry: ack 0, len 0, err 5
retry: ack 0, len 0, err 5
retry: ack 0, len 0, err 5
retry: ack 0, len 0, err 5
retry: ack 0, len 0, err 5
retry: ack 0, len 0, err 5
retry: ack 0, len 0, err 5
retry: ack 0, len 0, err 5
retry: ack 0, len 0, err 5
retry: ack 0, len 0, err 5
retry: ack 0, len 0, err 5
send raw data failure

I tried another way by this link (https://android.googlesource.com/device/linaro/hikey/+/master/installer/hikey/README)
after running “./flash-all.sh /dev/ttyUSB0” or “./flash-all.sh /dev/ttyUSB0 [4g]” comands I get this output.

android out dir:./…/…/…/…/…/
< waiting for device >

Could you please help to get these issues solwed.

Regards,
Artur

Hi @arturp,

Sorry for the inconvenience. Couple of things:

  1. For flashing the recovery images to HiKey960, you need to connect USB-A to Type-C cable from PC to HiKey960. Then you need to set the switch at the back side of the board(near PCIE-M.2 connector) to 1-0-1.
    After this, when you power on Hikey960, you should get ttyUSB0 port on your PC which should be used for flashing.

  2. If you want to access debug console, then you need to either connect 1.8v compatible debug adapter to UART6 Tx and UART6 Rx (available at LS connector pins 11 and 13). Since HiKey960’s signal voltage level is 1.8v, you should not connect 3.3/5v adapters.

Hope this helps you in debugging the DWC USB issue :slight_smile:

Thanks,
Mani

Hi Mani,

Thanks for the quick reply.

In my case, I connect USB-A to MicroUSB cable from PC to HiKey960. Because the port on the board is MicroUSB.
in my case there is no switch on the back side there are only jumpers.
and according to (https://github.com/96boards/documentation/tree/master/consumer/hikey/hikey960/getting-started)

Your HiKey960 has 3 modes: normal, fastboot and recovery .

|Name |Link / Switch| Recovery Mode|

|Auto Power up |Link 1-2 / Switch 1| closed / ON|
|Recovery |Link 3-4 / Switch 2| closed / ON|
|Fastboot |Link 5-6 / Switch 3| open / OFF|
So for jumpers it will be 1,1,0 for the Recovery Mode. Not 1-0-1 as you suggest. 1-0-1 is the Fastboot mode according to documentation.

So I have done all of the things you suggested.
No success.

Regards,
Artur

Hi @arturp,

In my case, I connect USB-A to MicroUSB cable from PC to HiKey960. Because the port on the board is MicroUSB.

Ahh, okay. Then you should be having HiKey board and not HiKey960. Both consists of different SoCs from HiSilicon, Hi6220 and Hi3660.

For HiKey, you should use the recovery instructions mentioned here: BoardRecovery for HiKey - 96Boards

Thanks,
Mani

When I connect the usb there is no /dev/ttyUSB0 avalable.

This is the output I get from your suggestion

sudo python hisi-idt.py -d /dev/ttyUSB0 --img1 recovery.bin
±---------------------+
(’ Serial: ‘, ‘/dev/ttyUSB0’)
(’ Image1: ‘, ‘recovery.bin’)
(’ Image2: ', ‘’)
±---------------------+

(‘Sending’, ‘recovery.bin’, ‘…’)
failed
failed

THIS IS DONE USING THE UART’s PROVIDED /dev/ttyUSB0 port. NOT NOT the port that USB has provided.

There is no “ttyUSB devices” available after connecting the MicroUSB to my Host PC and powering the board on.

Regards,
Artur

@arturp

Please see the image for recovery mode’s jumper configuration.

https://unsee.cc/e0d429ce/

Thanks,
Mani

@Mani

Yup that is the way I have my jumper configuration.

Regards,
Artur

Hmm. Can you please try removing the ModemManager package from your PC and power ON the board again?

sudo apt-get purge modemmanager

I did it. However, the behavior is that same.
This is the dmesg log

[ 117.155660] usb 7-1: new full-speed USB device number 2 using uhci_hcd
[ 117.307862] usb 7-1: New USB device found, idVendor=12d1, idProduct=3609, bcdDevice= 0.00
[ 117.307869] usb 7-1: New USB device strings: Mfr=1, Product=4, SerialNumber=0
[ 117.307873] usb 7-1: Product: \xffffffe3\xffffff84\xffffffb0㌲㔴㜶㤸
[ 117.307877] usb 7-1: Manufacturer: 䕇䕎䥎

Regards,
Artur

This cannot possibly work. hisi-idt.py must be directed to use the device node that appears when you connect the micro-B socket on the main board to your PC (the one that disappears again after 90 seconds if you fail to launch hisi-idt.py quickly enough).

@danielt

So yes I do think so too. But I was trying to somehow overcome the issue so the only thing I could see after so much work, was the /dev/ttyUSB0 provided using the UART.

I don’t know how to overcome this issue and get the bord working.

Regards,
Artur

[ 117.155660] usb 7-1: new full-speed USB device number 2 using uhci_hcd
[ 117.307862] usb 7-1: New USB device found, idVendor=12d1, idProduct=3609, bcdDevice= 0.00
[ 117.307869] usb 7-1: New USB device strings: Mfr=1, Product=4, SerialNumber=0
[ 117.307873] usb 7-1: Product: \xffffffe3\xffffff84\xffffffb0㌲㔴㜶㤸
[ 117.307877] usb 7-1: Manufacturer: 䕇䕎䥎

From your dmesg log, it looks like the USB device is recognized but the modem port is not detected. I would suggest you to install gsm-utils:

sudo apt-get install gsm-utils

@Mani

following your suggestion, I have installed gsm-utils.
But still the result is the same :frowning:

following your suggestion, I have installed gsm-utils.
But still the result is the same :frowning:

Are you sure that the required USB packages are installed on your PC? Like usbserial? Also, can you please try the following workaround?

sudo modprobe usbserial vendor=0x12d1 product=0x3609

Likewise what distro are you running on the PC and have you compiled a custom kernel?

I did this and now I can see ttyUSB1 through usb.
This is the dmesg log
[24671.417241] usb 7-1: new full-speed USB device number 14 using uhci_hcd
[24671.572403] usb 7-1: New USB device found, idVendor=12d1, idProduct=3609, bcdDevice= 0.00
[24671.572410] usb 7-1: New USB device strings: Mfr=1, Product=4, SerialNumber=0
[24671.572414] usb 7-1: Product: \xffffffe3\xffffff84\xffffffb0㌲㔴㜶㤸
[24671.572417] usb 7-1: Manufacturer: 䕇䕎䥎
[24671.574575] usbserial_generic 7-1:1.0: The “generic” usb-serial driver is only for testing and one-off prototypes.
[24671.574579] usbserial_generic 7-1:1.0: Tell linux-usb@vger.kernel.org to add your device to a proper driver.
[24671.574584] usbserial_generic 7-1:1.0: generic converter detected
[24671.574974] usb 7-1: generic converter now attached to ttyUSB1

Using this link you have provided I started the recovery process.
But there are issues.

sudo python hisi-idt.py -d /dev/ttyUSB1 --img1 recovery.bin
±---------------------+
(’ Serial: ‘, ‘/dev/ttyUSB1’)
(’ Image1: ‘, ‘recovery.bin’)
(’ Image2: ', ‘’)
±---------------------+

Traceback (most recent call last):
File “hisi-idt.py”, line 272, in
main(sys.argv[1:])
File “hisi-idt.py”, line 269, in main
burnboot(‘hi3716cv200’, dev, img1, img2)
File “hisi-idt.py”, line 200, in burnboot
downloader = bootdownload(chiptype, serialport)
File “hisi-idt.py”, line 76, in init
self.s = serial.Serial(port=serialport, baudrate=115200, timeout=1)
File “/usr/lib/python2.7/dist-packages/serial/serialutil.py”, line 180, in init
self.open()
File “/usr/lib/python2.7/dist-packages/serial/serialposix.py”, line 311, in open
self._update_dtr_state()
File “/usr/lib/python2.7/dist-packages/serial/serialposix.py”, line 605, in _update_dtr_state
fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_DTR_str)
IOError: [Errno 22] Invalid argument
Exception AttributeError: “‘bootdownload’ object has no attribute ‘s’” in <bound method bootdownload.del of <main.bootdownload object at 0x7f5aa61795d0>> ignored

So I have read on some comments on the web that this script works only with Python 2.7
So I check my Python version is Python 2.7.12.

Hi @arturp,

As spotted by @danielt, the USB driver used by the HiKey is option and is selected using CONFIG_USB_SERIAL_OPTION Kconfig symbol. By default most of the distros include it as a loadable module and it gets loaded during boot. But in your case, seems like this module is not properly loaded. Can you please confirm this?

$ lsmod | grep option

This should show the presence of the module. If nothing is displayed then you might want to rebuild your PC kernel with this module enabled.

Thanks,
Mani

@Mani

HI Mani,

Thank you so much. I compiled my kernel with the CONFIG_USB_SERIAL_OPTION set.
and I have got the GSM and all that I needed to recover the board.

And the recovery process was successful.

But, now I am looking for a way to install a kernel that I have built to test my USB driver.
Is that a flow that you would suggest?

Regards,
Artur

Hi @arturp,

Glad to hear that you have recovered HiKey board. For testing the kernel, I would suggest you to install the debian image first as per below link and do a full update:

Once debian is installed on Hikey, then you can just update the kernel (as a debian package) by following the below guide:

Thanks,
Mani

Were you running a custom kernel or was this option not enabled in your distro?