Just added SAMR34 support for TTN arduino-device-lib

Hi all!

I have recently been tinkering with a WLR089 Xplained Pro board, which is based on the SAMR34. This new LoRa modem is intented to be used as a standalone microcontroller + radio solution from Microchip, but I found Microchip also released a firmware for the modem in which the standard ASCII commands used for the RN2xx3 chips can be used to control it. It’s called the RN parser.

So, I went to try to use it with my Arduino UNO and the well-known arduino-device-lib from TTN. It took me a while to get it working, but eventually succeeded in configuring the device, joining a network (via ABP), transmitting packets and putting the module to sleep! Very nice!

I had to make some modifications to the library, but ensured that any modifications were also backwards-compatible with the RN modems. Check out the fork of the library here (make sure you’re checking out the feature/samr34 branch):

If you have a SAMR34-based board to test it on, let me know what you think! Maybe support for this modem could be added to the main TTN library, since it’s such an efficient library for ASCII communication in RAM-constrained microcontrollers such as the good old UNO.

Tested Commands

To be completely clear, here is a list of the commands I have personally tested:

mac reset <band>
mac set adr <state>
mac set devaddr <address>
mac set nwkskey <nwksesskey>
mac set appskey <appsesskey>
mac set ch status <channelID> <status>
mac set ch drrange <channelID> <minRange> <maxRange>
mac set dr <dataRate>
mac set pwridx <pwrIndex>
mac set retx <reTxNb>
mac join abp
mac tx uncnf <port> <data>
mac get deveui
mac get dr
mac get rxdelay1
mac get rxdelay2
sys sleep standby <length>
sys get hweui

Some Final Notes

I am using the MLS 1_0_P_6 (Parser_ECC608) firmware contained here, since several bugs that made the firmware unusable where fixed for this release. And I manually modified the baud rate for the firmware in the conf_sio2host.h file and set it to 9600, since no autobaud functionallity exists in the RN Parser firmware. I am using AltSoftSerial to communicate with the modem.

Suggestions, comments and pull requests are all welcome!