Using Host USB to connect to a USB device

I want my due to connect through its native USB port to a device to carry some simple (ASCII) communication with a device that when connected to a PC it becomes a virtual COM port so I can use TeraTerm or whatever with it. But want Arduino to replace the PC.

My question is, I think, as simple as this: will the USBHost library support communications with this kind of device? (I think it will try to enumerate as a CDC).

I’m asking this as after looking at the USBHost reference page it only talks about keyboards and mouse.

AtmelStudio has a module for USB Host where it is possible to select between different classes including CDC and I can’t see this in the Arduino Due library. Is then possible to use that ASF module at least?

Thanks in advance for your answers,
Joan

AtmelStudio has a module for USB Host where it is possible to select between different classes including CDC and I can't see this in the Arduino Due library. Is then possible to use that ASF module at least?

The sad answer to your question is - USBHost "ported" to Arduino is of very limited use, as you already noted - keyboard / mouse. The main reason is the Setup /Loop concept. To utilize native USB port you need interrupts and ASF. Adopting ASF for Arduino is slow process ( it was for me ) but worth it. The main issue is that ASF is C code and not that easy to adopt to object oriented AKA class project.

Unfortunately I am currently sidetracked by another project and my "USB" code is in shambles. Try Googling for "minimal MSC" - I used that project to navigate thru USB code and actually connected USB port to flash drive. But that is where my project is now.

Hi Joan,

ASF seems to be way ahead of the Arduino Due libs. Just today I got some news that Atmel/Arduino will make USB Host libs for the Zero. So, that gives a lot more hope for the Arduino Due, too!

Vaclav: have you already ported the ASF USB Host code to Arduino? I was also busy with this.. Do you have your code online somewhere?

Cheers,

Pieter

earx: Hi Joan,

ASF seems to be way ahead of the Arduino Due libs. Just today I got some news that Atmel/Arduino will make USB Host libs for the Zero. So, that gives a lot more hope for the Arduino Due, too!

Vaclav: have you already ported the ASF USB Host code to Arduino? I was also busy with this.. Do you have your code online somewhere?

Cheers,

Pieter

Sorry, I do not post my code in public. I need to finish my current project before I get back to my USB video code. I guess about two weeks or so. I basically modified the "minimal MSC " code. As I mentioned, the only drawback of ASF is it is not C++ code AKA object oriented. When I was working using ASF some fellow was attempting to wrap the ASF code into C++, but I lost contact with him. And I am not that smart to try it myself.

i don't really care about C++, C is fine too. :) yeah, i think i encountered the minimal msc code also and i'm trying to get that to work under my own gcc + asf libs + makefile system.. but it hangs at

// Check USB clock while (!Is_otg_clock_usable());

somewhere in uhd_enable() inside the uotghs_host.c .. have you ever encountered this?

earx: i don't really care about C++, C is fine too. :) yeah, i think i encountered the minimal msc code also and i'm trying to get that to work under my own gcc + asf libs + makefile system.. but it hangs at

// Check USB clock while (!Is_otg_clock_usable());

somewhere in uhd_enable() inside the uotghs_host.c .. have you ever encountered this?

Sorry, I really cannot "switch" to USB right now, I am up to my neck in SAM's registers. I am rebuilding UTFT class I need to make some GUI for my next project.

As far as ASF lack of C++ I am trying to go "modular" and like to build my code using inheritance etc. I agree, C is just fine but I have few "classes" already build so I want to got that direction.

Hm, UTFT. I also heavily modified this for the Due (and SSD1289). a very large speedup can be gained here.