Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: Teensy 4.0 LORA Reya RYLR890 Issue

  1. #1
    Junior Member
    Join Date
    Oct 2021
    Posts
    1

    Teensy 4.0 LORA Reya RYLR890 Issue

    Hi all, sure I am missing something simple here. I am attempting to get a basic transmit/ receive between two teensy 4.0's with Reyax RLYR890 modules. I can get printing messages on the transmitter side but have yet to be able to receive anything on the receiver side. The connections are as follows...

    Transmitter & receiver connections
    Teensy LoRA
    Pin 0 > TX
    Pin 1 > RX
    Pin GND (by 28) > GND
    Pin 3.3v (by 30) > VDD

    Here is the datasheet and AT Command information for the Reyax modules.

    Transmitter code
    Code:
    #include <SoftwareSerial.h>
    #define HWSERIAL Serial1
    
    void setup(){
        HWSERIAL.begin(115200);
        Serial.begin(9600);
        delay(20);
        HWSERIAL.print("AT\r\n");
        Serial.print("AT\r\n");
        delay(1000);
        HWSERIAL.print("AT+RESET\r\n");
        Serial.print("AT+RESET\r\n");
        delay(500);
        HWSERIAL.print("AT+IPR=115200\r\n");
        Serial.print("AT+IPR=115200\r\n");
        delay(500);
        HWSERIAL.print("AT+ADDRESS=1\r\n");
        Serial.print("AT+ADDRESS=1\r\n");
        delay(500);
        HWSERIAL.print("AT+NETWORKID=5\r\n");
        Serial.print("AT+NETWORKID=5\r\n");
        delay(500);
        HWSERIAL.print("AT+MODE=0\r\n");
        Serial.print("AT+MODE=0\r\n");
        delay(500);
        HWSERIAL.print("AT+BAND=868500000\r\n");
        Serial.print("AT+BAND=868500000\r\n");
        delay(500);
        HWSERIAL.print("AT+PARAMETER=10,7,1,7\r\n");
        Serial.print("AT+PARAMETER=10,7,1,7\r\n");
        delay(20);
    
    }
    
    void loop(){
        HWSERIAL.print("H");
        HWSERIAL.print("AT+SEND=2,1,H");
        Serial.print("H");
        delay(1000);
        HWSERIAL.print("L");
        HWSERIAL.print("AT+SEND=2,1,L");
        Serial.print("L");
        delay(1000);
    }

    Code:
    #include <SoftwareSerial.h>
    #define HWSERIAL Serial1
    const int ledPin =13;
    int incomingByte;
    
    void setup(){
        Serial.begin(9600);
        HWSERIAL.begin(115200);
        pinMode(ledPin,OUTPUT);
        delay(20);
        Serial.print("AT\r\n");
        HWSERIAL.print("AT\r\n");
        delay(1000);
        Serial.print("AT+RESET\r\n");
        HWSERIAL.print("AT+RESET\r\n");
        delay(200);
        Serial.print("AT+IPR=115200\r\n");
        HWSERIAL.print("AT+IPR=115200\r\n");
        delay(200);
        Serial.print("AT+ADDRESS=2\r\n");
        HWSERIAL.print("AT+ADDRESS=2\r\n");
        delay(200);
        Serial.print("AT+NETWORKID=5\r\n");
        HWSERIAL.print("AT+NETWORKID=5\r\n");
        delay(200);
        Serial.print("AT+MODE=0\r\n");
        HWSERIAL.print("AT+MODE=0\r\n");
        delay(200);
        Serial.print("AT+BAND=868500000\r\n");
        HWSERIAL.print("AT+BAND=868500000\r\n");
        delay(200);
        Serial.print("AT+PARAMETER=10,7,1,7\r\n");
        HWSERIAL.print("AT+PARAMETER=10,7,1,7\r\n");
        delay(200);
    }
    
    void loop(){
        if (Serial.available() > 0) {
          incomingByte = Serial.read();
          if (incomingByte == 'H') {
            Serial.print("high");
            HWSERIAL.print("high");
            digitalWrite(ledPin, HIGH);
          }
          if (incomingByte == 'L') {
            Serial.print("low");
            HWSERIAL.print("low");
            digitalWrite(ledPin, LOW);
          }       
       }
        if (HWSERIAL.available() > 0) {
          incomingByte = HWSERIAL.read();
          if (incomingByte == 'H') {
            Serial.print("high");
            HWSERIAL.print("high");
            digitalWrite(ledPin, HIGH);
          }
          if (incomingByte == 'L') {
            Serial.print("low");
            HWSERIAL.print("low");
            digitalWrite(ledPin, LOW);
          }
      }
    }
    Any and all help is very much appreciated! Thank you.

  2. #2
    Senior Member BriComp's Avatar
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    455
    I have been using these and I find them excellent.
    For your module you might find this useful.

    I have made some modification to your receive code as below.
    Code:
    //#include <SoftwareSerial.h>   <<- Don't need this
    #define HWSERIAL Serial1
    const int ledPin = 13;
    int incomingByte;
    
    void setup() {
        Serial.begin(9600);
        HWSERIAL.begin(9600);               // <<- I think default is 9600 not 115200
        pinMode(ledPin, OUTPUT);
        delay(20);
        Serial.print("AT\r\n");
        HWSERIAL.print("AT\r\n");
        delay(1000);
        Serial.print("AT+RESET\r\n");
        HWSERIAL.print("AT+RESET\r\n");
        delay(200);
        Serial.print("AT+IPR=115200\r\n");
        HWSERIAL.print("AT+IPR=115200\r\n");
        delay(200);
        Serial.print("AT+ADDRESS=2\r\n");
        HWSERIAL.print("AT+ADDRESS=2\r\n");
        delay(200);
        Serial.print("AT+NETWORKID=5\r\n");
        HWSERIAL.print("AT+NETWORKID=5\r\n");
        delay(200);
        Serial.print("AT+MODE=0\r\n");
        HWSERIAL.print("AT+MODE=0\r\n");
        delay(200);
        Serial.print("AT+BAND=868500000\r\n");
        HWSERIAL.print("AT+BAND=868500000\r\n");
        delay(200);
        Serial.print("AT+PARAMETER=10,7,1,7\r\n");
        HWSERIAL.print("AT+PARAMETER=10,7,1,7\r\n");
        delay(200);
    }
    
    void loop() {
        if (Serial.available() > 0) {
            incomingByte = Serial.read();
            if (incomingByte == 'H') {
                Serial.print("high");
                HWSERIAL.print("high");
                digitalWrite(ledPin, HIGH);
            }
            if (incomingByte == 'L') {
                Serial.print("low");
                HWSERIAL.print("low");
                digitalWrite(ledPin, LOW);
            }
        }
        if (HWSERIAL.available() > 0) {
            incomingByte = HWSERIAL.read();
            if (incomingByte == 'H') {
    
                Serial.print("high");
                HWSERIAL.print("high");
                digitalWrite(ledPin, HIGH);
    
            } else if (incomingByte == 'L') {
    
                Serial.print("low");
                HWSERIAL.print("low");
                digitalWrite(ledPin, LOW);
    
            } else {
                Serial.print(incomingByte);     //Print out whatever else is sent to see if comms are taking place
            }
    
        }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •