Connect Yun to itself - and free up the HardwareSerial port

I have not been able to find what I want with Google - but perhaps I was not asking the correct question.

It occurs to me that it may be possible to connect the Linux USB-A connection to the Arduino micro-USB connection so that the Linux side can communicate with the Arduino side in the same way that my laptop communicates with my Uno (or Leonardo).

That should mean that the Rx and Tx (Serial1) pins on the Arduino would be free to communicate with other devices.

Obviously there needs to be another source of power for the Yun. I believe it can be powered with 5v applied to Vin or Vcc. However I have a Y-shaped USB cable with two male USB-A connectors and one of them does not have the data pins connected. I think it could be connected to a USB "wall-wart".

Has anyone considered this ?

...R
Edit 15 Oct 2015 to extend the title

To be able to use the Serial1 pins, you will need to disconnect them from the AR3391 processor. It looks like GP23 from the Linux side controls the level,shifter between the two processors. Worse comes to worst, you can also pull the R62 and R63 zerohm jumpers to definitely isolate it.

I have done something like what you say: connect the host side plug of a powered USB hub into the AR3391 host USB connector. Then plug the microUSB of the '32U4 into the hub. I was doing that so I could use the hub to power some USB devices accessed by Linux, and also power the Yun from the hub at the same time. I wasn't trying to access the '32U4 through this link, but it was recognized as it changed the /dev/event* IDs of the other devices. I didn't look to see if it was recognized as a /dev/tty* device: you may have to load a specific driver for it to be seen properly.

Of course, it goes without saying that the Bridge won't work over that channel. You will either have to edit the Bridge library to use the different port, or roll your own communications protocol over that port - which is no doubt what you would do (since you appear to have a philosophical aversion to the Bridge. :wink: ) I know you know this, I'm just mentioning it for others who are reading this who may not have thought it through this far.

Thanks @ShapeShifter - very useful as usual. I will try to digest what you have said in the morning and have another look at the Schematic. If hardware modifications are needed I will drop the idea.

I was thinking that I could start by seeing if I could communicate between the Linux side and an Uno using the host plug.

You are correct about my views on the Bridge, but it seems an even more serious shortcoming that there is no free hardware serial port.

…R

Robin2:
but it seems an even more serious shortcoming that there is no free hardware serial port.

Agreed. And this probably the point where sonnyyu will come in and suggest using a Dragino Yun Shield with an Arduino Mega 2560 which will give you four hardware serial ports. :wink:

After a series of careful step-by-step experiments I am pleased to say that it works.

I temporarily powered my Yun from the 5v pin on an Uno and connected the Yun's USB host socket to the micro USB socket.

[Edit 07 Oct 2015 ...]
I forgot to note that it was necessary to add a kernel module to the Yun so that it would recognize the Arduino as /dev/ttyACM0. The commands for this were
opkg install kmod-usb-serial
opkg install kmod-usb-acm
I'm not actually sure if both are needed, but the second certainly was.
[/edit]

I connected my PC to the Yun using SSH over WiFi and I was able to run my Python demo program on the Linux side with my Arduino program on the 32u4 side.

These are essentially the same programs as in this Python - Arduino demo.

In the course of all this I had disabled the use of ttyATH0 by the Yun console.

Separately I tested that I could successfully communicate between Serial1 on the Yun and Serial1 on the Mega. I did nothing with GPIO 23.

...R