MQX 4.2 MSD on K65

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

MQX 4.2 MSD on K65

Jump to solution
2,147 Views
yoramshacham
Contributor III

Hi all,

I'm trying to use MSD on K65 running MQX 4.2.

I'm using the HVAC2 demo for that which worked fine apart from the MSD that never worked.

I've started debugging it and came with several issues.

First issue I've encounter was that for HS the controller was set to USB_CONTROLLER_EHCI_1.

After changing it to USB_CONTROLLER_EHCI_0, I've started to see activity on the microUSB (J15) while connecting mass storage device.

What I'm seeing is that the device is attached, it tries to install the file system and then it detaches.

Tracing it a little, it seems to me that an async transfer is initiated due to call to usb_class_mass_getmaxlun_bulkonly(), registering _io_usb_ctrl_callback() as the transfer completed callback.

The callback is registered in the usb_host_ptr->tr_list[tr_index].callback but is never called by anyone.

The USB task waits on COMMAND_DONE semaphore which should be posted by the callback, but as it is never called, it just times out and fails.

I've searched the entire code and was not able to find the calling code for this callback.

Any idea how to resolve that?

Labels (2)
0 Kudos
1 Solution
1,520 Views
isaacavila
NXP Employee
NXP Employee

Hello Yoram,

I already received some feedback on this topic:

For Full-Speed, LED_3 in hvac_io.c file is using PTA28 and when LED 3 is initialized and is being driven low in TWR-SER1 USB VBUS will be disabled.  (Please consult TWR-SER schematic, GPIO4 for more details), so for FS, you will only need to disable LED_3 and will be working well.

For High Speed functionality, as you already noticed, CONTROLLER_ID was wrongly set to USB_CONTROLLER_EHCI_1 instead of USB_CONTROLLER_EHCI_0. Once you change it and use J15 with an USB OTG adaptor, I could make it work although it sometimes failed to mount the File System in the USB thumb. Could you please validate if this is the same on your side?

Regards,

Isaac Avila

View solution in original post

17 Replies
1,520 Views
yoramshacham
Contributor III

Hi Issac,

Indeed FS is working fine once PTA28 is not used for LED3.

HS was hanging during init/mount even when I used EHCI_0.
It seems to work better now. I suspect it had timing issues due to use of _HOST_DEBUG_.

I did notice it would not mount from time to time and also seen a scenario where it did mount correctly, but got hung while executing 'dir' command.

Potentially these issues are a result of the type of format done on the device.
Do you have any recommendation for the optimal format parameters to use?

Thanks,

Yoram

0 Kudos
1,520 Views
isaacavila
NXP Employee
NXP Employee

Hello Yoram,

Same case happened to me, but last time that i used a USB thumb in FAT32 format (Kingstone 8 GB) I was able to run example correctly.

The others that you are referring to 'dir' commands, USB team told me that could be related to some MFS issues, i will try to investigate it further and try to provide some feedback/workaround if they are still presented.

I hope this can help you

Regards,

Isaac Avila

0 Kudos
1,520 Views
yoramshacham
Contributor III

Hi Issac,

Any news with regards tot the 'dir' issue ?

I'm getting it quite a lot. it hangs for a while and them prints "USBMFS retrying read sector".

Thanks,

Yoram

0 Kudos
1,520 Views
isaacavila
NXP Employee
NXP Employee

Hello Yoram,

USB Team told me that this error might be related to MFS's bug that is expressed in this thread: TWRK64 MQX 4_2 MFS SD-CARD demo Volume and LFN long file name collision, in this same thread there is attached a workaround and it could be related to the problem. (However, I've not tested it).

Also, pay attention to format that is given to USB thumb, i would expect to be FAT32.

Could you please validate if the problem that is shown in the thread is the same for you?

Regards,

Isaac

0 Kudos
1,520 Views
yoramshacham
Contributor III

Hi Issac,

I've applied the modified files as suggested - it didn't seems to make a difference (potentially it was a build issue - not sure).

I've played around with the configuration and got it to work - still seems non-robust.

When connecting and disconnecting few times I often get:

USB device removed.

Going to idle state

Mass Storage Device Attached

Error in usb_class_mass_getmaxlun_bulkonly: c0Unable to open USB device

Error while uninstalling filesystem.

Error while uninstalling partition manager.

