How to set a new project for host USB mass storage

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

How to set a new project for host USB mass storage

1,383 Views
joao_ribeiro
Contributor IV

Hello,

We are trying to create a new USB host pen driver reader/writer project in the new version of the MCUxpresso on a bare metal board, but we are struggling to set it up correctly. Here is what we are doing.

First of all we have already tested the twrk64f120m_host_msd_fatfs_bm example provided by the sdk and it all went perfect, but now we want to create a new and clean project using the functions that the new IDE provides. Therefore we started like this:

1st. Create the new project for the correct uC

2nd. import the correct drivers and middleware

1.png

3rd. Set up the correct pins for the USB and enable the USB FS clock on the clock tab

4th. Get the mass storage config on the Peripherals tab. We can only set it as a generic HID

USB_host_MSD.PNG

It does compile correctly and after placing the USB_HostTasks(); on my while(1), I always get the message "Device not supported" 

With some breakpoints I figured that the firmware is aware when we plug a new USB pen drive to the board, but on the function USB_HostInterface0HidGenericEvent it will not get through the if ((pid == 0x00a2) && (vid == 0x1fc9)).

I am probably wrong but I think that the Peripherals tab hasn't got the proper setting for the mass storage usb, therefore it does not set the USB_HOST_CONFIG_MSD and this type of devices will not get discovered. Is this correct? Am I setting the project correctly?

Thank you for the help

Regards

0 Kudos
5 Replies

1,248 Views
diego_charles
NXP TechSupport
NXP TechSupport

Hi Joao,

Could you check my previous answer?  Were you able to achieve progress on your project?

Best regards, Diego. 

0 Kudos

1,248 Views
diego_charles
NXP TechSupport
NXP TechSupport

Hello @João Riveiro, 

Please, accept my apologies for the delay in the response during the past holidays.

I working on your case and I´m waiting for confirmation on the MSD configuration. 

Best regards, Diego

0 Kudos

1,248 Views
joao_ribeiro
Contributor IV

Hi Diego,

Thank you for your reply. I appreciate your concern. I look forward for your reply.

Regards

0 Kudos

1,248 Views
diego_charles
NXP TechSupport
NXP TechSupport

 Hi João,

You are correct, at the moment the peripheral Tool, does not provide the option for configure the MSD class. 

In this case, you  will need to set the define to one and replicate the required function calls and defines for  the example  twrk64f120m_host_msd_fatfs_bm, that you mentioned before.

Looking for the error, At the moment, I'm not aware if you set  the define 

#define USB_HOST_CONFIG_MSD (1U)

And called the following required function (in your while loop) and you still have the same issues

 USB_HostMsdTask()

In the SDK example, when the define for MSD is set to zero,  all the implementation of the functions on the usb_host_msd.c is not done, Therefore the functionality cannot be achieved.  

Best regards, Diego. 

0 Kudos

1,248 Views
mjbcswitzerland
Specialist V

Hi

In case of restrictions you can also use the open source uTasker project which supports this operation on all Kinetis parts:

https://www.utasker.com/kinetis.html
eg.
https://www.utasker.com/kinetis/FRDM-K64F.html
https://www.utasker.com/kinetis/TWR-K64F120M.html

Video: https://www.youtube.com/watch?v=VJ7YveF4_8g&list=PLWKlVb_MqDQFZAulrUywU30v869JBYi9Q&index=26

It works with most IDEs and also allows complete simulation of the USB controller and memory sticks in its Visual Studio simulation.

Projects developed for Kinetis can then operate on i.MX RT (when high per-formance is needed) with almost no porting effort.

Regards

Mark
[uTasker project developer for Kinetis and i.MX RT]

0 Kudos