I’m trying to get the USB Ethernet (CDC-ECM) example (link to USB example) working on my AMB82-mini with a RTL8152B USB Ethernet dongle, but I’m hitting a wall. The board seems to initialize and sometimes even gets an IP, but the video engine (VOE) keeps failing with a timeout error.
[ECM] USB host ECM demo started...
Enter USB Ethernet host mode
[MEM] After do cmd, available heap 110194752
#
usb otg mode 1
USB_Init
[ECM]Usb Not Setup success,wait...
lwip_status 0 !!
[ECM]Usb Not Setup success,wait...
ecm deinit
[ECM]Usb Not Setup success,wait...
[ECM]Usb Not Setup success,wait...
ecm init fail
_freertos_delete_task(): ptask is NULL!
The bulk_task already deinit
The intr_task already deinit
USB_DeInit
ecm deinit ok
ecm_status 2
_freertos_delete_task(): ptask is NULL!
Sometimes I get this:
[ECM] USB host ECM demo started...
Enter USB Ethernet host mode
[MEM] After do cmd, available heap 110194752
#
usb otg mode 1
USB_Init
[ECM]Usb Not Setup success,wait...
usbh_cdc_ecm_set_ethernet_register_1 60
usbh_cdc_ecm_set_ethernet_register_2 a0
ecm init ok
ecm_status 1
CDC_ECM_NOTIFY_NETWORK_CONNECTION 1
connect
ecm lwip init
mac[00 e0 4c 36 07 40]
Lwip link up
BULK in failed 3
BULK in failed 3
---
---
---
BULK in failed 3
Lwip link down
link to unlink !!
LwIP_DHCP: dhcp stop.It can't get the DHCP
unlink to link !!
USB_DeInit
ecm deinit ok
ecm deinit
And sometimes I get an IP, but the video fails:
[ECM] USB host ECM demo started…
Enter USB Ethernet host mode
[MEM] After do cmd, available heap 110194752
usb otg mode 1
USB_Init
[ECM]Usb Not Setup success,wait…
usbh_cdc_ecm_set_ethernet_register_1 60
usbh_cdc_ecm_set_ethernet_register_2 a0
ecm init ok
ecm_status 1
CDC_ECM_NOTIFY_NETWORK_CONNECTION 1
connect
ecm lwip init
mac[00 e0 4c 36 07 40]
Lwip link up
Interface 2 IP address : 192.168.1.26
[LwIP_DHCP] dhcp offered_t0_lease: 86400DHCP Successful
unlink to link !!
UVID
Enable the video streaming test from ethernet
[MEM] After do cmd, available heap 109334592
[video_voe_presetting] fps:30 w:1920 h:1080
voe heap size = 19897344
fwin(1),enc_en(0),IQ_OFFSET = 0x17940
fwin(1),enc_en(0),SENSOR_OFFSET = 0x2a260
sensor id 1 iq_data 17940 sensor_data 2a260
RTSP[0] port: 554
hal_voe_ready 0x0 0xbf1208
ip = 192.168.1.26
read fcs_status 0x000000bf
[video_init] uvcd iq is null, use default.
[video_init] uvcd SNR is null, use default.
IQ:FW size (76042)
sensor:date 2024/9/12 version:RTL8735B_VOE_1.5.7.0
sensor:FW size (3996)
sensor timestamp: 2024/09/12
iq timestamp: 0000/00/00 00:00:00
voe_heap malloc 0x707ccb40, size 19897344
ISP:1 ENC:1 H265:1 NN:1
hal_voe_ready 0x0 0xbf1208
voe :RTL8735B_VOE_1.7.0.0
sensor:RTL8735B_VOE_1.5.7.0
hal :RTL8735B_VOE_1.7.0.0
load time sensor:53us iq:1054us itcm:0us dtcm:0us ddr:0us ddr2:0us
Set H264 default HIGH profile
rc_version RC_v1
[video_pre_init_procedure] START
hal_voe_send2voe too long 164527 cmd 0x00000206 p1 0x00000000 p2 0x00000000
VOE command 0x206 fail ret 0x0
rtsp stream enabled
[Local] Connected by 192.168.1.100
[Local] Enter rtsp request_loop
check_rtsp_url
No config
rtsp_cmd_options
check_rtsp_url
No config
rtsp_cmd_describe
[Local] REQUEST_PLAY
rtp started (TCP)
BULK in failed 3
[RTSP Err]Receive request len <=0, close socket
[Local] Socket closed
Lwip link down
link to unlink !!
rtp stopped (TCP)
USB_DeInit
ecm deinit ok
ecm deinit
When I try to play the RTSP stream using ffplayIt connects, but I get zero video data.
Any idea why this happens and how to fix this?
And also, how do I go about modifying the code to work with a 4G USB dongle?
Have you tried opening the RTSP stream via VLC player?
Kindly refer to this link for the USB-to-Ethernet adapter that we have tested on our end.
Possible to share which USB Ethernet adapter model or brand you are using?
May I also check if you are using the default JXF37 sensor? We can provide a test firmware for you to try, which may help narrow down whether the issue is related to hardware or the source code.
Support for 4G USB dongles is currently under discussion and development.
Hey @Pammy, thanks for the reply. I am using this QHM8106 USB LAN device. I opened it up and verified it’s using the `RTL8152B` IC inside, and it works with my pc.
The camera is the one that came with the AMB82-mini dev board (which should be JXF37), and I modified the line to #define USE_SENSOR SENSOR_F37 in project/realtek_amebapro2_v0_example/inc/sensor.h.
If you can provide test firmware, I’ll try it out and get back to you with the results.
As I am not able to replicate issue from my end, I will try to assist you based on the provided logs.
The initialization sequence seems to be correct. The device initializes, gets a MAC address, and establishes a network link, but then encounters repeated BULK input failures. This suggests the problem occurs after initial network connection, potentially during data transfer attempts, we suspect something is interrupting the communication between the USB host and the RTL8152 adapter.
One of the reasons could be timing misalignments that leads to incomplete device initialization. While we are looking into this problem, would you mind to test again with this testfw? I have added a small delay before starting the BULK IN transfer as the RTL8152 might need more time after the packet filter is set and before switching over to the transfer state.
UECM
[ECM] USB host ECM demo started…
Enter USB Ethernet host mode
[MEM] After do cmd, available heap 78113536
usb otg mode 1
USB_Init
[ECM]Usb Not Setup success,wait…
usbh_cdc_ecm_set_ethernet_register_1 60
usbh_cdc_ecm_set_ethernet_register_2 a0
ecm init ok
ecm_status 1
CDC_ECM_NOTIFY_NETWORK_CONNECTION 1
connect
ecm lwip init
mac[00 e0 4c 36 07 40]
Lwip link up
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
Lwip link down
link to unlink !!
LwIP_DHCP: dhcp stop.It can’t get the DHCP
unlink to link !!
USB_DeInit
ecm deinit ok
ecm deinit
UECM # << Tried again
[ECM] USB host ECM demo started…
Enter USB Ethernet host mode
[MEM] After do cmd, available heap 78113536
usb otg mode 1
USB_Init
[ECM]Usb Not Setup success,wait…
usbh_cdc_ecm_set_ethernet_register_1 60
usbh_cdc_ecm_set_ethernet_register_2 a0
ecm init ok
ecm_status 1
CDC_ECM_NOTIFY_NETWORK_CONNECTION 1
connect
ecm lwip init
mac[00 e0 4c 36 07 40]
Lwip link up
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
INTR in failed 3
Lwip link down
link to unlink !!
LwIP_DHCP: dhcp stop.It can’t get the DHCP
unlink to link !!
USB_DeInit
ecm deinit ok
ecm deinit
UECM # << Tried again
[ECM] USB host ECM demo started…
Enter USB Ethernet host mode
[MEM] After do cmd, available heap 78113536
usb otg mode 1
USB_Init
[ECM]Usb Not Setup success,wait…
usbh_cdc_ecm_set_ethernet_register_1 60
usbh_cdc_ecm_set_ethernet_register_2 a0
ecm init ok
ecm_status 1
CDC_ECM_NOTIFY_NETWORK_CONNECTION 1
connect
ecm lwip init
mac[00 e0 4c 36 07 40]
Lwip link up
Interface 2 IP address : 192.168.1.35 # << Got IP
write_fast_connect_data_to_flash():not the same ssid/passphrase/channel/offer_ip, write new profile to flash
[LwIP_DHCP] dhcp offered_t0_lease: 86400DHCP Successful
unlink to link !!
Lwip link down #<< But failed again after a few seconds.
link to unlink !!
USB_DeInit
ecm deinit ok
ecm deinit
Thank you for testing. The RTL8152 might require the Ethernet Packet Filter to be set before it can properly receive data on the BULK IN endpoint. The set packet filter process has been skipped previously, I have added it back. Please help to test again with this firmware. If this still does not work, you may consider testing with another USB-Ethernet adapter first while we are verifying the issue.
Please check the comments that I have added in the logs with # <<.
UECM
[ECM] USB host ECM demo started…
Enter USB Ethernet host mode
[MEM] After do cmd, available heap 78114592
usb otg mode 1
USB_Init
[ECM]Usb Not Setup success,wait…
usbh_cdc_ecm_set_ethernet_register_1 60
usbh_cdc_ecm_set_ethernet_register_2 a0
usbh_cdc_ecm_set_ethernet_packetfilter 28
ecm init ok
ecm_status 1
CDC_ECM_NOTIFY_NETWORK_CONNECTION 1
connect
ecm lwip init
mac[00 e0 4c 36 07 40]
Lwip link up
Interface 2 IP address : 192.168.1.39 # << Got the IP
write_fast_connect_data_to_flash():not the same ssid/passphrase/channel/offer_ip, write new profile to flash
[LwIP_DHCP] dhcp offered_t0_lease: 86400DHCP Successful
unlink to link !!
[USBH] Device disconnected, bulk test aborted[0]
[USBH] Device disconnected, intr test aborted[0]
Lwip link down
link to unlink !! # << But disconnected after a few seconds
USB_DeInit
ecm deinit ok
ecm deinit
UECM # << Tried again
[ECM] USB host ECM demo started…
Enter USB Ethernet host mode
[MEM] After do cmd, available heap 78114592
usb otg mode 1
USB_Init
[ECM]Usb Not Setup success,wait…
usbh_cdc_ecm_set_ethernet_register_1 60
usbh_cdc_ecm_set_ethernet_register_2 a0
usbh_cdc_ecm_set_ethernet_packetfilter 28
ecm init ok
ecm_status 1
CDC_ECM_NOTIFY_NETWORK_CONNECTION 1
connect
ecm lwip init
mac[00 e0 4c 36 07 40]
Lwip link up
Interface 2 IP address : 192.168.1.40
# << This time the connection was stable and I could do ping
write_fast_connect_data_to_flash():not the same ssid/passphrase/channel/offer_ip, write new profile to flash
[LwIP_DHCP] dhcp offered_t0_lease: 86400DHCP Successful
unlink to link !!
UVID # << Started streaming
Enable the video streaming test from ethernet
[MEM] After do cmd, available heap 77254432
[video_voe_presetting] fcs fps:30 w:1920 h:1080
voe heap size = 32070912
fwin(1),enc_en(0),IQ_OFFSET = 0x4dc00
fwin(1),enc_en(0),SENSOR_OFFSET = 0x65c40
sensor id 4 iq_data 4dc00 sensor_data 65c40
RTSP[0] port: 554
hal_voe_ready 0x0 0x1718
ip = 192.168.1.40
rc_version RC_v1
The fcs setup is finished
[VOE]load time sensor:254us iq:4587us itcm:1097us dtcm:57us ddr:12382us ddr2:11302us
[VOE]VOELOAD(18377)/FCS(43527)/ISPReady(26326)/FrameDone(88769) KMRST(143839) us
fcs_start_time 66 fcs_voe_time 75 frame_done_time 163
g_enc_buff_size 0 = 2356352
g_enc_buff_size 1 = 1163776
g_enc_buff_size 2 = 8
[VID Wrn]
CH 0 MMF ENC Queue full
[VID Wrn]
CH 0 MMF ENC Queue full
[VID Wrn]
CH 0 MMF ENC Queue full
----
----
----
----
----
[VID Wrn]
CH 0 MMF ENC Queue full
rtsp stream enabled
[Local] Connected by 192.168.1.100
[Local] Enter rtsp request_loop
check_rtsp_url
No config
rtsp_cmd_options
check_rtsp_url
No config
rtsp_cmd_describe
[Local] REQUEST_PLAY
rtp started (UDP) # << I was able to stream for a few minutes
ch = 0 sf:901 df:0 l:0%
[RTSP Err]Receive request len <=0, close socket
[Local] Socket closed
Lwip link down
link to unlink !!
rtp stopped (UDP) # << Then It disconnected by itself
USB_DeInit
ecm deinit ok
ecm deinit
Thanks for verifying, the fix resolves the initial “BULK in failed 3” error. The occasional disconnection after extended use may be due to USB power management or RTL8152 suspend mode, which would require additional keepalive mechanisms to fully resolve. I have added another 50ms delay before setting packet filter to ensure the device is ready. Please test again with this test firmware and let us know the outcome.
UECM
[ECM] USB host ECM demo started…
Enter USB Ethernet host mode
[MEM] After do cmd, available heap 78114592
usb otg mode 1
USB_Init
[ECM]Usb Not Setup success,wait…
usbh_cdc_ecm_set_ethernet_register_1 60
usbh_cdc_ecm_set_ethernet_register_2 a0
usbh_cdc_ecm_set_ethernet_packetfilter 28
ecm init ok
ecm_status 1
CDC_ECM_NOTIFY_NETWORK_CONNECTION 1
connect
ecm lwip init
mac[00 e0 4c 36 07 40]
Lwip link up
BULK in failed 3, hc_state=0
Lwip link down
link to unlink !!
LwIP_DHCP: dhcp stop.It can’t get the DHCP
unlink to link !!
USB_DeInit
ecm deinit ok
ecm deinit
UECM
[ECM] USB host ECM demo started…
Enter USB Ethernet host mode
[MEM] After do cmd, available heap 78114592
usb otg mode 1
USB_Init
[ECM]Usb Not Setup success,wait…
usbh_cdc_ecm_set_ethernet_register_1 60
usbh_cdc_ecm_set_ethernet_register_2 a0
usbh_cdc_ecm_set_ethernet_packetfilter 28
ecm init ok
ecm_status 1
CDC_ECM_NOTIFY_NETWORK_CONNECTION 1
connect
ecm lwip init
mac[00 e0 4c 36 07 40]
Lwip link up
Lwip link down
link to unlink !!
LwIP_DHCP: dhcp stop.It can’t get the DHCP
unlink to link !!
USB_DeInit
ecm deinit ok
ecm deinit
UECM
[ECM] USB host ECM demo started…
Enter USB Ethernet host mode
[MEM] After do cmd, available heap 78114592
usb otg mode 1
USB_Init
[ECM]Usb Not Setup success,wait…
usbh_cdc_ecm_set_ethernet_register_1 60
usbh_cdc_ecm_set_ethernet_register_2 a0
usbh_cdc_ecm_set_ethernet_packetfilter 28
ecm init ok
ecm_status 1
lwip_status 0 !!
USB_DeInit
ecm deinit ok
ecm deinit
UECM
[ECM] USB host ECM demo started…
Enter USB Ethernet host mode
[MEM] After do cmd, available heap 78114592
usb otg mode 1
USB_Init
[ECM]Usb Not Setup success,wait…
usbh_cdc_ecm_set_ethernet_register_1 60
usbh_cdc_ecm_set_ethernet_register_2 a0
usbh_cdc_ecm_set_ethernet_packetfilter 28
ecm init ok
ecm_status 1
CDC_ECM_NOTIFY_NETWORK_CONNECTION 1
connect
ecm lwip init
mac[00 e0 4c 36 07 40]
Lwip link up
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
INTR in failed 3
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
INTR in failed 3
Interface 2 IP address : 192.168.1.44
write_fast_connect_data_to_flash():not the same ssid/passphrase/channel/offer_ip, write new profile to flash
[LwIP_DHCP] dhcp offered_t0_lease: 86400DHCP Successful
unlink to link !!
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
INTR in failed 3
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
INTR in failed 3
BULK in failed 3, hc_state=0
BULK in failed 3, hc_state=0
Lwip link down
link to unlink !!
USB_DeInit
ecm deinit ok
ecm deinit