USB HOST CDC/ACM serial port on Nano iot

this looks like I should be able to do USB host mode on Nano iot SAMD21.
(assuming I have setup the hardware correctly)
OTG cable looks right host on one end, device on other

need to send AT commands (20 chars) and receive responses... typically 3 chars, some 20chars.

anyone tried?

how does this compare to the board libs for Nano iot (1.8.x installed)

The question is not clear.

The Boards Manager installation of the "Arduino SAMD (32-bits ARM Cortex-M0+) Boards" platform for the Nano 33 IoT comes with a bundled "USBHost" library.

You will find some example sketches that demonstrate its usage under the File > Examples > USBHost menu in the Arduino IDE after you have selected Tools > Board > Arduino SAMD (32-bits ARM Cortex-M0+) Boards > Arduino Nano 33 IoT from the Arduino IDE menus.

That is all the documentation available for that specific library. However, the SAMD "USBHost" library is pretty much the same as the older library of that name for the Arduino Due board, and that older library does have more formal documentation here:
https://www.arduino.cc/en/Reference/USBHost

It is likely that information will mostly apply to the SAMD "USBHost" library as well.

sorry, didn't see the link wasn't used

that points here.

and has host support for CDC/ADM it seems..

looks like a board definition.. using same name as the official one

There is a dedicated section of the Arduino Forum for general discussion and project assistance:

http://forum.arduino.cc/index.php?board=98.0

That is an enhancement made to the official SAMD "USBHost" library back in 2016. This is the library I mentioned in my previous reply. You can try out the examples to see how it works.

It is the official one.

The Boards Manager installation of the "Arduino SAMD (32-bits ARM Cortex-M0+) Boards " platform for the Nano 33 IoT comes with a bundled "USBHost" library.

yes, but it doesn't include all the source as in the github repo.

Please provide a detailed description of what you mean by "it doesn't include all the source".

Please post a link to the source on GitHub that you found to be missing from the library installed on your computer.

what a difference a few hours makes..

i am lost again..

We are here to help you get unlost, but first we need to understand what the problem is.

All I know now is that you are missing some source code. But there must be some nuance becase every single bit of the source code from that repository is installed on your computer when you use the Arduino IDE Boards Manager to install the "Arduino SAMD (32-bits ARM Cortex-M0+) Boards " platform for the Nano 33 IoT.

thanks. I must have been looking at a different repo, but I can't find it now. but somehow got linked to the referenced one.

I need to mod the hardware to enable host mode to begin with, (waiting on tools)
have a cable, (waiting)

and then figure out what to do.

ok, no missing files, but this is the folder(on my mac) I was looking at instead of examples
(same repo, different folder)

Library/Arduino15/packages/arduino/hardware/samd/1.8.12/cores/arduino/USB

which contains these files

CDC.cpp			SAMD21_USBDevice.h	USBCore.cpp		USBDesc.h		samd21_host.c
CDC.h			USBAPI.h		USBCore.h		USB_host.h		samd21_host.h

which seems to have code for host and CDC on samd21

tools will be here today for the solder bridge to enable hardware host mode.
and an OTG cable

have another USB Host on samd lib to look at too..

The USBHost library is here:

Library/Arduino15/packages/arduino/hardware/samd/1.8.12/libraries/USBHost

But the USB stack code in the core is very interesting stuff.

Nice! It seems like a pretty interesting thing to investigate.

I actually haven't tried this. The closest I got was the old trick of using the PS/2 compatibility mode most keyboards and mice have to interface them with any Arduino board without needing to get fancy with USB host capabilities. But of course that is very limiting.

VUSB bridged , +5v in at VUSB, and OTG cable, device powers up!!..

so on to USB host mode!!

1 Like

excuse me,I meet the puzzle of yours ,ee, and i also want MKR WiFi 1010 to be a USB Host . I don't know how to bridge VUSB and open OTG ? Can you help me?

I have a OTG cable, but i am puzzle whether MKR 1010 needs a OTG driver when i connect MKR 1010 to a URG

the mkr 1010 doesn't have a bridge jumper like the nano iot..

the doc says

VUSB is output when in OTG mode. +5 generated from battery. don't know if that also means from VIN
see back of board in pinout pdf

so it sounds like it should work w the right library.

MKR 1010 can work with a battery, I have tried tried it with a battery and USB device could woke which was connected MKR 1010. But i could'n get message from USB device , I surmise MKR 1010 needs OTG driver.

and Thank you for your reply

u need to use USB host mode code

this lib works for me on nano

I have not found a similar lib from Arduino

thanks, I also finds this library ,but I don'n know how to use it . If MKR 1010 sends some command to Lidar of Hukoyu, and LIdar replys data to MKR 1010 ,I Just need "include <Usb.h> " and "USBHost usb"? Sorry , I first use Arduino last week :hot_face: I find tutorial of the Portenta H7 which woks as an USB host, the tutorial says USB OTG requires code.