Micro A-Star, having difficulties receiving serial data

I’m trying to set up an A-Star Micro to receive data from a serial device using SoftwareSerial, but am having difficulties. To evaluate my problems, I set up a simple version of my program that puts out a character to pin 3, which is simply jumpered to pin 2. I expect the data (20 a’s) to show up in the terminal window, but they don’t.

Any help would be most appreciated!

Chris

Here is the code:

#include <SoftwareSerial.h>
#include <AStar32U4.h>

SoftwareSerial SoftSer(2, 3); // RX, TX on pins 2 3
  
void setup(){

  Serial.begin(9600);     // UART Serial for comm w/ PC
  delay(100) ; 
  SoftSer.begin(2400) ;
  Serial.println(" Setup Finished ") ;
  SoftSer.listen() ; 
}   

void loop()
{
    int ii = 0 ;
    while (ii++ < 20 ) {
      SoftSer.listen();
      SoftSer.write('a') ;  // put one character out 
      if(SoftSer.available()) {
        char c = SoftSer.read();
        Serial.print(c);
      }
    }
    Serial.println("    End") ; 
    delay(2000) ;
}

Hello.

The A-Star 32U4, like the Arduino Leonardo and Arduino Micro, is based on the ATmega32U4, which does not support pin change on all its pins. In this case, pins 2 and 3 do not support pin change interrupts which are needed for SoftwareSerial. You can find a list of appropriate pins for the A-Star on the SoftwareSerial library’s page on the Arduino website.

- Amanda

Thank you for the response. I moved my jumper to pins 8 and 9, and changed the line that starts Software Serial accordingly:

SoftwareSerial SoftSer(8, 9) ;

But my result is the same – no sign of the characters I am hoping to see on the loopback.

It looks like code in the SoftwareSerial Arduino library is half-duplex, so a loopback test will not work because the library cannot send and receive simultaneously. I recommend using hardware serial (using pins 0 and 1 on the A-Star 32U4) for simultaneous communication if you can.

- Amanda

So, according to https://www.arduino.cc/en/Reference/SoftwareSerial I cannot use pins 18 for RX and 19 for TX, am I right?

Hello.

Please see my response to your other post containing the same question here.

- Amanda

Hi I’m having the exact same issue. I’m using software serial on pins 8 (Rx) and 7 (Tx) to read serial data at 115200 baud from a raspberry pi. Both the Tx and Rx lines between the Pololu a-star mini LV and the Pi go through a bi-directional TTL Logic level converter. The serial data being read by the a-star mini is very corrupted/garbled most of the time, with only some lines of characters being read correctly.

I’ve tried to debug this issue for a long time with no joy. I’ve even connected a USB-TTL serial adapter to these Rx and Tx lines and the data being read via the adapter on putty (windows) is perfect! Something seems seriously wrong with reading data on software serial in the a-star mini. Please help!

Hello.

Can you post pictures clearly showing how you have everything connected in your setup and your code for the A-Star and the Raspberry Pi?

- Amanda