Serial passthrough code

Hi,

I’ve got a kickstarter SODAQ One board and successfully programmed LoRaWan tutorial code alright.
http://support.sodaq.com/sodaq-one/loraone-lora-basic-sketch/

But as I don’t have access to a gateway, I’d like to manually talk to its RN2903 module by writing serial passthrough sketch so that I can issue commands from Mac to access radio commands.

I wrote following code but it doesn’t seem to work… I see the message from the last line in setup() alright. But typing commands like “sys get hweui” doesn’t do anything.
Or sometimes I see a message “err” appear on serial console.

I’d appreciate any advice how to move forward.

#define debugSerial SerialUSB
#define loraSerial Serial1

void setup() {
  digitalWrite(ENABLE_PIN_IO, HIGH);
  delay(3000);
  while (!debugSerial){
  // Wait for the debugSerial
  }
  debugSerial.begin(57600);
  //loraSerial.begin(LoRaBee.getDefaultBaudRate());
  loraSerial.begin(57600);
  debugSerial.println("RN2483/2903 serial passthrough");
}

void loop() {
  if (debugSerial.available()) {
    loraSerial.write(debugSerial.read());
  }
  if (loraSerial.available()) {
    debugSerial.write(loraSerial.read());
  }
}

That code works fine. You just need to make sure that you have the “Both NL & CR” option selected in the Serial Monitor so that the correct line endings are added.

1 Like

Thank you very much for your advice, Gabriel!

Yes, with “Both NL & CR” selected, I can now issue RN2483/2903 commands and check replies. Super!

I am also trying to make working this sketch, however, I don’t get anything on my Serial screen, even though I write any command, I receive an “invalid_param” response.

I am not even using any Gateway, does it make sense? Since I though this skecth purpose is only developed in order to check LoRa module…

Any suggestion, please?

Many thanks