HowTo: Update RN2483 Firmware on 'The Things Node'

After just 7 to 10 days, the 3xAAA batteries of my TTN Nodes (from the TTN online shop) were already empty, even if it only transmitted one frame every 4 hours. From reading in the forums, there is a known bug in the Microchip RN2483 module, preventing it to enter sleep mode and draining the battery.

I’m not yet sure if this is the only reason why the orignal TTN Node is draining the batteries that quick, but updating the firmware of the RN2483 to get rid of that known bug could probably help.

Since the procedure to update the microchip lora module is not quite straight forward, I am trying to document it here.

Gotchas:

  • The microchip LoRa development tool for linux and mac apparently contains a bug, preventing you from selecting the firmware file. Hence you have to use Windows to perform the upgrade.

  • You need a serial connection to the RN2483 module, so you have to temporarily upload a “passthrough” code onto the TTN node to get direct access to the RN2483 module to perform the upgrade.

Prepare the TTN Node for the firmware upgrade by uploading the passthrough sketch:

  • Open Arduino IDE (assuming you have already installed all required TTN libs) and open:
    File \ Examples \ TheThingsNode \ Passthrough
    Upload this sketch to the TTN Node to allow a serial passthrough connection from the TTN-Node USB Serial port to the RN2483 chip.

On a Windows (10) machine, perform the following steps:

  1. Download LoRa Development Utility from microchip

http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=dv164140-1

  1. Launch the installer and complete the installation

  2. If you had selected to install Java, you must also manually start the JRE8 installation now, as the loradev installer just puts the java installer EXE into the program folder, but does not actually execute it:
    Open the folder c:\Users(username)\Microchip\LoRaSuite\Java and doubleclick the java installer exe.

  3. Now open a NEW command prompt, navigate to c:\Users(username)\Microchip\LoRaSuite\Applications\LoRaDevUtility\ folder and launch:
    java -jar LoRaDevUtility.jar

  4. The microchip loradev utility should start up now.

  5. Download and extract LoRa Firmware (currently 1.0.3 but 1.0.4 is in the works…)
    http://ww1.microchip.com/downloads/en/DeviceDoc/RN2483_1.0.3%20(Public).zip

  6. Now connect the TTN Node, which is in passthrough mode, to the microchip loradev tool, click the “find devices” button and the RN module should show up in the left panel. Select it and the console should display RN2483 1.0.1 Dec 12 2015 etc…

  7. Locate the DFU tab and in the “bootloader input” section click on the button for “select file”.
    Remember, this button does not work in linux and mac, even if the userprefs xml was updated… that’s why we are forced to use windows here.
    Select the firmware hex file in the folder “binary\For Bootloader” of the ZIP file you downloaded before. Hit Update Firmware and wait until completed.

  8. Reconnect and verify that the version in the console now shows 1.0.3 (or newer)

  9. Now you can upload your own code again using the arduino IDE.

I hope this will fix the sleep mode bug, which drains the batteries of the TTN Node within just a few days.

16 Likes

were is the’ pass through’ sketch :sunglasses:

if this works it’s great !

@BoRRoZ See the image:

afbeelding

1 Like

found it tnx … :sunglasses:

2 Likes

@flx
I followed the description but was not successfull.
First of all de file location differs. In my situation it is:
C:\Users\drasv\Microchip\LoRaSuite\Applications\LoRaDevUtility\LoRaDevUtility.jar

When I run it from the command prompt I see him scanning ports. In my case COM13 is the The Things Node with the installed passtrough program.

afbeelding

The Microchip Developmend Utility is not showing any device.
I cannot click “Find device”.

afbeelding

Am I missing something?
Any suggestion is helpfull.
Cu, Remko.

maybe hold reset and let go when the application is scanning ?
when I receive the TTN node later this week I will try to

Path is now updated in the instruction, thanks.

I did not have to press any (reset) buttons. Just plug in the node and launch the LoRaDev tool, then it should find it even without pressing the “find” button.

Can you verify if the serial passthrough is really working by opening a serial console in arduino IDE:

  • In Serial Monitor select “Both NL & CR” and “115200 baud” in the bottom right dropdowns and send a command like: mac get deveui

There must be a reply by the RN chip.

Btw, after upgrading the firmware, close the LoRaDev tool, unplug the node and connect it again, then launch the LoRaDev tool again. It should immediately find the new device and report the new firmware version in the console. If you don’t restart the tool, it will not work with the already listed device.

1 Like

Worked like a charm, thanks for sharing and glad to know we can use this technique on any other board selecting the correct serial in the sketch :wink:

i have verified the passtrough of the Node and I can confirm it works:

afbeelding

This time I used the TTN Uno for testing and the Microcip program mentiones a device:

afbeelding

Only problem is that it keeps “finding devices” and no button appears for furter actions:

afbeelding

Whet next. still stuck. Any ideas?

Thanks, I’m glad to hear it worked! Now I hope this will really fix the battery drain problem, because just 7 days is a joke, when TTN claims “over a year” in the specs.

Just after ordering, they dropped prices from EUR 70 to 50… d’oh!! :scream:

@pe1mew have you used the same usb cable as for uploading the arduino sketch?
If I understood you right, the loradev tool recognizes the TTN uno correctly, but not the TTN Node?

@flx
I removed sending on move and setup transmit every 5 minutes and with my 1st node, got 2/3 weeks
Updated firmware on my 2nd node just now, and let’s see how far it goes

image

