How to enable High Speed USB mode in MQX 4.0.0

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

How to enable High Speed USB mode in MQX 4.0.0

1,013 Views
pramodk_g_
Contributor III

Hi All,

I am working on K70 MCU on a custom board with MQX 4.0.0 and CW 5. I have implemented the SD card as Mass storage with the help of freescale examples. Now the problem I am facing is that slow data transfer rate between PC and device(~100kbps on windows and very slow on MAC pc). In order to improve the speed I tried to enable the USB HIGH SPEED mode in MQX 4.0.0 ( by defining HIGH_SPEED_DEVICE as 1 in usb_descripter.c ) but the code goes to despatch.s when I connected device to PC via USB. Please let me know how I can enable USB HIGH SPEED mode in MQX 4.0.0  without going to MQX 4.1. Because I found some difficulties while porting the code to 4.1, since have changed some bsp files.

I'd appreciate any information, thoughts, or ideas on how to implement this in MQX 4.0.


Thanks,

Pramod.

0 Kudos
6 Replies

615 Views
RadekS
NXP Employee
NXP Employee

Please edit twrk70f120m.h file in your BSP and search for “USB” section.

You can find there USBCFG_DEFAULT_DEVICE_CONTROLLER and USBCFG_DEFAULT_HOST_CONTROLLER definitions.

For USB high speed mode you need select EHCI module by &_bsp_usb_host_ehci0_if pointer.

I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

615 Views
pramodk_g_
Contributor III

Thanks RadekS for the quick reply.

I have done the change as you mentioned but it does not work for me. Also I defined  HIGH_SPEED_DEVICE to 1 in usb_descriptor.h file. While debugging I found that code flow lost after executing the following lines in file ehci_dev_main.c ( line 403) .

    /*--- Intial Configuration ---*/

    /* Initialize the endpoint 0 properties */

    EHCI_REG_WRITE(dev_ptr->REGISTERS.OPERATIONAL_DEVICE_REGISTERS.ENDPTCTRLX[0],

        (EHCI_EPCTRL_TX_DATA_TOGGLE_RST | EHCI_EPCTRL_RX_DATA_TOGGLE_RST));

    EHCI_REG_CLEAR_BITS(dev_ptr->REGISTERS.OPERATIONAL_DEVICE_REGISTERS.ENDPTCTRLX[0],

        0 ); //(EHCI_EPCTRL_TX_EP_STALL | EHCI_EPCTRL_RX_EP_STALL));

After that when I pause the debugging I got a following error

USB_error.png

Please let me know if anything else I want to change in BSP.

Thanks,

Pramod.

0 Kudos

615 Views
reubennoronha
Contributor I

Hi Pramod, I too followed the instructions and made changes in twrk70f120m.h :

#define USBCFG_DEFAULT_HOST_CONTROLLER    (&_bsp_usb_host_ehci0_if)

and I'm facing the same issue as you during debug. Have you got it to work ? What changes did you make ?

#define USBCFG_DEFAULT_HOST_CONTROLLER    (&_bsp_usb_host_ehci0_if)

0 Kudos

615 Views
RadekS
NXP Employee
NXP Employee

Important note:

Be aware. Some of ULPI signals are shared with JTAG trace signals!

For debugging please use onboard OSBDM interface or use just 10wire connection (without trace signals) with your external debugger!

SNC00812u.jpg

I hope it helps you.

Have a great day,
RadekS

0 Kudos

615 Views
reubennoronha
Contributor I

Hi,

Thanks for your reply. I tried it, but it does not work.

In "twrK70f120m.h" I changed :

#define BSP_USB_TWR_SER2 (0)

to

#define BSP_USB_TWR_SER2 (1)

I then rebuilt the projects in the following order

1) "bsp_twrk70f120m"

2) "usbh_twrk70f120m"

3) "mfs_usb_twrk70f120m"

I am working on a custom board. NOTE that khci works fine on my board, but USB is really slow.

Can I assume that USB is really getting 48MHz ? How can I confirm since there is no clock on a pin for USB unlike SPI.

Any other suggestions ?

0 Kudos

615 Views
reubennoronha
Contributor I

IMG.jpg

Above is the USB-N pin captured on CRO. It seems to be about 6MHz, which is 8 times slower than 48MHz.

NOTE that this code is khci since I reverted the changes made to the file since ehci does not work..

0 Kudos