Error: Init runtime environment failed

I guess NPU is found in the lsusb output.

[toybrick@localhost ~]$ sudo lsusb

Bus 008 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 007 Device 004: ID 2207:180a
Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

But I am not able to run mobilenet_v1 example from the rknn-toolkit-v1.2.0/example/mobilenet_v1/test.py.

[toybrick@localhost mobilenet_v1]$ python3 test.py
–> config model
done
–> Loading model
done
–> Building model
done
–> Export RKNN model
done
–> Init runtime environment
E Using device with adb mode to init runtime, but npu_transfer_proxy is running, it may cause conflict. Please terminate npu_transfer_proxy first.
E Catch exception when init runtime!
T Traceback (most recent call last):
T File “rknn/api/rknn_base.py”, line 769, in rknn.api.rknn_base.RKNNBase.init_runtime
T File “rknn/api/rknn_runtime.py”, line 142, in rknn.api.rknn_runtime.RKNNRuntime.init
T File “rknn/api/rknn_platform_utils.py”, line 265, in rknn.api.rknn_platform_utils.start_ntp_or_adb
T Exception: Init runtime environment failed!
Init runtime environment failed

Edit:
I tried to update the NPU firmware:

[toybrick@localhost mobilenet_v1]$ sudo npu_upgrade MiniLoaderAll.bin uboot.img trust.img boot.img
init gpio: 4
Error writing to /sys/class/gpio/export value=4: Device or resource busy
gpio init
set clk_en 1 to 0
set clk_en 0 to 1
powerup
start to write trust…

Is the firmware update successful? I see an error “writing to /sys/class/gpio/export value=4: Device or resource busy”. Is it fine?

This is the Error:

E Using device with adb mode to init runtime, but npu_transfer_proxy is running, it may cause conflict. Please terminate npu_transfer_proxy first.

I think @setq can explain why it happens.

Hi yokonav,

What OS do you use?

I am using latest fedora image for rockpin10.

Please tell me the content of init_runtime, which is about line 66 of test.py.

Init_runtime has no parameters.

That’s right. I’ll verify that tomorrow.

We have identified the problem and are working to fix and verify it.

Hi yokonav,

We updated the NPU firmware and uploaded the system image.

You can download it and reburn it, or update NPU firmware as follows:

wget https://rock.sh/npu-fw-update -O npu-fw.zip
sudo unzip -o npu-fw.zip -d /
sudo reboot

By the way, you can also use system image, https://dl.radxa.com/rockpin10/images/fedora/rockpin10_fedora_28_server_edition_arm64_20200114_1533-gpt.img.gz.

Thanks @setq, it is fixed now. By the way why loading the python module and building model takes so long to complete?

Model conversion take a long time. You can load the converted model (.rknn) directly and you will find it very fast.