Hello,
I have connected my Arduino Yun via rs-232 shield to another computer. I am testing the serial communication by sending characters from the serial monitor to the hyperterminal of the other computer and vice versa. The characters I am sending from the serial monitor are appearing on the Hyperterminal of the other computer, but the input from the hyperterminal does not appear on the Serial monitor.
In other words, the communication is one-sided.
The data from the hyperterminal reaches the rs-232 shield, because I see the RX LED of the shield blinking in accordance. But the RX LED of the arduino itself is not reacting, therefore no data is visible on the serial monitor.
I am using a code similar to the provided SoftwareSerial example:
#include <SoftwareSerial.h>
#define rxPin 2
#define txPin 3
SoftwareSerial port1 = SoftwareSerial(rxPin, txPin);
void setup()
{
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
Serial.begin(9600);
while (!Serial){;
}
port1.begin(9600);
}
void loop()
{
if (port1.available())
Serial.write(port1.read());
if (Serial.available())
port1.write(Serial.read());
}
I am wondering if there is a hardware problem with the Yun or something more device specific has to be included in the code. I would appreciate some advice.
Thanks a lot.
I've experienced softwareserial issues not unlike what you're having - before i noticed this
"Not all pins on the Leonardo support change interrupts,
so only the following can be used for RX:
8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI)."
on the softwareserial page.
Try changing pins.
Plan B:
Use USB to RS232 adaptor:
http://forum.arduino.cc/index.php?topic=278719.0
It is PL2303 IC based.
The list of IC set of USB serial adapter
- USB serial adapter CH340
- USB serial adapter CP2012
- USB serial adapter FTDI
- USB serial adapter CDC/ACM (Atmel)
- USB serial adapter PL2303
Thank you very much for your replies ! The reason were the change interrupts indeed.
Previously, I saw this: "External Interrupts: 3 (interrupt 0), 2 (interrupt 1), 0 (interrupt 2), 1 (interrupt 3) and 7 (interrupt 4). " and I excluded these interrupts from the game since I had already tried using pins 0-7. Obviously, these are two different things.
Thanks a lot.
It is like a deja vú. This issue with software serial and interrupt pins always pops up.
mart256:
It is like a deja vú. This issue with software serial and interrupt pins always pops up.
That's probably in the vast majority of cases because people do not read the documentation and don't realize that there are
a) slight differences between a Yun and an Arduino Leonardo (on which the AVR part is based)
b) that there quite a few differences between the Yun/Leonardo and the Uno, for which most of the tutorials and libraries out there are based on/written for...
Ralf