Important changes to forums

We’re making some changes to the Mbed forums. From 10th December 2019 all new discussions will take place on our new forum site. You can continue to reply to existing threads for the next two weeks. After that we will archive this forum so you can return to useful posts in the future.

Saving data to a USB stick

04 Jan 2010

Hi all,

Can anyone tell me how easy it is to get an mbed to save data to a USB memory stick?  I understand the mbed would have to act as a 'host', which is supported by the underlying processor (LPC1768), but that gets quite involved.  Am I right in thinking that there is no easier way of doing it yet? 

Many thanks in advance,

Jonathan

05 Jan 2010

You can always get an SD card and get a USB-to-SD thingy if it's urgent... I've seen them around..

Better yet: http://www.dpreview.com/news/0501/05010606sandisksdflip.asp

07 Jan 2010

I'm trying to port NXP's USBHostLite example. I got it to compile but don't know yet if it will work. I noticed one thing in the LPC23xx.h header which doesn't look right:

#define LPC_USB_BASE (0xE01FC1C0)

I think this should be 0xFFE0C000.

07 Jan 2010

Yep, thanks. Will be fixed in next update.

07 Jan 2010

Hmm, I'm looking at the datasheets and various schematics and it seems there are a few pins which are not available on mbed:

P1[19]  USB_PPWR
P1[22]  USB_PWRD
P1[27]  USB_OVRCR

They're marked as "Host power switch" in the pin list.

I wonder if it's still possible to use USB host functionality without them?

07 Jan 2010

Hi Igor,

We believe it should still be possible, yes. I think these were determined to be non-essential pins, and therefore keeping the pinout the same won. Please keep us posted!

Simon

10 Jan 2010

Could you let me know whether you get USB host working, with USBHostLite?

Thanks,

Chris.

15 Jan 2010 . Edited: 19 Jan 2010

Well, I spent half a day trying to get it working before I noticed in the datasheet that LPC2368 does not, in fact, have a USB host. $%#@%@#%!

And since Mouser shipped me a wrong device and promptly ran out of stock again, it will be some weeks before I can test on a 1768...

I've published the source anyway, feel free to poke at it. [Edit: see below]

Note that it doesn't include FAT and file access functionality, as I was planning to plug it into mbed's FATFileSystem.

15 Jan 2010

 

Igor Skochinsky wrote:

Well, I spent half a day trying to get it working before I noticed in the datasheet that LPC2368 does not, in fact, have a USB host. $%#@%@#%!

And since Mouser shipped me a wrong device and promptly ran out of stock again, it will be some weeks before I can test on a 1768...

I've published the source anyway, feel free to poke at it. UsbHost

Note that it doesn't include FAT and file access functionality, as I was planning to plug it into mbed's FATFileSystem.

I tried out your UsbHost program, and once I load it onto my 1768, I wired up a USB port to my mbed, plugged in a usb flash drive, opened the terminal to see the out from the mbed, and the last statement I see displayed is

this one: PRINT_Log("In Host_Init\n");
I can not remember off hand if I saw this one: PRINT_Log("Initializing Host Stack\n");
I know I did not see this one: PRINT_Log("Host Initialized\n");

I also noticed that when I power up the mbed, the usb drive lights up, then goes out.
I didn't have any time to play with it any further last night.

15 Jan 2010

Try uncommenting the PRINT_Log("1\n") etc statements and/or add some more to pinpoint where exactly it stops.

19 Jan 2010

Thanks to some kind people I have a 1768 mbed earlier than expected. I made some progress, now it gets to "Connect a Mass Storage device". It could be that my electrical setup is wrong. I have published an updated source here: UsbHost

Changes:

1) commented out write to OTGStCtrl which was crashing the program. I'm not sure if configuring that register is necessary, the user manual is clear as mud.

2) declared USB_IRQHandler as extern "C" so it's picked up by the linker and is placed into the vector table.

You need to log in to post a reply