Getting USB mass storage to work on T20 using USB on-the-go

Hi,

On our T20 windows ce image we have a working USB otg configuration. Right now, when we connect the device to a PC, WIndows Mobile Device Center takes control. This has worked perfectly in the past but we are starting to see a lot of issues with Windows 10 creators edition and the lacking support of Microsoft for WMDC. That’s why we would like to expose the T20 device as a mass storage device when hooked up to the PC. The question is: what do I need to change in the image to make this work. The SYSGEN_USBFN_STORAGE has been checked in the catalog. Do I need to deactivate ActiveSync in my image? Or do I need to make changes in the registry configuration? Any help would be much appreciated…

The features are already built in our standard image, there is no need to build a custom image. You only need to change the DefaultClientDriver as well as configure the disk which has to be shared. Internal flash on the Tegra modules is DSK1.

Please check the following developer website, which describes the settings you need to do. Let us know if you need further assistance.

Please be aware, that you need to use image 2.0 as the registry was previously stored on the flashdisk.

Hello Samuel,

Thank you for your reply. We got this to work which is great but two questions remain.

  1. We’re exposing the internal flash and are currently not using image 2.0 (we are still on V1.3…I’m not too keen to upgrade all our users). Is it absolutely necessary to upgrade to this new image and is there a particular reason?

  2. Is there a message/event that we can catch so we know that FlashDisk will disappear? The reason is that we can then first give a message to the user allowing him to decide to save his work on the flashdisk…if flashdisk disappears immediately when connecting a cable, the user can no longer save his work.

Thanks for any help…

Hello @jrjab,

  1. If you want to use this feature it is necessary, yes. The reason for that is, that the registry was saved on the flashdisk. If the registry is not there any longer a lot of the WinCE functionality does not work properly any longer, the system is not running stable any longer. What you could try to do is to prevent any activity of the user or of your application during the time the flashdisk/registry is not mounted on the system. Depending on your use case may this could work, but it is actually a unsupported use case and may could also issues even after mounting the flashdisk

  2. Search once for WM_DEVICECHANGE. You could get a notification if the storage is attached or detached.Once you get this notification from the system, it may be is already to late, the disk already disappeared. May be you could store some intermediate data to RAM? One other option would be to use kind of USB Memory sticks with some autocopy or autorun tasks to update the system or expose only certain partitions or a different disk (SD Card) to the usb mass storage?

Hello Samuel,

Thank you for your answer. It’s probably safer to go to version 2.0 of the image.

I have two other questions though…

  1. is it possible to expose parts of two different disks as ONE mass storage device? (part of flashdisk and part of SD-card?). I don’t think so but I’m asking anyway :slight_smile:

  2. If the above is not possible, do I have to fear for data corruption in the long run when running an application and its data entirely from SD-card (as opposed to having most of the application on FlashDisk and only parts of data on SD-card).

Thanks again for your answer!

Hi @jrjab,

  1. It is not possible to expose two different disks to ONE Mass storage device.
  2. Yes, If you keep application and data on the SD-card, it may corrupt due to power failure, sudden eject.

We suggest to you Keep application in FlashDisk and make read-only or don’t write anything on the FlashDisk and store data on the SD card for the long run applications.

We would like to know use cases of the FlashDisk and SD card and access over the USB of those for your product? It will help us to provide better solution for your use case.

For your references:
Issue SD Card Corruption - Toradex Community.
http://developer.toradex.com/software/windows-embedded-compact/t20-t30-wec-software/release-details?view=all&issue=16906.

Hi guys,

I’m returning to this post as I have been experimenting with exposing the FlashDisk through USB Mass Storage. What I have found is this:

(With both image 1.3 and image 2.0)

I expose the FlashDisk to a PC and copy a number of files onto the resulting Mass Storage disk (which is indeed the FlashDisk from my device). If I then unplug the device, the FlashDisk returns on my device and all files seem to be ok. BUT as soon as I reboot the device, the registry seems to be reset to factory defaults AND a lot of my files on the flashdisk are gone. What’s more, it has introduced a number of files in random directories called user.hv, system.hv or default.vol.
So it seems that file tables and/or registry were not flushed/synced correctly and after a reboot everything is messed up.
What’s more, if the FlashDisk returns on the device and I then try to do a SaveReg a box comes up saying “Registry save FAILED!” so it seems the system is in a corrupted state altogether.
On this particular device (we have several devices running Colibri T20), we don’t have an SD-card to expose. So the only option is to expose the FlashDisk. Unfortunately, due to this problem, the mass storage option is not an option at all…I hope you guys can give me some pointers as to what I can do to solve this. (maybe issue some sort of flush operation before resetting)
I’m pretty much stuck now…

Jean

@jrjab,
Which WinCE version you are using? WinCE6 or WEC7?

