AnsweredAssumed Answered

How to Add USB MSD Host Functionality to an Existing MQX 3.7 Application?

Question asked by Alessandro Vagniluca on Jul 23, 2012
Latest reply on Sep 28, 2012 by Alessandro Vagniluca

In the last months I developed my first K60-based MQX 3.7 application on my custom board with CW 10.2.

I cloned the bsp_twrk60n512_pe library for TWR-K60N512 kit in my custom BSP, adding other Processor Expert embedded components to have all the low-level drivers for the needed K60 internal peripherals.


My custom board also features a USB Host port; I used this communication port only to upgrade my application firmware, through the USB MSD Host Bootloader derived from AN4368. Till now, I have both the bootloader and my application firmware working properly on my board.


Now I have to add USB MSD Host functionality also to my application firmware. So I cloned USB_Host and MFS libraries for my board without any changes to the source files and I added a new USB task to my application to handle the attach/detach events of a memory stick and to mount/unmount the file system on it, like your mfs_usb example code does.


I got all the libraries (BSP, PSP, MSF, USB_Host) and my application re-compiled as well.

But no attach/detach event is detected by my USB task when I connect/disconnect a memory stick.


Should I add some other configuration settings in my user_config.h file for the new MSF and USB_Host libraries I link to my application?

Maybe the BSP version with Processor Expert I use has to be modified to get USB work properly? I didn’t add the Processor Expert embedded component for USB and the system clock on my board is set in the same way as in the TWR-K60N512 kit (50Mhz external oscillator).


With the debugger I see the _usb_khci_isr() USB interrupt handler is properly installed, but no USB interrupt is generated when I connect/disconnect a memory stick. The KHCI task is always in blocked state on a LW event. So my USB task is always in blocked state on a LWMSGQ event.


Can you help me to get my USB MSD Host function to work preperly?


Please, see my USB task in the attached USBhdl.c source file and my user_config.h and TB2.h BSP header files ("TB2" is my board's name).