Arduino Forum

Products => Arduino Yún => Topic started by: mpechner on Mar 25, 2014, 03:37 pm

Title: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: mpechner on Mar 25, 2014, 03:37 pm
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.

Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: sonnyyu on Mar 26, 2014, 04:25 am
Yun's Serial port:


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 (http://arduino.cc/en/Reference/SoftwareSerial)

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

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





Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: mpechner on Mar 26, 2014, 07:44 am
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.
Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: sonnyyu on Mar 26, 2014, 01:21 pm
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.

Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: mpechner on Mar 26, 2014, 05:34 pm
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.
Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: esbjerg on Mar 27, 2014, 12:36 am
Do you need to change every verison of serial to serial1? Or just the first?
Thanks
Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: mpechner on Mar 27, 2014, 12:58 am
I changed everyone.  Then last night I changed back to softserial. So references changed again.
Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: esbjerg on Mar 27, 2014, 01:44 am
Thanks
Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: dilonb on May 13, 2014, 05:08 pm
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?
Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: federicofissore on May 13, 2014, 05:46 pm
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
Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: mamu on May 13, 2014, 09:10 pm

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.
Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: federicofissore on May 13, 2014, 09:20 pm
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...)
Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: mamu on May 14, 2014, 07:26 am

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?
Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: federicofissore on May 14, 2014, 10:11 am
It does not. My previous message was misleading: communication is not interrupted, it's disturbed
Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: NewLine on May 14, 2014, 11:14 am
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 (http://forum.arduino.cc/index.php?topic=190709.0))
Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: dilonb on May 17, 2014, 01:11 pm
I don't use a shield, I connect a Serial 4 digit Display direct on the digital bloc of the Yun.

I used a led connected to the TX to see if data were transmitted (every second). I can see the LED blinking when the Yun is transmitting data, but the display doesn't work (with the UNO, all works). So maybe it's a problem of Levels or perturbations. I can't check the signal form because i have no scope.
I tried to add a RC filter (100n - 220ohm) on the TX but no changes.
Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: fperal on May 31, 2017, 10:28 am
Did you find the solution?
I'm stuck at the same point.

regards
Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: ShapeShifter on May 31, 2017, 12:00 pm
Quote
I'm stuck at the same point.
And what point is that? There are a couple issues mentioned in this thread. You are probably better off starting a new thread and giving a lot more details, rather than post "me too" to an old thread that may or may not be the same as your problem.

For the record, I've not had any issues with SoftwareSerial, and Serial1 is indeed not available for general use.
Title: Re: Yun: Serial input on SoftwareSerial and Serial1 not working
Post by: sonnyyu on May 31, 2017, 07:55 pm
Plan D:

Use Yun Shield + Arduino Mega.

The Arduino Mega has three additional serial ports: Serial1 on pins 19 (RX) and 18 (TX), Serial2 on pins 17 (RX) and 16 (TX), Serial3 on pins 15 (RX) and 14 (TX).

In total of 4:


1. Baking. Shirring.
2. Broiling.
3. Frying. Deep fat frying. Sautéing and pan-frying. Stir-Frying. Deglazing.
4. Grilling.

Do it in half asleep half awake.