Did you update using new CFG files from 1.3 to 2.0? http://developer.toradex.com/knowledge-base/update-tool#When_to_flash_using_CFG_file_Tegra_Only

If you are seeing the same problem after update 2.0 image then log debug messages and share with us. It will help us to debug the issue.

Thank you.

Hello Raja,

We are using CE6. I first did the update using the nvflash.exe tool from a PC using the most recent ce6.cfg, the 2.0 eboot.nb0 from your site and our own image nk.nb0. This programs ok without errors. The device boots up as expected.
I have also tried using the updatetool.exe.in the Windows directory (tried with both the 6.0.9 and the 6.0.12)…same result. It programs ok and Version Info in updatetool states that we have 2.0 both in eboot and in image.

I have logged debug output for several runs…see debug output file here. link text

I hope this helps…this is a really big problem. I was really hoping to be able to expose the FlashDisk as mass storage and put files on it… this seems to be very unreliable.

@jrjab,

We have observed registry save problem only when image updating by not recommended steps.
I have tested it on WinCE6 2.0 image version, we are not able to reproduce the same issue.

Could you please try below step by step instruction and let us know your feedback.

  1. Download :
    [Toradex Documents - Tegra Update Tool)][1]

  2. Download :
    [Toradex Documents - Tegra WinCE Image][2]

  3. Run UpdateTool on the Tegra. click

  4. Update and Type: Layout Config Files

  5. Select ce6.cfg file and Click

  6. Yes to update many sections.

    650-teg-update.jpg

7.Wait for Update completion and Reboot.

  1. Try your use case testing.

I have recorded my screen in this use case for your reference. Please download from here : https://share.toradex.com/z76z1yv1flbadjb

If the still issue is happening, Could you please share

  1. Your custom image
  2. Record video/screen capture to understand your complete steps.

[1]: Toradex Documents - Tegra Update Tool)
[2]: Toradex Documents - Tegra WinCE Image

Hi Raja,

I’ve made two movies explaining the process and showing you what’s going on.

They’re here:

http://www.tnisoft.com/downloads/temp/mov1.wmv

http://www.tnisoft.com/downloads/temp/mov2.mp4

I have also included the updatetool and nk.nb0 files I’ve used in a zip file for your reference:

http://www.tnisoft.com/downloads/temp/updatetool_used_in_mov1.zip

Strangely enough, the issue happens the second time I boot. Sometimes the first time there are already strange things going on but mostly it’s the second boot.

If I can test anything else, please let me know!

Possibly, it has to do with the fact that there are a lot of files (approximately 120MB) being copied over?

Thanks!

@jrjab,

Thank you for the issue details.

We are seeing many changes on your custom image. Please refer attached picture for one reference. Could you please look how it is changed or please zip and share your custom built image release directory(OsDesigns\ColibriTegra_Core\RelDir\NVAP_ARMV7_Release), we need to look many files on there.

Do you see this problem only on a custom built image?
Still, Is it happening with our standard release image as well?

Hello,

I have done more tests. I was not yet using your 2.0 workspace but my old one (based on 1.3). I noticed that the variable prj_enable_fsreghive was set to 1 in my workspace. Maybe that variable needed to be set in image 1.3…so I thought…ok, this is the problem.

I have now made a new image with your 2.0 workspace and 2.0 bsp and just added some extra components and registry keys to it (specific for our needs) and rebuilt the image. I have tested it and the results are better (the problems don’t occur after one or two resets) but I still have the problem that, all of a sudden, directories turn up empty…or other directories suddenly have files that resided in another directory before. I don’t have the system.hv or default.vol files turning up in several directories. But I still find that it’s unreliable. I have uploaded my reldir (as image_jab_2.0.zip) on your server. I hope you can spot the problem fast or point out what setting is causing trouble.
Let me know if you need any other information…

Thanks…

@jrjab,

Please once again upload and share the link here. We can’t get it until you share the link.

Here’s the share link https://share.toradex.com/0lsx54c0chn99ic

@jrjab,

We got your files and looking into it. Could you please wait for a couple of days. We will get back you soon.

Hello, just wanted to check what the status is. Any progress? Do you need any additional information?

@jrjab: Could it be never upgraded the image to 2.0 or 1.4 using NVFlahs or the *.CFG file and a latest Update Tool? This chould lead to the fact, that you use a old error correction handling in the flash filesystem. Please enable once the debug output and send us the output, so we can check if everything is fine.

Hi Samuel,

I used the latest update tool and latest cfg file to update. I only used my own 2.0 image to program it. See debug output attached…link text

@jrjab: The output looks good so far, you are using the latest error correction (BCH16). One thing that could point to a direction is the exceptions oyu have caused by your updater.exe? Could this be the trigger for this issue?

Are you also able to see the files diapering and appearing in different folders in our image? If not, please check once if you format your FlashDisk using Transaction save FAT (TexFAT). This is configured in the registry (Storage profile).