Open shuanglengyunji opened 6 months ago
Update:
I found a walk-around: add sleep between spawner.spawn(usb_task(usb))
and spawner.spawn(usb_ncm_task(runner))
will make it work on ubuntu 22.04.
// Build the builder.
let usb = builder.build();
unwrap!(spawner.spawn(usb_task(usb)));
Timer::after_millis(1000).await; <====== ADD SLEEP HERE
static NET_STATE: StaticCell<NetState<MTU, 4, 4>> = StaticCell::new();
let (runner, device) = class.into_embassy_net_device::<MTU, 4, 4>(NET_STATE.init(NetState::new()), our_mac_addr);
unwrap!(spawner.spawn(usb_ncm_task(runner)));
In debugging it, I found the usb_ncm_task(runner)
has been scheduled before usb_task(usb)
on stm32f407 by the scheduler, although the usb_task
is spawned before the usb_ncm_task
. Adding a sleep before usb_ncm_task
will ensure the usb_task
to be executed first, and it seems to address the problem. However, I still don't understand the root cause of the problem.
Thanks @shuanglengyunji - can confirm the workaround fixes usb_ethernet on stm32h753zi as well :+1:
I run the stm32f4/usb_ethernet example on a stm32f4discovery board with static ip. It works on an iPhone 15 runs IOS17, while doesn't work on ubuntu 22.04 running on DELL Precision 15. On the ubuntu 22.04, I manually configured IP address on the ubuntu, while it shows:
I have also tried:
It works on the iPhone. I had also made it similar implementation work on this board with TinyUSB RNDIS driver. Could someone please give me some direction on debugging it?
On the device log, it shows USB goes into suspend mode on its own:
Thank you all