USB Enumeration Fails

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB Enumeration Fails

1,812 Views
leifzars
Contributor IV

I am trying to use a K24 with MQX 4.2 to act as a USB composite device with a virtual comm and a mass storage device.

I used this demo C:\Freescale\Freescale_MQX_4_2\usb_v2\example\device\composite\msd_cdc

It fails during the enumeration process, and I am stuck.

Windows reports "Windows has stopped this device because it has reported problems. (Code 43)"

And USB Trace gives me "USBHub:Create Device Failed" with fid_NtStatus: 3221225628 (0xC000009C)  AKA STATUS_DEVICE_DATA_ERROR

I am thinking that the device descriptor is wrong, or that it never makes it to the host.

Any clues would be appreciated!

I enabled debuging for the USB stack and this is what I get.

SEGGER J-Link GDB Server V4.98b - Terminal output channel

USB bsp_usb_dev_soc_init

Enter USB_Class_MSC_Init

USB_Control_Service ++

00++ Enter ++ type:128

descriptor class  1

send 18 to host

ready to receive ZLT on EP0

USB_Control_Service ++

USB_Control_Service ++

USB_Control_Service ++

00++ Enter ++ type:0

send 0 to host

USB_Control_Service ++

00++ Enter ++ type:128

descriptor class  1

send 18 to host

ready to receive ZLT on EP0

USB_Control_Service ++

USB_Control_Service ++

USB_Control_Service ++

USB_Control_Service ++

USB_Control_Service ++

00++ Enter ++ type:128

descriptor class  1

send 18 to host

ready to receive ZLT on EP0

USB_Control_Service ++

USB_Control_Service ++

USB_Control_Service ++

USB_Control_Service ++

00++ Enter ++ type:0

send 0 to host

USB_Control_Service ++

send ZLT done

USB_Control_Service ++

00++ Enter ++ type:128

descriptor class  1

send 18 to host

ready to receive ZLT on EP0

int8_t g_device_descriptor[DEVICE_DESCRIPTOR_SIZE] =

{

    18,                                   /* "Device Descriptor Size */   

    1,                                    /* "Device" Type of descriptor */

    0x00, 0x02,                           /*  BCD USB version               */

    0xEF,                                 /*  Miscellaneous Device Class    */

    0x02,                                 /*  Common Class  */

    0x01,                                 /*  Interface Association Descriptor */

    64,                                   /* Max Packet size */

    0xA2,0x1F,                            /* Vendor ID */

    0x00,0x08,                            /* Product ID */

    0x00,0x08,                            /* BCD Device version */

    0x01,                                 /* Manufacturer string index */

    0x02,                                 /* Product string index */

    0x00,                                 /*  Serial number string index */

    0x01                                  /*  Number of configurations */

};

Thanks

Labels (1)
Tags (3)
0 Kudos
13 Replies

1,160 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Leif Zars:

What host operating system are you using?

I did a quick test with this demo, it can work in my side. My OS is win7

There is a readme file in the below folder, you can check it.

C:\Freescale\Freescale_MQX_4_2\usb_v2\example\device\composite\msd_cdc

Regards

Daniel

0 Kudos

1,160 Views
leifzars
Contributor IV

Windows 7 x64

Yes this is what i started with. I am running on a K24 custom board. So the example fails, what could i be doing wrong.

I am using the IRC_48 as the clock source. but other then that most everything is standard.

0 Kudos

1,160 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Leif:

Could you send your modifications to us to reproduce your issue, I will test it with TWR-K24 board

Regards

Daniel

0 Kudos

1,160 Views
leifzars
Contributor IV

Starting with the standard project listed below, I have attached a link to the changed files.

Really all I have changed is the clock setting for my board. Notice that I am running at 96Mhz

https://dl.dropboxusercontent.com/u/12902970/Changes%20.zip

bsp_twrk24f120m

dev_cdc_virtual_com_twrk24f120m

psp_twrk24f120m

usbd_mqx_twrk24f120m

0 Kudos

1,160 Views
leifzars
Contributor IV

Does the above help?

0 Kudos

1,160 Views
danielchen
NXP TechSupport
NXP TechSupport

I replaced with your modified files in my demo, unfortunately I can't compile successfully, maybe some modified files are missing

Please see the below pictures.

pastedImage_1.png

pastedImage_2.png

Regards

Daniel

0 Kudos

1,160 Views
leifzars
Contributor IV

Sorry this file contains the missing defines. https://dl.dropboxusercontent.com/u/12902970/MK24F12.zip 

0 Kudos

1,160 Views
danielchen
NXP TechSupport
NXP TechSupport

Now I downloaded your head file, can compile it successfully.  I will update you when I have results

0 Kudos

1,160 Views
leifzars
Contributor IV

Thanks 

0 Kudos

1,160 Views
leifzars
Contributor IV

any luck?

0 Kudos

1,160 Views
danielchen
NXP TechSupport
NXP TechSupport

Sorry I only have TWR-K24F120m board on hand, which is featuring the K24FN256,

your custom board MCU is K24FN1M0.

I tried your code with TWR-K24F120M board, the USB enumeration fails, but it I modified the following line, it can enumerate.

usb_dev_bsp.c  in function bsp_usb_dev_soc_init function

 //MPU_CESR = 0;

Regards

Daniel

0 Kudos

1,160 Views
leifzars
Contributor IV

I thought that was needed to disable the MPU. I read that several places. In fact without it i couldn't even begin the enumeration process.

But I will try it and let you know.

0 Kudos

1,160 Views
danielchen
NXP TechSupport
NXP TechSupport

Yes, but for my board, K24FN256, I remember no MPU in it. So it works in my side

0 Kudos