Pages: 1 [2]   Go Down
Author Topic: An example of Arduino Due as an USB host mass storage  (Read 7692 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, my project files are for Atmel Studio 6.1 beta (ASF 3.7.2) You will need to use this version to load the project.

However, for you guys with ASF 3.5.x It's is fairly easy to get the existing ASF USB Host example working.

1) File->New->Example Project From ASF..

2) Select USB Host MSC FatFS and HID mouse example - Arduino Due/X

3) In src/ASF/sam/boards/arduino_due_x/arduino_due_x.h
* Un-define USB_ID_GPIO

4) In src/ASF/sam/boards/arduino_due_x/init.c
* remove the line:
gpio_configure_pin(USB_ID_GPIO, USB_ID_FLAGS);

5) In src/ui.c
* Remove ALL the code from ui_usb_sof_event()

That's all there is to it. it'll work!

If your using ASF 3.7.2 then you also need to replace sleep.c with the code from my previous message.

Regards,
Travis
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Travis,

I'm sorry if I'm still here but unfortunately my USB Host doltysen't work again.

Maybe you've also changed the main.c?

When I insert my pen drive into the USB port Host, (obviously not in programming port), nothing
happens and the red led of my pen drive remains off ... I tried with three pen drive.

Now I am trying to download Studio 6.1 with many difficulty because my internet is not very good,
then I'll try to open your demo.

Could you send to me your files. Bin so I can try if my Host USB  works?

my email is darighi@tin.it
Thanks again

Davide
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, Here me again.
At this point I think I have some problem in my Arduino board, because I installed studio 6.1, compiled your software and installed it on arduino, but it does not work!
Now I think what I can do yet.
thank you very much
David
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@David

Open up a terminal window and set it up for 115200,N,8,1
I use termite:
http://www.compuphase.com/software_termite.htm

You should get some output from the debug/programming port:

-- USB HOST HID/MSC Example --
-- Arduino Due/X --
-- Compiled: Apr 20 2013 16:29:49 --

[main]  MAX_DRIVE=8
[main]  Device Attached!
  VID=0x0930
  PID=0x6545
[main]  Sof Detected!


I've also added a pre-compiled version to my downloads:
http://usb-travis.googlecode.com/files/ARDUINO_DUE_USB_HOST_HIDMSC.bin

I've tried a couple different FAT32 formatted flash drives and they both work:
  • Scandisk Cruzer 2GB
  • Kingston DT108 8GB


Regards,
Travis
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Travis Hello and thank you for your software.
At the moment I had not success to make it work, no messages is writes inside the pen drive, but I have seen where I might be wrong!
I provide an external 12V power supply and then I insert the Pen Drive but I don't connect the USB cable for serial communication because I have not space since my cable has a connector at 90 degrees and so there is not space to connect it.

By doing so, I saw that the TX LED does not light up so I understand that it doesn't transmit data via serial port, and seems to not work.

If you only connect the serial cable, I see the TX LED light up for a brief period necessary enough to send the serial message but I can't insert the pen drive due to the low space.

Now I wonder: peraphs without the serial cable, arduino stops the execution of the software?

Tomorrow I'll take home from my office a usb cable straight, and try to see if it works.

Best regards and thank for your support.

Davide
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes you are right!  It doesn't work when an external power source is connected.

In src/ASF/sam/boards/arduino_due_x/arduino_due_x.h:
  • Un-define USB_VBOF_GPIO
  • You will also have to remove its gpio_configure_pin() call in init.c

This will make it work with an external power source.  This is probably not the "correct" way to do this.  When I have some more time to play with it I'll look at the schematic and reply back.

Regards,
Travis
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Travis,
   finally works! Thank you very much smiley

I did not tried the latest changes you suggested to me, but I provided power by USB cable and now writes the file in the pen drive!  Yessss! smiley

Really thank you very much and if you come in Italy remember to stop at my house that I offer a pizza or whatever you want smiley

If I'll do something of interesting with the Host USB I'll post to you.

Best Regards
Davide
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks like some interesting work on USB host - I've had to put my project aside but interested to try this out at some point.

I believe the USB Host powering on external power has some issues - here is my reading of it, see my posts
http://arduino.cc/forum/index.php/topic,140839.0.html
http://arduino.cc/forum/index.php/topic,135399.0.html
http://arduino.cc/forum/index.php/topic,146574.msg1173826.html#msg1173826
I was wondering if there was a place to post this as a bug?
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for your post.
For atmel software framework bug I wrote to atmel but for this bug I don't know where you can post it.
Best regards.
Davide
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nice Work smiley

When i connect pen drive to native port of Due it is showing Vendor ID and Product id

But when i connect ipod to native port it is not showing anything..

Any idea why it is not showing smiley-sad
Logged

Pages: 1 [2]   Go Up
Jump to: