usb problem

Greetings,

this is the scenario: the Atmega of my Yun has all of its pins used, except for its external usb bus (the Serial object); the Atmega is controlled by the Atheros Linux side processor. All works fine, even when I hook up the ide serial monitor from the IDE; I can see that the Atmega writes and reads fine to/from the Serial object. I want to connect the usb bus to a small device that has two serial lines, but it doesn't work; after reading this: USB On-The-Go - Wikipedia I think I understand why; one reason is that I supply power through that same usb bus and it makes the Atmega think it is the 'slave' side of the usb bus (while it isn't in my configuration).

I'm a math guy so I know nothing about hardware (I even leave the soldering to my brother :wink: the current usb configuration doesn't work (for obvious reasons) but I don't know how to make it work (i.e. make the Atmega communicate through its Serial object with the other device). Any help is appreciated (by my brother as well :wink:

kind regards,

Jos

ps. I added a usb/ttl converter between the Atmega and the other device. Both the Atmega and the other device communicate fine with my laptop ...

The yun has two usb connectors, which one are you plugging your device into?

I don't believe either of the yun's usb's are on-the-go. In the old days there were two usb modes, host and device. On-the-go is a recent addition that allows a unit to behave as either a device or a host depending on the cable/plug configuration. The micro-usb connector is connected to the AVR(leonardo) and operates in device mode. The usb-A connector is connected to the AR9331 (linino) and normally operates as a host. It may be able to operate as a device but I haven't played with that.

You likely want to plug your device into the usb-A and work with it through linino. It will appear in /dev/..., the name will depend on what it is. If you plug another arduino into this port it will be /dev/ttyACM0, a camera will show up as /dev/video0. dmesg will give info about what happens when you plug it in.

Allow me to explain my configuration: after the Linux (Linino) side has
booted, a Java program is started (jamvm) and its System.in and System.out
streams are hooked up to /dev/ATH0; before that program starts I set the
connection to 'raw' mode. On the AtMega side I read from the Serial1 object,
process the command and send back the reply (I have a dedicated sketch running
on the AtMega side).

If I kill jamvm I can still write commmands to /dev/ATH0 and read replies
from it by using the shell; everything works fine, similar as the 'bridge'
(I peeked in the Python code for details :wink:

On the AtMega side I implemented two simple commands to read from the Serial
object and write to it. As far as I know, the Serial object is connected to
the other USB bus (see that little connector). I want to connect a simple
GSM (GPRS) device that only speaks serial. I can use it by using the
SoftSerial class, but I don't have any pins left on the AtMega side ...

In short I want to do this:

Serial: communication between the AtMega and the GSM device;
Serial1: communication between the AtMega and the Linux (Linino) side.

The second part works fine but the first part is a show stopper so far ...

kind regards,

Jos

ps. I use Java because I get so much functionality for free in that language.

Serial1 on the AVR which is connected to /dev/ttyATH0 on the AR9331 has no USB functionality or hardware connection to the USB.

You could conceivably use the Serial1 connections on the Yun headers pin 0 and 1 to talk to your device but you will lose the connection to the AR9331 and should disable the connection to the AR9331 using gpio23 and make sure the device operates it's serial connection at 5V.

Serial on the AVR is a virtual USB device, a device only talks to a host. Your GSM device will need to have host functionality if you want it to communicate through this port, I doubt it does.

The USB host connector (A type) connects to linino through the /dev/??? interface if you want to talk to a device you need to do this in linino and pass the information to your sketch through Serial1.

I guess I'm out of luck then, i.e. I need the communication connection between the two processors (Serial1 <--> /dev/ttyATH0) but I can't connect my GPRS device to the AtMega processor through its Serial object. hm, I may have to use a SoftSerial object but I lose two pins, so I have to sacrifice a few other devices because now I don't have any pins left ...

thanks for thinking with me; much appreciated and

kind regards,

Jos