Serial communication to Arduino boards not working

Status
Not open for further replies.

MrGlasspoole

Well-known member
Serial communication with Arduino boards not working

Hi,

i tried a Pro Mini 3.3v, a Uno and a Mega to talk/receive to/from a Teensy 3.2 but it does not work.
I'm using the EasyTransfer_TX/RX_Example and sure RX goes to TX and vise versa.
I tried Serial1 and 2 and did set:
Code:
Serial.begin(9600);
Serial2.begin(9600);
ET.begin(details(mydata), &Serial2);
On the Mega i tried Serial1...
I tried in both directions...

It works from Uno to Mega without problems.

I'm really lost. Can it be IDE v1.6.13?
 
Last edited:
First up, have you set the device type as serial under the tools menu when programing the teensy? You need that if you want anything other than the Arduino terminal to see the USB serial traffic.

Would suggest looking at the echo both teensy example and see what that shows you.

And confirming, you are using Serial for data to/from PC on USB and Serial1 for data to/from pins 1 and 2. And have got Tx connected to RX and vice versa (not tx to tx and rx to rx)?
 
Hi,

i tried a Pro Mini 3.3v, a Uno and a Mega to talk/receive to/from a Teensy 3.2 but it does not work.
I'm using the EasyTransfer_TX/RX_Example and sure RX goes to TX and vise versa.
I tried Serial1 and 2 and did set:
Code:
Serial.begin(9600);
Serial2.begin(9600);
ET.begin(details(mydata), &Serial2);
On the Mega i tried Serial1...
I tried in both directions...

It works from Uno to Mega without problems.

I'm really lost. Can it be IDE v1.6.13?

on teensy, Serial is USB-serial and not hardware serial.
to use hardware serial1 on teensy you must use Serial1.begin
 
First up, have you set the device type as serial under the tools menu when programing the teensy? You need that if you want anything other than the Arduino terminal to see the USB serial traffic.
Yes but the example does not print anything it should just blink the LED.
And confirming, you are using Serial for data to/from PC on USB and Serial1 for data to/from pins 1 and 2. And have got Tx connected to RX and vice versa (not tx to tx and rx to rx)?
Pin1(0) <> Arduino TX and Pin2(1) <> Arduino RX

The only thing i do is adding
Code:
Serial1.begin(9600);
and changing this serial to 1
Code:
ET.begin(details(mydata), &Serial1);
on both sides:
https://github.com/madsci1016/Ardui...ansfer_TX_Example/EasyTransfer_TX_Example.pde
https://github.com/madsci1016/Ardui...ansfer_RX_Example/EasyTransfer_RX_Example.pde

to use hardware serial1 on teensy you must use Serial1.begin
I have serial2.begin there because i also tried it with Serial2 (RX2/TX2)

I have now EchoBoth on the Teensy and the Mega if i type something and send i have output in both terminal.
But it runs infinitely and just some random numbers behind "UART received:"
Is that normal?
 
Last edited:
One complication here is that the mega will be running 5V logic so may not be getting clean results out of the Teensy 3.3.

The infinite run will be because Echo Both sends data back out the hardware serial port, so you got two devices talking to each other endlessly, with some form of data mismatch going on.

Given the hardware seems to be working would suggest editing the echo both example so they only seria1.print when data arrives from USB (remove the serial1 print on seria1RX), then connect the tx/rx of each board to itself (and not to the other board at all) and you should be able to echo data from the serial terminal out the port and back in again. Once that works on both boards leave the loop on one and connect the RX, which should give you the same message as seen on the local echo (leave the spare TX free).

Also note difference between serial.print and serial.write as a potential source of numbers
https://www.arduino.cc/en/Serial/Write
https://www.arduino.cc/en/Serial/Print
 
I found some 2 years old code i used when i connected a Arduino to a BananaPi and had "buffer", "\r\n" and "flush" in my code...
The Teensy has FIFO (build in buffer) does EasyTransfer take this into account?
In the EasyTransfer examples i see delays (blocking)?

So the question is: does EasyTransfer tap the full potential of the Teensy uart/serial features/speed?
I also found this library: http://www.gammon.com.au/forum/?id=11428&reply=1#reply1
 
The FIFOs on Serail1 and Serial2 are used automatically. Libraries like EasyTransfer never access these features directly.
 
Status
Not open for further replies.
Back
Top