Closed ottojo closed 2 years ago
@ottojo There is no workaround, USB_DeviceNotificationTrigger needs to be offloaded to a thread/workqueue.
@ottojo I can reproduce the error on a RT1064 EVK building the "echo_server" sample with the following command:
west build -p always -b mimxrt1064_evk samples/net/sockets/echo_server -DOVERLAY_CONFIG=overlay-netusb.conf -DCONFIG_ETH_MCUX=n -DCONFIG_ASSERT=y
. On my board, #42019 fixes the issue (per @jfischer-no's suggestion of offloading the ISR to a thread) can you verify that branch works for you?
Describe the bug When using USB networking, the driver accesses networking functions which lock mutexes from ISR context. This leads to failed assertion
mutexes cannot be used inside ISRs.
.ecm_status_cb
is registered as USB status callback here (apparently called via ISR)ecm_status_cb
callsecm_status_interface
hereecm_status_interface
callsnetusb_enable
herenetusb_enable
callsnet_if_up
herenet_if_up
locks mutex herenetusb_enable
callsnet_if_up
hereTo Reproduce (Working on providing a minimal example...)
Expected behavior Assertion should not fail, the interface should not be enabled from ISR context.
Impact The network interface seems to work, but this makes it impossible to me to use
__ASSERT
, since the program can't run withCONFIG_ASSERT
enabled.Logs and console output (WIP)
Environment (please complete the following information):
teensy41