Beware the USB cable that ships with the MBED dev kit!!!

22 Oct 2010 . Edited: 27 Oct 2010

Is anyone using MBED successfully with Ubuntu 10.4?

After an initial session a couple days ago that went well I'm having nothing but frustration. At that time I plugged the MBED into a USB port. It opened the Gnome File Browser for the USB storage device, MBED. I clicked on the HTM file which started up Firefox(v3.6.11). I signed up. Downloaded the HelloWorld program. Copied it the the MBED storage device. Hit the reset button, it ran. Then I tried out the compiler and made, downloaded, copied to the MBED, hit the button and ran a few simple LED blinking programs (naming them "mytest1", "mytest2", etc.). So I was happy and went out and bought a breadboard and a few "sensors" to do some more serious experimentation.

But today after 5 hours of trying I'm getting (almost) nowhere. I'm having major difficulties getting binary programs to consistently copy over to the MBED storage device. Sometimes I can get a complete and successful transfer. But most of the time the transfer never completes or it sits there for literally a minute or two before it completes (sometimes it has then transferred successfully and I can run it, but a lot of time it seems like it has completed but when I go to run it nothing happens).

I've tried copying binaries using both the GNOME File Browser GUI and also directly from the command line (i.e. - cp -a ~/Downloads/mytest1_xxxx.bin /media/MBED). I've tried several command line incantations using the "sync" command to try and make things complete (i.e. - sync, sudo sync, sudo su "followed by" sync, etc.). If a "cp" command is hung in one terminal window and I try to "sync" from another terminal window both will just sit there not returning. Sometimes after a minute has passed I'll see the blue status LED on the MBED finally flicker and both terminals will return to prompts (and sometimes the binary successfully has transferred at that point and I can run it). Other times both terminals will set there frozen forever and I'll just have to close them. Then in some cases when I go back to look at the MBED storage device it might have the binary file but with a 0 byte size. At this point I'm also wondering if the file system on the MBED has been corrupted beyond repair (since I've had to abort so many writes to it).

I've seen a few other posts on the forums and articles in the wiki that talk about this type of problem (i.e. - writes to the MBED don't complete immediately). I've already tried and then backed out a change to my "fstab" (i.e. - adding this line at the end, "/dev/sdc /media/MBED vfat rw,user,sync 0 0"). It didn't really seem to change/help anything.

I'm guessing this is all a problem with the various layers of "automatic file systems" that Linux/Ubuntu uses to deal with removable storage devices. But I don't know where to start in trying to diagnose or fix it.

If someone could give me a workaround (I don't mind using the command line or writing a script) that would bypass all that crap so I could just manually mount the thing and get on with using it, I'd be very appreciative. Thanks for listening to my rant   :-)

22 Oct 2010

Of course minutes after posting I went back and reread this thread:

http://mbed.org/forum/helloworld/topic/1075/?page=1#comment-5741

And even though I was reading that post because I had been searching on "fstab" (as I've been thinking this was a Linux removable drive file system issue) I noticed that some folks were mentioning issues similar to what I had been seeing. And they were "fixing" them by hitting the reset button multiple times or by holding it down a long time. So....

I started holding the reset button down much longer (than I had been doing) after I copied something to the MBED storage device and wanted it to run. And somehow this seems to help. I was able to copy and then run my 4 different test programs on the MBED (as long as I held down the reset button for something like 10 seconds after I did each successive copy). Something very strange is going on here.

I just hope I can keep it working consistently. I'll let you know (another post to this thread) if this technique starts to fail me again.

22 Oct 2010 . Edited: 22 Oct 2010

That sounds very much to me that it's a disk write-cache issue and that Ubuntu is somehow decided to flush it's write "some time later" when it feels ready. Don't know Ubuntu, but I would guess it would support disk write-caching and maybe you can switch that off if it's found to be on?

22 Oct 2010

From http://ubuntuforums.org/archive/index.php/t-483715.html

The mount options you want (in /etc/fstab) are "sync,dirsync" to write synchronously to the device.  For example, my mount is:
/dev/sdb1 /media/usb vfat user,sync,dirsync 0 0
22 Oct 2010

OK... Things went "bad" again after my last post... So I was back into total frustration mode... But remembering this forum post (the one where people talked about having to push the reset button multiple times and/or "hold it down" for awhile), somebody had also mentioned that the cable that came with their MBED was flakey... And replacing it solved all their problems...

http://mbed.org/forum/helloworld/topic/1075/?page=1#comment-5741

Well I decided to try that and replaced the 6' cable (that came in the MBED box) with a 3' cable (from another manufacturer's dev kit)... And it now works perfectly!!!

BEWARE THE USB CABLE THAT SHIPS WITH THE MBED DEV KIT!!!

And as a note to the forum moderators, I think you need to get a "sticky" announcement at the top of these forums announcing this potential problem (you may be losing many potential customers, I almost gave up)... I can't complain too much because I received my MBED for free (at ESC Boston) but the crappy USB cable did literally waste an 8-hour day of my time... Oh well... Live and learn...   :-)

27 Oct 2010

I wanted to add a "final" followup and conclusion to this thread.

I've been heavily using my MBED for several more days and have had absolutely no more problems or flakiness downloading binary files and running them.

So... BEWARE THE USB CABLE THAT SHIPS WITH THE MBED DEV KIT!!!

I now regret referring to Ubuntu 10.4 in the thread's title as my problems had nothing to do with the operating system or browser.

Is it possible to change a thread title after it's been started? Or to get a moderator to change it?

27 Oct 2010

Actually it's quite easy to change the thread title. Edit the first post (assuming you're the author) like I just did.

27 Oct 2010

Hi Allen, All,

I'd be very interested to hear if anyone else has had problems with the cable? It'd be good to know this is an isolated case where one or two cables slipped through manufacturer testing, or whether a batch of dodgy cables made it in to our stock.

We've obviously shipped quite a few cables (!) and I've only seen one or two reports, so suspect it is an isolated issue. But I wouldn't want to assume that, so please let us know here or at support@mbed.org if you had problems with your cable.

Allan; sorry for the problem you had and thanks for persevering and tracking down the culprit! I hope you're all up and running now.

Cheers,

Simon

28 Oct 2010

I had to switch to another USB cable to get new programs over to my MBED. Didn't really think of it as a big problem, as I had another one lying around.

09 May 2011

Hi, I am another one affected by the USB cable nightmare. I arrived to this thread after discovering that a shorter cable worked. This confirms "my finding"..... Some times can be faster to search first the forum... but real engineers neither read manuals nor search the forums :-(

Jose-Maria

09 May 2011

I wonder if the problem is due to voltage drop along the cable resulting in insufficient or marginal voltage at the mbed end? A 6' cable will have a higher resistance and hence a higher voltage drop than a 3' cable.

10 May 2011

Maybe, but I also tried with an external 5V power supply (and measured the voltage in MBED) and the problem didn't dissappear, so I would suspect of the USB signals decaying with the long cable. Anyhow, since I use the short USB cable, all the MBED's USB disk problems have gone away!

Jose-Maria