AnsweredAssumed Answered

USB0 - K60 - MQX4.2 - Only works with debugger attached.

Question asked by Jason Scott on Mar 8, 2018
Latest reply on Mar 15, 2018 by Jason Scott

Good Afternoon,


Hopefully someone can give me a pointer or two on the enumeration of USB0 on the k60.


Brief background:

MQX Version: 4.2 Not using process expert.

Custom board: using the k60 processor has been tested and the USB circuit works with our boot-loader fine.

Using USB Host.


Every time i plug in a USB stick the KHCI task detects the usb as being attached and returns that it has been successful, but the usb_host_mass_device_event is not triggered.


However, it works fine with the debugger attached, and i am able to get usb_host_mass_device_event to trigger as expected.


I suspect that the clock is not properly being enabled to the usb module without using the debugger.


Here is my BSP USB init. 


Can anyone tell me what I am overlooking?


_mqx_int _bsp_usb_io_init
/* USB clock is configured using CPU component */

/* Check if peripheral is not used by Processor Expert USB_LDD component */
if (PE_PeripheralUsed((uint32_t)USB0_BASE_PTR) == TRUE) {
/* IO Device used by PE Component*/
return IO_ERROR;

* Workaround for Processor Expert as USB clock divider settings has been removed
* from __pe_initialize_hardware() and Cpu_SetClockConfiguration() functions
* Needs to be replaced by dynamic calculation of dividers.
SIM_CLKDIV2 = (uint32_t)((SIM_CLKDIV2 & (uint32_t)~0x0DUL) | (uint32_t)0x02UL); /* Update USB clock prescalers */

/* Configure USB to be clocked from PLL */

/* Enable USB-OTG IP clocking */

/* USB D+ and USB D- are standalone not multiplexed one-purpose pins */
/* VREFIN for device is standalone not multiplexed one-purpose pin */

/* Configure Port A28 as USBPower Switch Enable */
PORTA_PCR28 = PORT_PCR_MUX(1) | PORT_PCR_SRE_MASK; /* Slow slew rate */
GPIOA_PSOR |= 1 << 28;
GPIOA_PDDR |= 1 << 28;
GPIOA_PCOR |= 1 << 28; /* Enable USB Output voltage */
/* END_VM_MOD}}*/

return MQX_OK;