Issue with NXP USBx Full Speed Configuration on MCXN947-EVK Board

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Issue with NXP USBx Full Speed Configuration on MCXN947-EVK Board

185件の閲覧回数
reeraslan
Contributor I

Hi everyone,

I am currently developing an application on the MCXN947-EVK board, utilizing the USBx library for USB device functionality. The high-speed device implementation, based on the mcxn9xxevk_usbx_device_composite_cdc_acm_cdc_acm example, works perfectly. This example uses the USB1 peripheral with EHCI enabled as defined in usb_device_config.h:

#define USB_DEVICE_CONFIG_EHCI (1U)


My goal is to adapt this application to use the USB0 Full Speed peripheral. Since there are no NXP examples implementing Full Speed with the USBx library, I referred to the NXP SDK API examples.

I used the mcxn9xxevk_dev_cdc_vcom_bm example to configure the KHCI module for USB0. The host can enumerate the device, and everything works fine with:

#define USB_DEVICE_CONFIG_KHCI (1U)


To integrate the SDK USB FS example into the mcxn9xxevk_usbx_device_composite_cdc_acm_cdc_acm project, I performed the following steps:

Enable the Clock:

CLOCK_AttachClk(kCLK_48M_to_USB0);
CLOCK_EnableClock(kCLOCK_Usb0Ram);
CLOCK_EnableClock(kCLOCK_Usb0Fs);
CLOCK_EnableUsbfsClock();


Configure the Device Controller with KHCI0:

_ux_dcd_nxp_dci_initialize(kUSB_ControllerKhci0, &deviceHandle);


Enable the USB0 Interrupt:

#define FS_CONTROLLER_ID kUSB_ControllerKhci0

uint8_t irqNumber;
#if defined(USB_DEVICE_CONFIG_KHCI) && (USB_DEVICE_CONFIG_KHCI > 0U)
uint8_t usbDeviceKhciIrq[] = USBFS_IRQS;
irqNumber = usbDeviceKhciIrq[FS_CONTROLLER_ID - kUSB_ControllerKhci0];
#endif
NVIC_SetPriority((IRQn_Type)irqNumber, USB_DEVICE_INTERRUPT_PRIORITY);
EnableIRQ((IRQn_Type)irqNumber);


Initialize the USBx Library and USB Device Stack (64KB USBX Memory):

status = ux_system_initialize(usbx_memory, USBX_MEMORY_SIZE, nullptr, 0);

status = ux_device_stack_initialize(
ux_get_hs_framework(),
ux_get_hs_framework_length(),
ux_get_fs_framework(),
ux_get_fs_framework_length(),
ux_get_string_framework(),
ux_get_string_framework_length(),
ux_get_language_framework(),
ux_get_language_framework_length(),
nullptr
);

if (status != UX_SUCCESS) {
PRINTF("UX Device Stack Init failed \n\r");
result = COMMAND_FAILED;
} else {
cdc_acm_parameter.ux_slave_class_cdc_acm_instance_activate = usb_insertion_callback;
cdc_acm_parameter.ux_slave_class_cdc_acm_instance_deactivate = usb_device_removal_callback;
cdc_acm_parameter.ux_slave_class_cdc_acm_parameter_change = usb_device_parameter_change_callback;

UCHAR class_name[] = "ACM1";
status = ux_device_stack_class_register(
class_name,
ux_device_class_cdc_acm_entry,
1,
0,
&cdc_acm_parameter
);

if (status != UX_SUCCESS) {
PRINTF("UX Device Stack Class Register Failed \n\r");
result = COMMAND_FAILED;
} else {
result = COMMAND_SUCCESS;
PRINTF("USB Device stack init done\r\n");
}
}

 


When I run the application, the code correctly enters the USB0_FS_IRQ handler:

void USB0_FS_IRQHandler(void) {
USB_DeviceKhciIsrFunction(deviceHandle);
}


However, I encounter an issue where the device fails to set the USB address assigned by the host. This results in an "Unknown USB Device (Set address failed)" error in the Windows Device Manager.

Debugging indicates the device stack stalls at the set address stage. I suspect that the NXP device controller layer (ux_dcd_nxp_dci) might not support USB Full Speed/KHCI mode.

Has anyone else encountered this issue, or can provide guidance on resolving this?

Thank you for your assistance!

reeraslan_0-1719401374346.png

 

ラベル(2)
0 件の賞賛
返信
1 返信

82件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @reeraslan 

Could you please share the project that you have changed according to the USB demo , I help you check on my side. Thanks.

 

BR

Alice

0 件の賞賛
返信