Hi Alex,
I found the issue you are facing.
Problem here is that device does not enumerate because descriptors can't be sent. See next image:
As you can see, host requests for GetDescritpor but device is sending buffer with invalid data.
PE generated descriptors (usbDsc1.c) and used const modifier for them:
const uint8_t usbDsc1_FS_DeviceDescriptor[]={
0x12, /* Descriptor size: 18 bytes */
USB_DEVICE_DESCRIPTOR, /* Descriptor type: Device descriptor */
0x00,0x02, /* USB specification release number: USB 2.0 */
0x00, /* Device class code: 0x00 Class information at interface level */
This forces compiler to save this data in Flash (due const modifier), so, when this data is passed to BDT section, this data is "corrupted".
The problem here is that by default, USB does not have permission to read/write to FLASH due crossbar default configuration (M4AP is 00):

As you can see, Master 4 Access Protection (USB) is disabled by default (00) so no write/read can be achieved from FLASH. (For more details consult K22 reference manual: http://cache.freescale.com/files/microcontrollers/doc/ref_manual/K22P121M120SF7RM.pdf?fasp=1&WT_TYPE... l)
You can either store these descriptors in RAM (does not declare them as const) and compile again, or leave them as const but enable read access to Master 4 (USB), you can try adding this line in hardware_init function.
/* Allow read USB from flash */
FMC_PFAPR |= FMC_PFAPR_M4AP(1);
I tried same code using both solutions (not const descriptors and const descriptors but setting M4AP to 1) and they work well.

I hope this can help you
Best Regards,
Isaac Avila
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------