I did notice that in order to use High Speed mode, USBCFG_MAX_INSTANCE should be increased from 1 (I've used 4).

I've also found out that a Kingston Duo that did not work (was connecting and disconnecting when was labeled with 10 char/num label, started working when labeled with a 7 char only label.

Regards,

Yoram

0 Kudos
1,520 Views
isaacavila
NXP Employee
NXP Employee

Hello Yoram,

USB team were not able to reproduce the error.

For USBCFG_MAX_INSTANCE, it means the supported mass-storage devices number at the same time, if you want to insert two devices at the same time, USBCFG_MAX_INSTANCE needs to be less than 2, however, the usb_filesystem_install uses the same "USB:" as the device identifier, so second filesystem installation will fail.

are you using any HUB?

I will try to do some quick test and see if i can replicate the behaviour you are seeing.

Regards,

Isaac

0 Kudos
1,520 Views
yoramshacham
Contributor III

Hi Issac,

I'm not using external HUB. The USB sticks are connected directly to the J15.

0 Kudos
1,520 Views
isaacavila
NXP Employee
NXP Employee

Hello Yoram,

I made some tests using High speed version and it fails several times when using one specific usb thumb (not sure if this was related to block size but always got error on _mfs_validate_device function every time partition manager was opened), however, when using another usb thumb (FAT32) it always got file system installed and worked correctly when performing File System commands (dir, log, etc).

If you are still having error on dir command after using different USB thumbs, I would recommend you to debug the project on Shell_dir function that is located at shell_twrk65f180m > Shell_Source > mfs > sh_dir.c this way we can have a better aproach to the error you are facing.

Hope this helps,

Regards,

Isaac

0 Kudos
1,520 Views
yoramshacham
Contributor III

Thanks Issac,

I will do that.

Regards,

Yoram Shacham

T: +972.72.2515411

M: +972.50.5926246

F: +972.4.8712844

E: yoram.shacham@embedigen.com

W: www.embedigen.com

On Mon, Mar 28, 2016 at 11:08 PM, isaacavila <admin@community.freescale.com>

0 Kudos
1,520 Views
isaacavila
NXP Employee
NXP Employee

Hello Yoram,

I've asked for more reference about this unstable behavior. I'll let you know if another useful information is provided.

regards,

Isaac

0 Kudos
1,521 Views
isaacavila
NXP Employee
NXP Employee

Hello Yoram,

I already received some feedback on this topic:

For Full-Speed, LED_3 in hvac_io.c file is using PTA28 and when LED 3 is initialized and is being driven low in TWR-SER1 USB VBUS will be disabled.  (Please consult TWR-SER schematic, GPIO4 for more details), so for FS, you will only need to disable LED_3 and will be working well.

For High Speed functionality, as you already noticed, CONTROLLER_ID was wrongly set to USB_CONTROLLER_EHCI_1 instead of USB_CONTROLLER_EHCI_0. Once you change it and use J15 with an USB OTG adaptor, I could make it work although it sometimes failed to mount the File System in the USB thumb. Could you please validate if this is the same on your side?

Regards,

Isaac Avila

1,520 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Yoram:

What is your storage device type? I want to know whether your device is verified before.

The following document lists the peripheral devices that are verified with the USB Host stack.

C:\Freescale\Freescale_MQX_4_2\doc\usb_v2\USB_Stack_Supported_Peripheral_list.pdf

Regards

Daniel

0 Kudos
1,520 Views
yoramshacham
Contributor III

Hi Daniel,

I've tried several USB flash devices (Sandisk Cruzer blade 8G, Kingstone 16G and several non branded with smaller capacities).

I don't believe it's a device issue as I've ran the KSDK demo on the same hardware with the same device and they were all iterated and content displayed correctly by the KSDK application.

Regards,

Yoram

0 Kudos
1,520 Views
isaacavila
NXP Employee
NXP Employee

Hello Yoram,

I could reproduce your issue and it seems to be related to USB stack for K65, I already ask for this issue to USB development team and i am waiting for their response, I will let you know as soon as they give me some feedback on it!

Best Regards,

Isaac Avila

0 Kudos
1,520 Views
yoramshacham
Contributor III

Hi Issac,

Any updates on this?

0 Kudos
1,520 Views
isaacavila
NXP Employee
NXP Employee

Hello Yoram,

I still do not receive feedback on this issue, but only for your reference, this is the ticket for your issue: MQX-5687

I will let you know as soon as response is received.

Best regards,

Isaac

0 Kudos
1,520 Views
yoramshacham
Contributor III

Thanks Issac.

0 Kudos