RN2903 modem resetting when using TTN arduino lib

I’m trying to use this library with a teensy 3.2:

I’m not sure why, but it causes the RN2903 modem to reset over and over and even my teensy board resets and goes into some weird condition where I can’t reprogram it unless I load a simple blink sketch onto it.

Any ideas what could be causing it? My code is pretty simple…

#include <TheThingsNetwork.h>

/* Serial debugging */
#define debugSerial Serial
#define DEBUG_SERIAL_BAUD 57600

/* LoraWAN */
const char *appEui = "70B3D57ED000ACAB";
const char *appKey = "6C19B3357B72BCC89F3C5170DAB60FFD";
#define loraSerial Serial1
#define freqPlan TTN_FP_US915
#define LORA_SERIAL_BAUD 57600
TheThingsNetwork ttn(loraSerial, debugSerial, freqPlan);

void setup() 
{
  debugSerial.begin(DEBUG_SERIAL_BAUD);
  loraSerial.begin(LORA_SERIAL_BAUD);
  while (!debugSerial && millis() < 10000);

  /* reset modem */
  pinMode(21, OUTPUT);
  digitalWrite(21, LOW);  
  delay(1000);             
  digitalWrite(21, HIGH);  
  delay(1000);
  while (!loraSerial && millis() < 10000);

  debugSerial.println("-- STATUS");
  ttn.showStatus();

  delay(3000);

  debugSerial.println("-- JOIN");
  ttn.join(appEui, appKey);
}

void loop() {
  delay(1000);
   int sensorValue = analogRead(A0);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage = sensorValue * (3.3 / 1023.0) * 6;
  // print out the value you read:
  Serial.println(voltage);
}

Link to a video showing what is going on (causes the device to power cycle over and over)

teensy 3.2 has a Cortex-M4 and the TTN uno a 32U4
that library is written for the 32U4, maybe timing issues ?

have a look at this rocketscream code… to get an idea, you’ll need an input and an output to communicate
with the module over UART.

assuming the rn2903 has the same serial interface
breakcondition
so, if you use a hardware uart you can use 57600, if you use softserial you must lower this to 19200

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.