Hello All,
Please find my work environment details below.
RTOS : MQX ver4.1
MCU: MK70FN1M0VMJ15
Hub controller : USB2512 high speed 2-port hub controller and USB3300.
MCU clock : 140Mhz.
About issue :
I'm using 3 CDC devices with usb hub.
To hub,
1. When I connected "device A"(cdc device), creating interrupt pipes ( " _usb_ehci_add_interrupt_xfer_to_periodic_list" function in ehci_main.c) called two times and obtaining Queue Header (QH) successfully.
2. When I connected " device B" (cdc device) , creating interrupt pipes ( " _usb_ehci_add_interrupt_xfer_to_periodic_list" function in ehci_main.c) called three times and obtaining Queue Header (QH) successfully.
3. When I connected " device C" (cdc device) , creating interrupt pipes ( " _usb_ehci_add_interrupt_xfer_to_periodic_list" function in ehci_main.c) called five times and 4 times I'm getting QH handler successfully. The fifth time it called for adding interrupt pipes I'm getting a NULL handler in QH and due to NULL pointer while writing to it MQX throwing an hard fault exception.
I've attached screen shots for your better understanding.
Note:
1. To avoid hard fault, I have modified code which checks QH is Null or not? before writing to it.
2. "device C" is a WIFI + BLE dongle.
3. device A and B are testing usb devices.
Please guide me for solving below points.
Q1. Why I'm getting null QH handler when adding interrupt 5th time?
Q2. How many interrupt pipes MQX usb hub support?
Q3. If QH is nulll, will it make any data lose in USB communication?
I'm looking forward to hearing from you soon.
Thanks in advance.
Hi
There are some configuration parameters in USB stack, so user can achieve smaller USB EHCI footprint.
Please see usb/host/source/include/host_cnfg.h
** Maximum number of allocated QH descriptors.
** MGCT: <option type="number"/>
*/
#ifndef USBCFG_EHCI_MAX_QH_DESCRS
#define USBCFG_EHCI_MAX_QH_DESCRS (8)
#endif
/*
** Maximum number of allocated QTD descriptors.
** MGCT: <option type="number"/>
*/
#ifndef USBCFG_EHCI_MAX_QTD_DESCRS
#define USBCFG_EHCI_MAX_QTD_DESCRS (16)
#endif
MAX_QH_DESCRS: set to number of pipes (endpoints) expected for EHCI.
MAX_QTD_DESCRS: set to number of transfers scheduled in the future.
One CDC class requiring 3 endpoints (2x RX/TX Bulk Transfer + 1x Interrupt), and you also need 2 for control transfer EP0.
For your case, CDC+CDC+CDC, you need 3+3+3=11 endpoints. You can set
USBCFG_EHCI_MAX_QH_DESCRS to 11 at least.
Please modify them and try it again. And let me know whether it helps
If this post is helpful, please mark correct or helpful, thank you very much
Regards
Daniel