USB MSD host on TWR-K65F180M

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

USB MSD host on TWR-K65F180M

跳至解决方案
1,012 次查看
acampbell
Contributor II

I have a TWR-K65F180M, and I am trying to run a variation of the usbdisk demo (USB host for a mass storage device, e.g. thumb drive). However, I don't get anything out of the microUSB port (J15).

I am guessing the issue is that the microUSB port is not supplying power to peripherals. (When I plug in a basic USB laser mouse, the laser doesn't turn on.) There is a jumper (J13) for enabling/disabling power to the microUSB, but I do have it set.

Is there some other jumper configuration that I need to change to use the microUSB in host mode?

Currently I have all the jumpers in the default positions except J9 has both 3-4 and 5-6. I've tried varying some of the ones related to the microUSB port, but without any success.

标签 (1)
0 项奖励
1 解答
727 次查看
lepol
NXP Employee
NXP Employee

Hello Aaron,

please, can you check which version of board you use and also whether you use USB high speed or full speed in project?

By default, you need to enable power by shorting J13 1-2 and power is provided by digital pin, usually PTD8 (which must be set to logical 1 in project). Could you also measure whether power is provided at USB micro or J13? Could you also insert a breakpoint to a function usb_host_dev_mng_check_configuration attach a device and see what happen?

Best regards,
Lenka Polaskova

在原帖中查看解决方案

5 回复数
727 次查看
mjbcswitzerland
Specialist V

Hi

J36(2-3) as default

J13(1-1) as default

Control PTD8 to '1' in code when needed to supply power to the USB output.

Regards

Mark

727 次查看
paulb-sct
Contributor III

Note that the 'readme' file included with the example project usb_host_msd_fatfs (as generated by SDK 2.0) is INCORRECT, at least for USB-HS. It lists incorrect jumper settings. I changed the jumpers to what was stated in the readme file ("J13 1-2, J9 7-8, Remove all jumpers from J23.") and could not even start a debug session. So, keep the jumpers as default:

J13

1-2

J9

5-6

J23

1-2 & 3-4

J36

2-3

And in the code you need to explicitly disable the KHCI build and enable the EHCI build, this is done in usb_host_config.h.

As for the earlier reply, I could not find the function usb_host_dev_mng_check_configuration().

0 项奖励
727 次查看
lepol
NXP Employee
NXP Employee

I had this issue to, I assume that debug session is halted because when disconnecting all J23 jumpers (regulator inputs) the USB regulator output voltage is not provided. J9 7-8 source the regulator output to MCU. So with this connection scheme there is no power for MCU!. You can connect J23 1-2 or 3-4 and J9 7-8 when you want to power the mcu only from USB and not from external sources.
And at last I'm sorry for the wrong function name. That applies for SDK 1.0. For SDK 2.0 it may be equivalent if a function USB_HostInit return success.

Best regards

Lenka Polaskova

0 项奖励
728 次查看
lepol
NXP Employee
NXP Employee

Hello Aaron,

please, can you check which version of board you use and also whether you use USB high speed or full speed in project?

By default, you need to enable power by shorting J13 1-2 and power is provided by digital pin, usually PTD8 (which must be set to logical 1 in project). Could you also measure whether power is provided at USB micro or J13? Could you also insert a breakpoint to a function usb_host_dev_mng_check_configuration attach a device and see what happen?

Best regards,
Lenka Polaskova

727 次查看
acampbell
Contributor II

I'm not entirely sure what the version of the board is; on the back it says 700-28036 REV A, SCH-28036 REV D, (c) 2015 Freescale.

Ok, it looks like usb_host_board_init sets PTD8. However, it only does so for EHCI (high speed), and I was using KHCI (full speed).

    /*"0" stands for USB_CONTROLLER_KHCI_0 */

    if (0 == controller_id)

    {

    }

    /*"2" stands for USB_CONTROLLER_EHCI_0 */

    else if (2 ==controller_id)

    {

         /*configure the id pin */

        /* Enable clock gating to all ports E*/

        CLOCK_SYS_EnablePortClock(4);

        PORT_HAL_SetMuxMode(PORTE,10UL,kPortMuxAlt7);

        PORT_HAL_SetPullMode(PORTE,10UL,kPortPullUp);

        PORT_HAL_SetPullCmd(PORTE,10UL,true);

        /* Source the Ubus. Set PTD8 to high */

        /* Enable clock gating to all ports D*/

        CLOCK_SYS_EnablePortClock(3);

        GPIO_DRV_Init(NULL, usbvbushostenablePin);

        GPIO_DRV_WritePinOutput(kGpioUsbVbus, 1);

    }

    else

Once I started using USB_CONTROLLER_EHCI_0, it turns on the USB power and works correctly.

0 项奖励