Here the sketch for reference (could be fine that TTN provide a Year duration sketch :wink:

#include <TheThingsNode.h>
#include <CayenneLPP.h>

// Set your AppEUI and AppKey
const char *appEui = "0011223344556677";
const char *appKey = "00112233445566778899AABBCCDDEE";

#define loraSerial Serial1
#define debugSerial Serial

// Replace REPLACE_ME with TTN_FP_EU868 or TTN_FP_US915
#define freqPlan TTN_FP_EU868

TheThingsNetwork ttn(loraSerial, debugSerial, freqPlan);
TheThingsNode *node;
CayenneLPP lpp(51);

#define PORT_SETUP 1
#define PORT_INTERVAL 2
#define PORT_MOTION 3
#define PORT_BUTTON 4

void setup()
{
  loraSerial.begin(57600);
  debugSerial.begin(9600);

  // Wait a maximum of 10s for Serial Monitor
  while (!debugSerial && millis() < 10000)
    ;

  // Config Node
  node = TheThingsNode::setup();
  node->configLight(true);
  node->configInterval(true, 300000);
  node->configTemperature(true);
  node->onWake(wake);
  node->onInterval(interval);
  node->onSleep(sleep);
  node->onMotionStart(onMotionStart);
  node->onButtonRelease(onButtonRelease);

  // Test sensors and set LED to GREEN if it works
  node->showStatus();
  node->setColor(TTN_GREEN);

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

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

  debugSerial.println("-- SEND: SETUP");
  sendData(PORT_SETUP);
}

void loop()
{
  node->loop();
}

void interval()
{
  node->setColor(TTN_BLUE);

  debugSerial.println("-- SEND: INTERVAL");
  sendData(PORT_INTERVAL);
}

void wake()
{
  node->setColor(TTN_GREEN);
}

void sleep()
{
  node->setColor(TTN_BLACK);
}

void onMotionStart()
{
  node->setColor(TTN_MAGENTA);

  debugSerial.print("-- SEND: MOTION");
  sendData(PORT_MOTION);
}

void onButtonRelease(unsigned long duration)
{
  node->setColor(TTN_BLUE);

  debugSerial.print("-- SEND: BUTTON");
  debugSerial.println(duration);

  sendData(PORT_BUTTON);
}

void sendData(uint8_t port)
{
  printSensors();

  if (port != PORT_MOTION) {
    lpp.reset();
    lpp.addDigitalInput(1, node->isButtonPressed());
    lpp.addDigitalInput(2, node->isUSBConnected());
    lpp.addDigitalInput(3, node->isMoving());
    lpp.addAnalogInput(4, node->getBattery()/1000.0);
    lpp.addTemperature(5, node->getTemperatureAsFloat());
    lpp.addLuminosity(6, node->getLight());
    
    float x,y,z;
    node->getAcceleration(&x, &y, &z);
    lpp.addAccelerometer(7, x, y, z);
    
    ttn.sendBytes(lpp.getBuffer(), lpp.getSize());
  } else {
    // Time to see motion led
    delay(500);
  }
}

void printSensors()
{
  debugSerial.println();
  debugSerial.println("SENSORS:");
  debugSerial.println("--------");
  
  debugSerial.print("LED Colour:\t");
  debugSerial.println(node->colorToString(node->getColor()));

  debugSerial.print("Temperature:\t");
  debugSerial.print(node->getTemperatureAsFloat());
  debugSerial.println("°C");

  debugSerial.print("Light Sensor:\t");
  debugSerial.print(node->getLight());
  debugSerial.println("lux");
  
  debugSerial.print("Moving now:\t");
  if(node->isMoving())
  {
    debugSerial.println("yes");
  }
  else
  {
    debugSerial.println("no");
  }
  
  debugSerial.print("Button pressed:\t");
  if(node->isButtonPressed())
  {
    debugSerial.println("yes");
  }
  else
  {
    debugSerial.println("no");
  }

  debugSerial.print("USB connected:\t");
  if(node->isUSBConnected())
  {
    debugSerial.println("yes");
  }
  else
  {
    debugSerial.println("no");
  }

  debugSerial.print("Battery:\t");
  debugSerial.print(node->getBattery());
  debugSerial.println("mV");

  float x,y,z;
  node->getAcceleration(&x, &y, &z);

  debugSerial.print("Acceleration:\tx=");
  debugSerial.print(x);
  debugSerial.print("g\n\t\ty=");
  debugSerial.print(y);
  debugSerial.print("g\n\t\tz=");
  debugSerial.print(z);
  debugSerial.println("g");

  debugSerial.println("--------");
  debugSerial.println();
  
}


1 Like

I solved it.

The LoRaDevUtility couldn´t handle 2 more serial (Bluetooth) ports on my laptop.

afbeelding

After I disabled both ports leaving LoRaDevUtility with only one port left the program works fine. :tada:

afbeelding

Works now. Thanks for thinking along with me.

3 Likes

Is this procedure also working for the ttn-UNO :question:

I removed sending on move

Would it not be better to remove “onMotionStart” complete to omit battery drain ?

@ursm I just upgraded both my TTN Uno and mt Thnings Node. IMHO this procedure is usable for any node using a RN2483 and a MCU that can act as transparent passtrough

1 Like

@flx thanks for your perfect instructions. Worked nicely. Unfortunately ‘The Things Node’ still uses around 3.8mA in sleep mode. Is the schematic of ‘The Things Node’ available? Maybe the excessive current drawn is a hardware design issue.

D’oh… somehow I’m not surprised to hear that.

I haven’t found any schematics. I guess now it’s time for the guys from TTN to issue a statement about this case.

I received mine yesterday so I will do some measurements myself coming days (and take it apart :slight_smile: )

the main loop calls deepSleep()

maybe this needs some tweaking?