First of all, i don't have much experience with electronics (i just programming).
I've got Arduino Yún with some electronic device that communicate via serial port. This device is connected to pin D0 and D1 - RX/TX (connected by my coworker).
I'm using Firmata protocol (i had to disable bridge in \etc\inittab) to communicate with 32U4 processor from Linux which works also via serial port (on path \dev\ttyATH0).
I need to communicate with both from Linux side and don't know how. I've found that Yún have two serial ports (Serial and Serial1). So it's possible to open both ports? What paths they would have?
Arduino Mega 2560
Serial: 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX) and 16 (TX); Serial 3: 15 (RX) and 14 (TX). Used to receive (RX) and transmit (TX) TTL serial data. Pins 0 and 1 are also connected to the corresponding pins of the ATmega16U2 USB-to-TTL Serial chip.
@sonnyyu: Thanks, but i would like use just Yún (if it's possible).
If i understand it, it could be done with something like this:
#include <Firmata.h>
void setup() {
...
Serial.begin(2400); // open USB serial (opens RX/TX on pin 0, 1 too), port ?????
Serial1.begin(9600); // open serial connection to Linino, port /dev/ttyATH0
Firmata.begin(Serial1);
...
}
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data using the ATmega32U4 hardware serial capability. Note that on the Leonardo, the Serial class refers to USB (CDC) communication; for TTL serial on pins 0 and 1, use the Serial1 class.
Serial is USB(CDC) port!
You might be able use SoftSerial lib, but mixed it with Firmata will be big mess.
I am electronic engineer background and thought that is biased.
Notionally the Yun has two serial ports but the way it is designed they are not generally available.
Serial0 is not a real serial port - it can only communicate over the USB cable
Serial1 is normally used to communicate with the Linux side of the Yun although that can be disabled - but then the Linux side cannot communicate with the Arduino side so it is no longer a Yun !
Maybe you can get an external serial device that connects to the Arduino over I2C or similar and that way add further ports.
AR9331 (Yun) one UART
AR9341 One low-speed UART (115 Kbps), one highspeed UART (3 Mbps)
AR9344 One low-speed UART (115 Kbps), one highspeed UART (3 Mbps)
QCA9558 One low-speed UART (115 Kbps), one highspeed UART (3 Mbps)
MT7628 two UART
MT7688 three UART
I think there is another option. You have usb host on the yun, right? Connect an ftdi breakout to it and you'll get an extra serial port on the linux enviroment.
mart256:
I think there is another option. You have usb host on the yun, right? Connect an ftdi breakout to it and you'll get an extra serial port on the linux enviroment.
Very nice idea.
Plan C:
USB to UART bridge:
FTDI USB Quad Serial Converter(FT4232H), 4 UART ports
FTDI USB Double Serial Converter(FT2232D, FT2232H), 2 UART ports
The ability to communicate with serial devices (GPS, RFID, servo controllers, LCD backpacks, etc) through the Firmata protocol is currently in progress. This will support both SoftwareSerial and HardwareSerial (for boards that have multiple UARTs).
When finalized, this will enable another option for what you are trying to accomplish. You could run StandardFirmataYun on the board. That will enable communication between the 32U4 and the Linux processor using StandardFirmata. You would then be able to communicate with a serial device connected to the 32U4 using SoftwareSerial (handled through Firmata).
However, it will still be several days before serial support is finalized in Firmata. It has not yet been added in StandardFirmataYun either, only in StandardFirmata so far.