Hi ,
I'm using zephyr 4.0.0 an tried to run some samples with USB device stack next an encounter following error
however I ran some samples with old usb device stack.
I would like to know if this is the expected behavior as of this zephyr version or am I missing something
Thanks Daniel, I follow the issue. I was about to create a issue on git
Wimansha
Hi,
I found the following issue in the Github repo NXP USB drivers don't work with usb_next · Issue #86409 · zephyrproject-rtos/zephyr. Looks like this has already been reported.
Could you please confirm is the same issue?
Regards,
Daniel
Hi Daniel,
I tried it with zephyr 4.1.0,
still seen the same error code, according to 4.1.0 migration guide not much been change in zephyr USB side
If I use HID-mouse as it is USB stack is initializing properly and I can see device enumeration on host.
Wimansha
Hi,
If you use the HID mouse example as is, does it work?
Could you please try using Zephyr 4.1.0?
Is this custom code? If not, could you please point me where did you get it?
Regards,
Daniel.
Hi Daniel ,
Thank you for getting back to me .
I tried the following
1. use the hid-mouse example as it is with usbd_next_proj.conf
2. use with loopback class
1. proj.conf
#include "sample_usbd.h"
/*located on zephyrproject/zephyr/samples/subsys/usb/common*/
#include
#include
#include
LOG_MODULE_REGISTER(app, LOG_LEVEL_DBG);
static void msg_cb(struct usbd_context *const usbd_ctx,
const struct usbd_msg *const msg) {
LOG_INF("USBD message: %s", usbd_msg_type_string(msg->type));
if (usbd_can_detect_vbus(usbd_ctx)) {
if (msg->type == USBD_MSG_VBUS_READY) {
if (usbd_enable(usbd_ctx)) {
LOG_ERR("Failed to enable device support");
}
}
if (msg->type == USBD_MSG_VBUS_REMOVED) {
if (usbd_disable(usbd_ctx)) {
LOG_ERR("Failed to disable device support");
}
}
}
}
int main(void) {
struct usbd_context *sample_usbd;
int ret;
sample_usbd = sample_usbd_init_device(msg_cb);
if (sample_usbd == NULL) {
k_msleep(100);
return 0;
}
if (!usbd_can_detect_vbus(sample_usbd)) {
ret = usbd_enable(sample_usbd);
{
if (ret) {
LOG_ERR("Failed to enable usb support !");
return ret;
}
}
}
return 0;
} in both cases I got
after tracing the issue back I pin point the error to udc_mcux_init(...) function located in drivers/usb/udc/udc_mcux_ehci.c
to narrow it further
/* Init MCUX USB device driver. */
status = mcux_if->deviceInit(priv->controller_id,
&priv->mcux_device, &(priv->mcux_device.controllerHandle));
if (status != kStatus_USB_Success) {
return -ENOMEM;
}Hi,
What example are you testing?
Could you please share some reproduction steps?
Regards,
Daniel.