Go Down

Topic: MKRZero USB host Serial Monitor (Read 1 time) previous topic - next topic

arduinochris

Hi there, I have a MKRZero and have sucessfully run the USB Mouse Host demo found here ArduinoCore-samd.


I want to be able to connect another arduino by usb as a client device and read data much like the arduino monitor. i can physically connect the two arduinos together, however I cant understand the ArduinoCore-samd library well enough to be able to do this.

I will keep trying in the meantime, but guidance is appreciated.


arduinochris

Hi, just an addition to my post. I can read the descriptor of the Arduino client device. I just cant read serial data from it. Thanks!

ballscrewbob

Hi Chris.

The sketches being used may be helpful. (use code tags ( </> )
Reading the PID VID is easier than reading the data stream.

Also a schematic might be useful as the MKRZERO doesn't have a native HOST port so I presume you are using some sort of OFFBOARD adaptor ?


It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

arduinochris

Hi, I have attached the code. Its too large to embed.

I have a bus pirate connected to the MKRZERO uart pins for printing debug info.

Thanks!

arduinochris

I am also using a micro usb to usb adaptor to plug my devices into.

ballscrewbob

#5
Aug 07, 2018, 02:38 pm Last Edit: Aug 07, 2018, 02:40 pm by ballscrewbob
So an OTG device.
They are normally OK and it is a clever idea.

Most people use a variation of "software serial" to get two Arduinos to talk to each other.
Sort of similar to using the bus pirate device.
It does eat up two pins that can usually be defined in the sketch TX, RX, and a common ground.

It might be easier than trying to learn the SAMD libraries for now.
It seems you are attempting to almost triplex or relay the serial and the SWSERIAL is a good way to do that with more examples available to play with.

Look at SERCOM for the SAMD21 as that may also give you additional clues to getting the bus pirate to read too.

Am right on the edge of my skill level here too but know enough to be dangerous LOL.


EDIT TO ARDUINO EXAMPLE SERCOM






It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

arduinochris

Hi, thank you but the application requires communication over USB. I can already communicate two arduinos over uart, spi and I2C.

gdsports

As far as I understand you want the MKRZero to behave like a PC when you plug in another Arduino board. For example,

Code: [Select]
Arduino Uno+16u2 <-> USB OTG host cable <-> MKR Zero

The Uno+16u2 presents itself as a USB CDC ACM serial device. But the MKR Zero in USB host mode does not have a driver for this. You could write a driver but it is a lot of work and there are no docs except for the source code.

If you do not want to write a driver, there are two options.

  • USB Host Shield Library for the MAX3421E controller
  • Teensy 3.6 USB Host

I have not used USB CDC ACM on either one but have heard they both work.  As far as I know, the UHS Library does not work on MKR/samd21 boards but does work on AVR, ESP, Teensy, and Due.

WARNING: Clone boards do not always use the 16u2 chip so may require a different driver.

arduinochris

Thank you gdsports! Yes that is exactly what I am trying to acheive.

I have a teensy 3.6 and a due so will be trying that today. The teensy 3.6 option is suiible for the size restrictions of the application. I have also ordered a USB host breakout board from hobbytronics to try aswell.

Just to add I have made a raspberry pi zero w implementation of what I want to do but it uses more power than the application allows.

Thanks again and I will reply with how I get on.

arduinochris

Hi,

I have this all working now using a USB host board from hobbytronics.

Thanks everyone for helping.

mjunior-fitec

Hi,

I have this all working now using a USB host board from hobbytronics.

Thanks everyone for helping.
Hello Chris, I have almost the same situation as you did. I have a MKR family (MKR WAN 1300) board which I need to use it's USB host to communicate with a device that has a prolific USB-serial converter as its only comm interface.
I would like to know if there is a way to do it, without writing a device driver to it. I was wondering if I can found a CDC USB lib for Arduino, enabled for SAMD processor.

Thanks,
Marcio Jr.

gbafamily

Did you try this library? There is a pl2303 example. https://github.com/gdsports/USB_Host_Library_SAMD

Go Up