Main Site Documentation

USB Mass Storage not recognized


#1

Hi Everyone

I have some troubles with USB Key mass storage and USBIzi. In fact some of usb memory works properly, Others are not detected…

My lexar 4GB works well, but an HP v165W does not. We bought a rugged USB flash memory and it does not work neither.

What could be done to solve this issue?

Regards

Jeremie


#2

Just a quick question: are you using the usb power or an external power supply?
If usb: please try connection a external power supply (wall wart)


#3

Thanks for your reply, unfortunately this seems not to be the cause of troubles, I am using a external power supply for the USBizi board.


#4

All sticks we tested worked fine. If you mail us the non working one then we can investigate more.


#5

Here is the USB stick that we have:

The USB 5V is ok even during stick insertion.

I have connected a USB hub and the key is properly recognized even when its power supply is disconnected.

What about pull up and pull down resistor? We have use the same schematic than the one provided by GHI for the FEZ Rhino


#6

The USB Stick works better with EMX module than USBizi. Nevertheless… in some cases:


static void DeviceConnectedEvent(USBH_Device device)
        {
            if (device.TYPE == USBH_DeviceType.MassStorage)
            {
                Debug.Print("USB Mass Storage detected...");
                ps = new PersistentStorage(device);
                ps.MountFileSystem();
                is_cle_present=true;
            }
        }

returns:[quote]
SB Mass Storage detected…
#### Exception System.Exception - 0xffffffff (3) ####
#### Message:
#### GHIElectronics.NETMF.IO.PersistentStorage::PersistentStorage_Helper [IP: 0000] ####
#### GHIElectronics.NETMF.IO.PersistentStorage::.ctor [IP: 0011] ####
#### BootNDR.BootNDR::DeviceConnectedEvent [IP: 0011] ####
#### GHIElectronics.NETMF.USBHost.USBH_DeviceConnectionEventHandler::Invoke [IP: 0000] ####
#### GHIElectronics.NETMF.USBHost.USBHostController::nativeEventDispatcher_OnInterrupt [IP: 0037] ####
#### GHIElectronics.NETMF.System.InternalEvent::nativeEventDispatcher_OnInterrupt [IP: 0054] ####
Une exception de première chance de type ‘System.Exception’ s’est produite dans GHIElectronics.NETMF.IO.dll
Une exception non gérée du type ‘System.Exception’ s’est produite dans GHIElectronics.NETMF.IO.dll[/quote]

How can it be possible?
This code is in my bootloader while writing on USB stick in my main app works well.

A other run of the bootloader with exactly the same code returns:

[quote]EMX en mode Bootloader
Update has been requested
USB Mass Storage detected…
Storage “\USB” is inserted.
Getting files and folders:
Files available on \USB:
\USB\IFU\TinyBooter.GHI
\USB\IFU\APP.HEX
\USB\IFU\CLR.HEX
\USB\IFU\CLR2.HEX
\USB\IFU\Config.HEX
\USB\IFU\managedBootloader.hex
Folders available on \USB:
\USB\IFU
\USB\IFU\CLR.HEX is currently downloaded
#### Exception System.IO.IOException - CLR_E_FILE_IO (1) ####
#### Message:
#### Microsoft.SPOT.IO.NativeFileStream::Read [IP: 0000] ####
#### System.IO.FileStream::Read [IP: 0028] ####
#### BootNDR.BootNDR::Main [IP: 019f] ####
Une exception de première chance de type ‘System.IO.IOException’ s’est produite dans Microsoft.SPOT.IO.dll
Une exception non gérée du type ‘System.IO.IOException’ s’est produite dans Microsoft.SPOT.IO.dll
[/quote]

and the code stops at the read instruction:


SystemUpdate.CompleteUpdate.Start();

                foreach(string fileName in files)
                {
                    Debug.Print(fileName.ToString() + " is currently downloaded");
                    FileStream file = new FileStream(fileName,FileMode.Open,FileAccess.Read);

                    // read the file in chucks
                    byte[] buffer = new byte[10 * 1024];
                    int length;

                    do
                    {
                        length = file.Read(buffer,0,buffer.Length);
                        if(fileName != "\\USB\\IFU\\TinyBooter.GHI")
                        {
                            SystemUpdate.CompleteUpdate.Write(buffer,0,length);
                        }
                        else if(fileName == "\\USB\\IFU\\TinyBooter.GHI")
                        {
                            SystemUpdate.CompleteUpdate.WriteTinyBooter(buffer,0,buffer.Length);
                        }

                    } while(length == buffer.Length);

                    Debug.Print(fileName.ToString() + " has been downloaded");
                    file.Close();
                }
                Debug.Print("SystemUpdate completed: the system will reboot");
                // End update
                SystemUpdate.CompleteUpdate.End();

This is really weird. I don’t know how to debug that!!!
The code works well with other USB sticks.


#7

Power problem is common.


#8

Hello Gus

The board can be powered with a separate power supply. I successfully write to the stick but can’t read.
Sometimes I can read 1MB, while other times, it crash at instantiating the persistent storage. It never crash during write function.

Actually I measure 4.8V for USB.

If I connect the key on my computer the key is powered at 5V unless I use a USB hub. In this case the stick is powered at 4.4V without any problem.

May be the problem comes from long cable between EMX and the stick (this does not seem to be a problem for the computer)…


#9

USB specification allows voltages as low as 4.5V. If your stick doesn’t work at 4.8V then this stock is not to the USB standards. It could be the long cable too.


#10

As I said:

I have used the same cable with an other USB stick, and it works.

The Fischer Flash USB stick start to make me nervous!!! If anyone has some idea to say if the stick is not USB compliant or if its a bug in my HW/SW, do not hesitate. The customer insist for this memory stick but I do not succeed to solve this.


#11

So other sticks work but only this one is giving you problems?


#12

Actually the HP v165W and the Fischer rugged flash drive don’t work. The problem is that customers have chosen the fischer one.

The HP is not recognized when inserted, but works fine behind a USB hub (even when the hus is not self powered). The Fischer is properly recognized but reading byte crash the board, sometimes during creation of persistent storage, sometimes when reading chunks of bytes (sometimes about 200*1024 bytes, sometimes after millon of bytes)…

I will try this morning to power the board with a better power supply and remove the automatic fuse on VBUS.


#13

In worst case, you can send us one of these memory sticks and we can try it out.


#14

Actually we measure the power consumption of the Fischer Stick (300mA). This is a lot!!! I have try with a smaller cable (20cm), that is USB compliant (the other one given by customer was not) and it works great. Unfortunately customers need longer cable… I hope it will go on working. In the same time, we are working on a new power supply based on a LM2575 (vs LM7805) to enhanced our power capabilities. In fact when our board was powered with 20V, the LM7805 was heating a lot and and the fischer stick was connected, we observed some kind of unstable system (reboot, and some error using the USB memory).

Therefore I think the problem is the combination of a long cable (that is not USB compliant), a too small power supply and a USB stick that consume too much energy.

As soon as we have the new cable I will let you know what is going on