The CPU component in Processor expert does not set the USB to be clocked from PLL as required by MQX USB IO driver.
So if you replace the _bsp_usb_io_init function in init_gpio.c by the following one it will work for both PE and non PE BSPs.
The same patch is valid also for TWR-K60N512 BSP.
_mqx_int _bsp_usb_io_init
(
void
)
{
#if PE_LDD_VERSION
/* USB clock is configured using CPU component */
/* Check if peripheral is not used by Processor Expert USB_LDD component */
if (PE_PeripheralUsed((uint_32)USB0_BASE_PTR) == TRUE) {
/* IO Device used by PE Component*/
return IO_ERROR;
}
#else
/* Configure USBFRAC = 0, USBDIV = 1 => frq(USBout) = 1 / 2 * frq(PLLin) */
SIM_CLKDIV2_REG(SIM_BASE_PTR) &= SIM_CLKDIV2_USBFRAC_MASK | SIM_CLKDIV2_USBDIV_MASK;
SIM_CLKDIV2_REG(SIM_BASE_PTR) |= SIM_CLKDIV2_USBDIV(BSP_USB_DIV) | BSP_USB_FRAC;
#endif
/* Configure USB to be clocked from PLL */
SIM_SOPT2_REG(SIM_BASE_PTR) |= SIM_SOPT2_USBSRC_MASK | SIM_SOPT2_PLLFLLSEL_MASK;
/* Enable USB-OTG IP clocking */
SIM_SCGC4_REG(SIM_BASE_PTR) |= SIM_SCGC4_USBOTG_MASK;
/* USB D+ and USB D- are standalone not multiplexed one-purpose pins */
/* VREFIN for device is standalone not multiplexed one-purpose pin */
#if BSP_USB_TWR_SER2
/* TWR-SER2 board has 2 connectors: on channel A, there is Micro-USB connector,
** which is not routed to TWRK40 board. On channel B, there is standard
** A-type host connector routed to the USB0 peripheral on TWRK40. To enable
** power to this connector, GPIO PB8 must be set as GPIO output
*/
PORT_PCR_REG(PORTB_BASE_PTR, 8) = PORT_PCR_MUX(0x01) | PORT_PCR_PE_MASK;
GPIO_PDDR_REG(PTB_BASE_PTR) |= 0x00000100; // PB8 as output
GPIO_PDOR_REG(PTB_BASE_PTR) |= 0x00000100; // PB8 in high level
#endif
return MQX_OK;
}