Go Down

Topic: Yun: Serial input on SoftwareSerial and Serial1 not working (Read 12651 times) previous topic - next topic

mpechner

Have a working app I am moving to the Yun.  Was running on UNO.

All working and finally went to hook up the real hardware.  Weather controller through a TTL to RS232 converter.  Am able to see the output of the TTL side in a terminal app.  OScope shows the TTL serial signal.  But when I tried connecting to pin0 for serial1 or a pin for soft serial ( pins 7&8) I am not getting an input from either.

Anyone else having an issue with Serial1 or softserial on the YUN.

I am using Bridge, since the app publishes a webpage.


sonnyyu

#1
Mar 26, 2014, 04:25 am Last Edit: Mar 26, 2014, 02:39 pm by sonnyyu Reason: 1
Yun's Serial port:

  • Serial - open serial connection via USB-Serial

  • Serial1 - open serial connection to Linino



You should use other name than those as SoftwareSerial since no more hardware port. Both Serial and Serial1 are reserve.

Yún's 32U4 processor is same as Leonardo's.

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).

http://arduino.cc/en/Reference/SoftwareSerial

Code: [Select]
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX






mpechner

Thanks tried. Even followed the documentation and set the pin modes for input and output. Used pins 8 & 9.  Pin 8 rx/input.

got garbage characters.

Again, connected the ttl level output into  the a USB serial port and used OSx coolterm. It showed the expected data.

Using this same weather controller and rs232/ttl converter board board on a UNO on pins 6 & 7.  worked perfectly. also used NewSoftSerial, which is the same as the current softwareserial.

sonnyyu

Plan B:

AltSoftSerial library.

Plan C:

Use USB to RS232 Converter, connect  weather controller directly to Linino side. The 32U4 processor is off the loop.


mpechner

Plan B I'll try.

Plan C is just telling me there is some bug in the YUN or the softwareserial library. If this is the case, I'll just stick to the bluetooth version of this project that has been working for multiple years using newsoftserial on pins 6 & 7 or use the try the adafruit wifi board and skip the yun.

But I am trying to so that so show off the Yun at the Makerfaire in May.  Lets hope this can get working somehow.

esbjerg

Do you need to change every verison of serial to serial1? Or just the first?
Thanks

mpechner

I changed everyone.  Then last night I changed back to softserial. So references changed again.


dilonb

I tried SoftwareSerial on the YUN: it doesnt work
I tried AltSortSerial on the YUN: it doesnt work

But both libraries works on the UNO.
Somebody else tried to use any Serial on the YUN ? Because I have no more solutions. Maybe desable the wireless processor?

federicofissore

Yun uses Serial1 (UART) to talk to the AR9331 only when your sketch uses Bridge library
Any other issue with serial and yun is the same issue you have with a leonardo. If you are in trouble using a particular shield and you find no yun related help, try looking for leonardo related help

mamu


Yun uses Serial1 (UART) to talk to the AR9331 only when your sketch uses Bridge library

Nope. Sadly this is not true, because Linino sends a lot of data to the Leonardo part while booting. And when sending data the other way round, you have to get rid of the listener (askfirst ash) by manipulating initab.

federicofissore

I think @dilonb issue is with shields/sensors/other. If you plug in a shield made to use pins 0 and 1 (Serial1 on yun/leonardo), 32u4 <->Ar9331 communication is interrupted. Am I missing something? (may be...)

mamu


I think @dilonb issue is with shields/sensors/other. If you plug in a shield made to use pins 0 and 1 (Serial1 on yun/leonardo), 32u4 <->Ar9331 communication is interrupted.

How does it detect if a shield is plugged in?

federicofissore

It does not. My previous message was misleading: communication is not interrupted, it's disturbed

NewLine

I think that is probably what happening, you will need to reroute your pins on the shield (see http://forum.arduino.cc/index.php?topic=190709.0)

Go Up