Go Down

Topic: USB host openwork to USB device ARDUINO (Read 3088 times) previous topic - next topic



I am trying to connect an Arduino to a TP link MR3020 via an USB cable. The USB cable is connected to end to the usb plug (host type) and to the Arduino USB plug (device type) on the other end. On the ARDUINO I have loaded the "PhysicalPixel" sketch which lit the led on the board when it receives a letter "H". When the Arduino is connected to my Windows PC it works perfectly. The letter "H" lit the led, the letter "L" shut it down.
When I connect the RDUINO to the MR 3020, it is reset at connection time and this normal due to the aoto rest mechanism in the UNO rev 3. But ad soon I send something from my MR 3020 to the ARDUINO it is also reset every time. As soon as the RX led on the ARDUINO board starts blinking, the board is reset what ever I am sending using the linux command echo xxxxxx > /dev/ttyACM0.
The setup :
- ARDUINO UNO V3 loaded with the PhysicalPixel" sketch loaded from the examples sketches from the ARDUINO environment ("04.Communication").
The MR3020 is loaded with OPENWRT attitude_adjustment http://downloads.openwrt.org/attitude_adjustment/12.09-beta2/ar71xx/generic/packages. This is the one recommended for the MR 3020on the official  Openwrt site.
The USB drivers loaded are  :
kmod-usb-acm - 3.3.8-1
kmod-usb-core - 3.3.8-1
kmod-usb-ohci - 3.3.8-1
kmod-usb2 - 3.3.8-1
When I disconnect and reconnect the USB cable I get the following messages on the MR 3020 console :
[199636.750000] usb 1-1: USB disconnect, device number 7
[199646.150000] usb 1-1: new full-speed USB device number 8 using ehci-platform
[199646.310000] cdc_acm 1-1:1.0: ttyACM0: USB ACM device.

the setting of the USB port on the MR 3020 is :
root@OpenWrt:/tmp# stty -F /dev/ttyACM0
speed 9600 baud; line = 0;
min = 1; time = 0;
-brkint -icrnl -imaxbel
-isig -icanon.

I have tried many changes to the setting but always with the same result.
Can someone help me.

Tks Rgds


few issues here:

1. you need set serial port like this

stty -F /dev/ttyUSB0 raw speed 38400 -echo -hupcl
the two additional flags are useful: -echo switches off the OpenWRT/USB habit of echoing every output back on the input -hupcl switches off the autoreset issue by not sending a hup after each transmission


2. Arduino reset bug, more less all the arduino uno have this bug , I have 5  of them all have same bug.

run: cat /dev/ttyACM0&
at  router start or put it at rc.local file

then  run

echo "H">/dev/ttyACM0  # turn on led
echo "L">/dev/ttyACM0 # turn off led

Go Up