Basic SoftwareSerial not working

I used the Arduino tutorial for my first basic SoftwareSerial program and it’s not working. I’m sending serial data on pin 3 on the Yun.
The program below never prints “Available”.
I verified data is being sent to the RX pin (3). Am I missing any required configuration?

Please take a look, I couldn’t find anything wrong after hours of investigation.

#include <SoftwareSerial.h>
SoftwareSerial rSerial(3, 7); 

void setup() {
   Serial.begin(9600);
   rSerial.begin(9600);
}

void loop() {
  if (rSerial.available()) {
    Serial.println("Available");
 }

What is sending (connected) to your instance of Software serial (GPS module, wireless transceiver, another Arduino ...)?

I have SparkFun RFID reader connected (SparkFun RFID Starter Kit - KIT-13198 - SparkFun Electronics)
I verified it’s working when connected through USB.
I remove the USB and connect the pins Vcc to 5V, GND to GND, and the Tx to the Arduino IO pin I’m setting as RX in SoftwareSerial, similar to the Tutorial on the SparkFun site.

You need to make a pencil drawing showing exactly how YOU have everything connected and then post a photo of the drawing.

…R

Sure, here’s a drawing of how my connections are setup between the Yun and the SparkFunn RFID USB reader SparkFun RFID USB Reader - SEN-09963 - SparkFun Electronics

Image from Reply #4 so we don’t have to download it. See Image Guide

9e95cb59e2a5689f0f280ea05ff339c6ff3ce6ac.jpg

…R

The Sparkfun board in your image does not seem to be the same as in the Sparkfun page you have linked to.

I can't figure what you meant when you said (in Reply #2) "I remove the USB and connect the pins..." What USB thing did you disconnect?

...R

Hello,

It's the same board. The one in my drawing is the back of the board.
The RFID USB board has a USB connection and also exposes the pins so you can connect it to Arduino without the USB cable.
I first tested the RFID board by connecting it to my PC using USB cable and read the RFID using PuTTY to confirm the RFID chip reads the cards as expected.
I then disconnected the RFID board from USB cable and hooked it up to the Arduino Yun board as in the image I attached.
When I touch the board with an RFID card the LED on the RFID card lights up and I get a buzzer sound, which indicates successful read. But for some reason nothing is showing in the Arduino Serial Monitor using the sketch I included in my first post.

I have an update!
I took out my old Arduino Uno and used it instead of the Yun, exact same sketch and exact same connection setup and it worked.

Does anyone know why this works on the Uno and not the Yun?
They both support interrupt on DIO pin 3, so why isn’t this setup working on the Yun but is working on the Uno?

Just so you don’t have to scroll up, here’s the sketch working on Uno but not on Yun.

#include <SoftwareSerial.h>
SoftwareSerial rSerial(3, 7); 

void setup() {
   Serial.begin(9600);
   rSerial.begin(9600);
}

void loop() {
  if (rSerial.available()) {
    Serial.println("Available");
 }
}

MageKirby:
They both support interrupt on DIO pin 3,

AFAIK SoftwareSerial does not need to be on an interrupt pin. Have you tried any other pins?

The Arduino side of the Yun is pretty much the same as a Leonardo. Unfortunately, however, the Yun designers decided to commandeer the HardwareSerial port for communication with the Linux side. It is possible, with a bit of effort, to get access to it.

...R

Thanks it worked on pin10 on the Yun.
I tried it on all external interrupt pins on the Yun (0,1,2,3,7) and none seems to work with the SoftwareSerial.

I was hoping it would work on the interrupt pins because the idea was to trigger an interrupt when an RFID is detected and then read it.

I'm sure there's a way to do, just need to do more studying. :cold_sweat:

MageKirby:
Thanks it worked on pin10 on the Yun.
I tried it on all external interrupt pins on the Yun (0,1,2,3,7) and none seems to work with the SoftwareSerial.

I was hoping it would work on the interrupt pins because the idea was to trigger an interrupt when an RFID is detected and then read it.

Try setting one of the interrupt pins as INPUT and connecting a jumper from it to pin 10 ?

...R

Ah you're a genius. Thank you that solved the problem.

What is the purpose of generating an interrupt when the first bit of data arrives? You still have to stand around and wait for the last bit to arrive. You might as well stay busy, keeping an eye on the serial buffer, reading when data has been stored in the buffer.