I wanted to share an example from Atmel ASF that shows how to implement a USB host mass storage on Arduino Due with USB module.
I have upload the .bin file in github for those interested to test it. If you want to move forward with this application, I'd recommend to install Atmel Studio 6 with ASF and build/compile the Arduino Due based example called "USB Host MSC FatFS example". I could write a sketch for Arduino IDE but you have to be patient.
For this application you will need:
- Arduino board
- Flash memory card (FAT or FAT32)
- A USB to mini-USB cable
- Bossac.exe in you computer
- Download my HOST_EXAMPLE21.bin file from github
Then, follow these steps:
1. Download the file HOST_EXAMPLE21.bin from this link:
https://github.com/downloads/Palliser/Arduino-DUE/HOST_EXAMPLE21.bin (https://github.com/downloads/Palliser/Arduino-DUE/HOST_EXAMPLE21.bin)[font=Verdana]1.1. Download the file HOST_EXAMPLE21.bin attached to this post (EDITED: March-05-2014).[/font]2. Load HOST_EXAMPLE21.bin to Arduino Due using bossac.exe as follows:
bossac.exe --port=COM23 -U false -e -w -v -b HOST_EXAMPLE21.bin -R
Notice that I am using port 23 because that is the port in my laptop where my Due is connected.
3. After loading HOST_EXAMPLE21.bin in your Due, connect Due to a Flash Memory card (FAT/FAT32 are supported) using the USB-mini USB cable.
4. Finally disconnect the memory stick from Due and read it in your computer. The example creates in your memory card (stick) a file "uhi_msc_test.txt" that contains the text: Arduino Due Rocks!
If you want to create your own file and text you'll find the example in Atmel Studio 6 as follows:
File->New->Example Project from ASF->[Under Kit] Arduino Due X->USB Host MSC FatFS example
Regards!
Wow, this looks nice!
Can it be ported to arduino IDE easily?
@Palliser
Waiting to test this now... Did you figure out how to upload directly from Atmel Studio onto Due?
Hello pracas. That is in my pending list to-do. I got my Atmel SAM-ICE JTAG emulator/programmer last week but still having issues to connect it with Due. It's a matter of time for me but I am a kind of busy with my work and other projects. Please, keep an eye of my post:
http://arduino.cc/forum/index.php/topic,134907.msg1014628.html#msg1014628 (http://arduino.cc/forum/index.php/topic,134907.msg1014628.html#msg1014628)
So far for my understanding, using a JTAG is the only way to program Due through AS6. You can do it with Arduino UNO without problems thanks to avrdude.exe, but the SAM3X8E is another story. regards!
Dear Palliser,
I have been looking for the USB host mass storage for Arduino Due and I found only your forum discussing it. I am in severe need of this thing, I tried bossac.exe approach but its showing that no device is found in com port where my arduino is there. Also I didnt understand the method of Atmel Studio 6. Though I downloaded atmel studio 6 and found that example, I dont know how to load the program to my arduino coz I dont have the SAM-JTAG or whatever it is. It would be very thankful to have a program for this in Arduino IDE. I know you are working on it, atleast till then by what approach I could make USB mass storage working?
Waiting for your reply restleslly
USB host mass storage is the only example I couldn't get to work on my due. I'm a due newbie but it never receives an sof event when I plug my 2gb scandisk cruzer.
IE: This line:
if (main_usb_sof_counter > 2000) {
// ..NEVER HAPPENS..
}
Has any one had any luck with this?
Regards,
Travis
Hi Travis,
me too I've problems with Arduino Due Host example.
First all, I'm not able to find the HOST_EXAMPLE21 of Palliser, but no problem, I compiled the Atmel ASF example and installed it into my arduino but me too I've not soft event.
Atmel said to me to format my Pen drive as FAT32 and try again, also with other Pen drive but for now anything of positive happens :).
Good luck and please tell me if you are able to run the USB Soft software.
best regards at all
Davide
@darighi
Thanks for the reply.
I have tried FAT16 and FAT32 with a variety of sector sizes. I think it has nothing to do with this. I'm convinced it has something to do with VBUS power. When I press reset on the DUE board my flash stick will power for a second and then it shuts off as soon as the Atmel host stack initializes.
It is definitely a firmware problem because the Adruino host library works but unfortunately no MSC support! Furthermore, the Atmel MSC+HID mouse usb host example doesn't work either when connected to my Logitech trackball. This same mouse works fine with the Arduino USBHost library (MouseController Example).
Obviously no one at Atmel/Adruino bothered to test this... As you say, Palliser's example doesn't exist but even money says it never worked in the first place!
I will keep you posted; please do the same. Feel free to PM me.
Regards,
Travis
travis_robinson@comcast.net
Author of:
libUsbK (http://sourceforge.net/projects/libusbk/)
LibUsbDotNet (http://sourceforge.net/projects/libusbdotnet/)
Hi Travis
Also on EVK1101 the host msc example
doesn't work.
Atmel wrote to me that he is able to run this
software on EVK1101 but My pen drive led
doesn't light on also.
Sorry for my bad English but I hope you understood what I told
I will keep you posted too if I will find a solution.
Good work
Davide
I finally got it to work!
Lemme go my codes and I will post a reply shortly.
Regards,
Travis
[SOLVED]
There were 3 problems working against us.
1) src/ASF/sam\boards/arduino_due_x/arduino_due_x.h
* Un-define USB_ID_GPIO and remove any references to it to force host mode.
2) src/ASF/sam/drivers/pmc/sleep.c
* pmc_save_clock_settings() and pmc_restore_clock_settings() don't work properly in ASF 3.7.2. These functions were re-worked with code from ASF 3.5.
3) src/ui.c
* ui_usb_sof_event()
* Reads a push button that doesn't exist on a stock board.
* This creates a scenario where the device will not work the first time it's plugged or if it is already connected when the application starts.
Download my re-worked version here:
http://usb-travis.googlecode.com/files/ARDUINO_DUE_USB_HOST_HIDMSC.zip (http://usb-travis.googlecode.com/files/ARDUINO_DUE_USB_HOST_HIDMSC.zip)
NOTE: When you create a new project with ASF 3.7.2, use sleep.c from the code above. Hopefully Atmel will fix the bugs in the next ASF release.
sleep.c
/**
* \file
*
* \brief Sleep mode access
*
* Copyright (c) 2013 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
/* [TR]
* pmc_save_clock_settings() and pmc_restore_clock_settings() don't work properly
* in ASF 3.7.2. These functions were re-worked with code from ASF 3.5.
*/
#include <compiler.h>
#include "sleep.h"
/* SAM3 and SAM4 series */
#if (SAM3S || SAM3N || SAM3XA || SAM3U || SAM4S || SAM4E)
# include "pmc.h"
# include "board.h"
/**
* Save clock settings and shutdown PLLs
*/
__always_inline static void pmc_save_clock_settings(
uint32_t *p_osc_setting,
uint32_t *p_pll0_setting,
uint32_t *p_pll1_setting,
uint32_t *p_mck_setting)
{
if (p_osc_setting) {
*p_osc_setting = PMC->CKGR_MOR;
}
if (p_pll0_setting) {
*p_pll0_setting = PMC->CKGR_PLLAR;
}
if (p_pll1_setting) {
#if (SAM3S || SAM4S)
*p_pll1_setting = PMC->CKGR_PLLBR;
#elif (SAM3U || SAM3XA)
*p_pll1_setting = PMC->CKGR_UCKR;
#else
*p_pll1_setting = 0;
#endif
}
if (p_mck_setting) {
*p_mck_setting = PMC->PMC_MCKR;
}
// Switch MCK to Main clock (internal or external 12MHz) for fast wakeup
// If MAIN_CLK is already the source, just skip
if ((PMC->PMC_MCKR & PMC_MCKR_CSS_Msk) == PMC_MCKR_CSS_MAIN_CLK) {
return;
}
// If we have to enable the MAIN_CLK
if ((PMC->PMC_SR & PMC_SR_MOSCXTS) == 0) {
// Intend to use internal RC as source of MAIN_CLK
pmc_osc_enable_fastrc(CKGR_MOR_MOSCRCF_12_MHz);
pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_12_MHz);
}
pmc_switch_mck_to_mainck(PMC_MCKR_PRES_CLK_1);
}
/**
* Restore clock settings
*/
__always_inline static void pmc_restore_clock_setting(
uint32_t osc_setting,
uint32_t pll0_setting,
uint32_t pll1_setting,
uint32_t mck_setting)
{
uint32_t mckr;
if ((pll0_setting & CKGR_PLLAR_MULA_Msk) &&
pll0_setting != PMC->CKGR_PLLAR) {
PMC->CKGR_PLLAR = 0;
PMC->CKGR_PLLAR = CKGR_PLLAR_ONE | pll0_setting;
while (!(PMC->PMC_SR & PMC_SR_LOCKA));
}
#if (SAM3S || SAM4S)
if ((pll1_setting & CKGR_PLLBR_MULB_Msk) &&
pll1_setting != PMC->CKGR_PLLBR) {
PMC->CKGR_PLLBR = 0;
PMC->CKGR_PLLBR = pll1_setting ;
while (!(PMC->PMC_SR & PMC_SR_LOCKB));
}
#elif (SAM3U || SAM3XA)
if ((pll1_setting & CKGR_UCKR_UPLLEN) &&
pll1_setting != PMC->CKGR_UCKR) {
PMC->CKGR_UCKR = 0;
PMC->CKGR_UCKR = pll1_setting;
while (!(PMC->PMC_SR & PMC_SR_LOCKU));
}
#else
UNUSED(pll1_setting);
#endif
/* Switch to faster clock */
mckr = PMC->PMC_MCKR;
// Set PRES
PMC->PMC_MCKR = (mckr & ~PMC_MCKR_PRES_Msk)
| (mck_setting & PMC_MCKR_PRES_Msk);
while (!(PMC->PMC_SR & PMC_SR_MCKRDY));
// Set CSS and others
PMC->PMC_MCKR = mck_setting;
while (!(PMC->PMC_SR & PMC_SR_MCKRDY));
/* Shutdown fastrc */
if (0 == (osc_setting & CKGR_MOR_MOSCRCEN)) {
pmc_osc_disable_fastrc();
}
}
/** If clocks are switched to FASTRC for WAIT mode */
static volatile bool b_is_fastrc_used = false;
void pmc_sleep(int sleep_mode)
{
switch (sleep_mode) {
case SAM_PM_SMODE_SLEEP_WFI:
case SAM_PM_SMODE_SLEEP_WFE:
#if (SAM4S || SAM4E)
SCB->SCR &= (uint32_t)~SCR_SLEEPDEEP;
cpu_irq_enable();
__WFI();
break;
#else
PMC->PMC_FSMR &= (uint32_t)~PMC_FSMR_LPM;
SCB->SCR &= (uint32_t)~SCR_SLEEPDEEP;
cpu_irq_enable();
if (sleep_mode == SAM_PM_SMODE_SLEEP_WFI)
__WFI();
else
__WFE();
break;
#endif
case SAM_PM_SMODE_WAIT: {
uint32_t mor, pllr0, pllr1, mckr;
cpu_irq_disable();
b_is_fastrc_used = true;
pmc_save_clock_settings(&mor, &pllr0, &pllr1, &mckr);
/* Enter wait mode */
cpu_irq_enable();
pmc_enable_waitmode();
cpu_irq_disable();
pmc_restore_clock_setting(mor, pllr0, pllr1, mckr);
b_is_fastrc_used = false;
cpu_irq_enable();
break;
}
case SAM_PM_SMODE_BACKUP:
SCB->SCR |= SCR_SLEEPDEEP;
#if (SAM4S || SAM4E)
SUPC->SUPC_CR = SUPC_CR_KEY(0xA5u) | SUPC_CR_VROFF_STOP_VREG;
cpu_irq_enable();
__WFI() ;
#else
cpu_irq_enable();
__WFE() ;
#endif
break;
}
}
bool pmc_is_wakeup_clocks_restored(void)
{
return !b_is_fastrc_used;
}
#endif /* #if (SAM3S || SAM3N || SAM3XA || SAM3U || SAM4S || SAM4E) */
Regards,
Travis
Fantastic!!!
Travis, I thank you very much!
As soon as possible I'll try to load your beautiful work on arduino.
I think that I'll have time only friday evening and then I'll tell you how does my trial is gone.
Thanks again, well done, beautiful job!
Davide
Hi Travis,
I opened your project in Atmel Studio6, but only the project folders are visible, and I could not open file main.c (or any others) in the GUI.
http://usb-travis.googlecode.com/files/ARDUINO_DUE_USB_HOST_HIDMSC.zip
I presume project folders are expected to be portable???
My ASF is version 3.5.1. Perhaps this is the problem. Do you know how to upgrade to ASF 3.7.2, 3?
Regards,
James
Hi Jaes i'm Davide and me too I've problems to open the software.
I saw that Travis Use Studio 6.1, not 6.0. May be the problem is that.
Now I'm downloading the new version, "full" that contain ASF 3.7.2 too.
goto: Help->Check for Updates
Best Regards
Davide
sorry in the previous message I missed an 'm'.... James.
:)
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
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
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
@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 (http://www.compuphase.com/software_termite.htm)
You should get some output from the debug/programming port:
[font=Courier]
-- 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!
[/font]
I've also added a pre-compiled version to my downloads:
http://usb-travis.googlecode.com/files/ARDUINO_DUE_USB_HOST_HIDMSC.bin (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
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
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
Hello Travis,
finally works! Thank you very much :)
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! :)
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 :)
If I'll do something of interesting with the Host USB I'll post to you.
Best Regards
Davide
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?
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
Nice Work :)
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 :(
cause an ipod isn't a genuine USB massstorage device, it's an apple whatever-device.
This topic is one of the most important for practical use, although I can't test it, because I don't have Atmel Studio.
Is there an existing solution/example to be used with arduino IDE?
Thanks!
This topic is one of the most important for practical use, although I can't test it, because I don't have Atmel Studio.
Is there an existing solution/example to be used with arduino IDE?
Thanks!
Yes and no.
There is a "enumerate USB devices on DUE " posted ( about year old ) and no discussion on that.
That is based on "USBHost class" and works, It will identify USB info on mouse , keyboard , flash drive and webcam ( tested so far).
The MSC ASF sample code is a challenge to "port" to DUE. The true ASF code is documented and has a nice debug trace macro. I got as far as CONFIGURE and cannot get pass detecting end points. ( The header files contents is pretty inconsistent - sometime only #defines, sometime mixture of classes ). So I am going to use the enumerating code to get the USB device to RUNNING state and than add the MSC ( heavilly modified I expect). I am still not sure how to actually communicate from DUE to "MSC controller". But again ATmel puts out tons of API (USB) notes, nice.
I wanted to share an example from Atmel ASF that shows how to implement a USB host mass storage on Arduino Due with USB module.
I have upload the .bin file in github for those interested to test it. If you want to move forward with this application, I'd recommend to install Atmel Studio 6 with ASF and build/compile the Arduino Due based example called "USB Host MSC FatFS example". I could write a sketch for Arduino IDE but you have to be patient.
For this application you will need:
- Arduino board
- Flash memory card (FAT or FAT32)
- A USB to mini-USB cable
- Bossac.exe in you computer
- Download my HOST_EXAMPLE21.bin file from github
Then, follow these steps:
1. Download the file HOST_EXAMPLE21.bin from this link:
https://github.com/downloads/Palliser/Arduino-DUE/HOST_EXAMPLE21.bin (https://github.com/downloads/Palliser/Arduino-DUE/HOST_EXAMPLE21.bin)
[font=Verdana]1.1. Download the file HOST_EXAMPLE21.bin attached to this post (EDITED: March-05-2014).[/font]
2. Load HOST_EXAMPLE21.bin to Arduino Due using bossac.exe as follows:
Notice that I am using port 23 because that is the port in my laptop where my Due is connected.
3. After loading HOST_EXAMPLE21.bin in your Due, connect Due to a Flash Memory card (FAT/FAT32 are supported) using the USB-mini USB cable.
4. Finally disconnect the memory stick from Due and read it in your computer. The example creates in your memory card (stick) a file "uhi_msc_test.txt" that contains the text: Arduino Due Rocks!
If you want to create your own file and text you'll find the example in Atmel Studio 6 as follows:
File->New->Example Project from ASF->[Under Kit] Arduino Due X->USB Host MSC FatFS example
Regards!
Hi Palliser, I read the post, and I'm interested at your arduino due "library" if I can call it in this way, but I read that:
1. It can only be used on SdCard; and I want to use it on USB pens,
2. For using it I must program directly the ARM processor, and I don't have much time to learn how-to-use/program it,
What should I do? I want to simply read/write variable text files on usb pens with my Arduino 2 but without buy an USB Host Shield...
Regards and thanks in advance for the help
Hola Juan,
I must say I am half way to finish my porting of the Atmel ASF example for Due. I just need time to finish it (nowadays I am busy at my work). I hope to have the library and raw example (write/read USB memory stick) ready by the end of this Summer, thus, it is about to wait. Regards,
p
Hola Palliser, gracias for the answer
But that's the problem, I must make a school project with it, and I don't have enough time to expect the summer. I want only to ask you if there's an alternative to create the "library code" for rd/rw usb pen drive. For example, can the USB Host Library 2.0 be used for this on Arduino Due without buy an USB Host Shield? I think not but I can myself wrong...
Juan: I've tried USB Host Library 2.0 and it most definitely can not be used with the Due. Everything is written for the MAXIM usb host chip. So all the MAXIM code needs to be replaced with SAM3 uhc code.
On a more positive note! This ASF example is great news for me! I want to have keyboard + usb stick connected to the Due at the same time and it looks like Palliser's example can do just this?
Is there any easy way to convert this to the Arduino IDE?
well, i'm already trying to hack and get this working on plain old arm-gcc..
afaik, Atmel/Arduino are working on a new USB host stack for both Due and Zero. It will have the support of Mass Storage. No milestone announced yet. Regards,
p
Holy shit, that would be amazing!! Thanks for that news!!
I've even gone so far as to turn the entire USBHost system into statemachines. Costing me a whole week of development alone. It works, but mass storage had to be backported from USBHost 2.0/3.0 and that's no walk in the park.
Palliser: Is there any way I could come into contact with Atmel or Arduino about this new development. If possible, I would like to help!
Cheers!
hi all
I have a small doubt, at time of programming using bossac.exe file my USB cable connected to Programming port or Native USB port
hi all
I have a small doubt, at time of programming using bossac.exe file my USB cable connected to Programming port or Native USB port
Hello vinod_chinthoti,
You can use any of the Arduino Due USB ports (Programming or Native) but make sure you use:
'false' with USB Programming port
'true' with USB Native port
Example:
Let's say...
...your directory_path_to_bossac' is: C:\Users\YourName\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.6.1-arduino
...your 'directory_path_to_program' is: C:\Users\YourName\AppData\Local\Temp\arduino_build_805975
...your program is: program.ino.bin
...you USB Programming port is: COM2
...you USB Native port is: COM3
Then:
When connected to USB Programming port (COM2):
directory_path_to_bossac\bossac.exe --port=COM2 -U false -e -w -v -b \directory_path_to_program\program.ino.bin -R
-------------------------------------------------------------------------------------------
Example when connected to USB Native port (COM3):
directory_path_to_bossac\bossac.exe --port=COM3 -U true -e -w -v -b \directory_path_to_program\program.ino.bin -R
Regards,
-p
Hola Juan,
I must say I am half way to finish my porting of the Atmel ASF example for Due. I just need time to finish it (nowadays I am busy at my work). I hope to have the library and raw example (write/read USB memory stick) ready by the end of this Summer, thus, it is about to wait. Regards,
p
Добрый день Palliser.
Вы завершили проект?
Hello guys, I need your help... please.
I followed all the recommendations of Travis .... Termit 3.4 shows me -
USB HOST HID / MSC Example -
- Arduino Due / X -
- Compiled: Feb 3 2019 03:48:48 -
[main] MAX_DRIVE = 8: [main] Device Attached!
Vid = 0x1307
PID = 0x0165
[main] Sof Detected!
[main] create file
where "create file" its my debug string from function
res = f_open (& file_object,
(char const *) test_file_name,
FA_CREATE_ALWAYS | FA_WRITE);
if (res == FR_OK)
{DbgPrint ("create file"); }
everything seems to be ok, but when connect my USB stick(fat32) to the PC, I don't find file (uhi_msc_test.txt) . I'm trying to figure it out the third day .. Please help me.
if i call :
res= f_mkdir ((char const *)test_file_name);
DbgPrint("f_mkdir=%d",res);
I get :
[main] f_mkdir=8 // FR_EXIST /* (8) Acces denied due to prohibited access */
---------
thank you for your help
Hi guys! Is there any news on code migration to ARDUINO IDE?
I tried to create a reading based on the USB HOST library but it was without result, it only works with the mouse and keyboard.
Whether prompt there is a decision to use USB storage with Native Usb from Arduino Due?
For those who don't want to wait for an hypothetical Arduino release of a USB Host Mass Storage library for the DUE, and if you have some spare time (~ 6 months) :) , read chapter 17 of Benjamin David LUNT book: "USB : The Universal Serial Bus". There is everything you need for a USB Mass Storage driver implementation to handle your favorite thumb drive.
Although it's for video streaming only, I warmly recommend the preliminary reading of the following tutorial:
https://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=7828517 (https://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=7828517)
The DUE embeds a USB 2.0 compliant High Speed capable peripheral usable either as a Host or a Device.