LoRaWAN Node designes based on RAK4260 / SAMR34

RAK 4260 module

Marvell Consultants now has a great deal of experience designing with the RAK4260. This neat little 15mm-square screened module incorporates Atmel/Microchip's SAMR34J18B SiP. The R34 SiP in turn comprises an ATSAML21J18B ultra-low-power CotexM0+ processor plus a LoRa compatible UHF transceiver. This part offers an unbeatable combination of low-power, low-cost, small-size & high-performance currently available for the heart of any LoRaWAN node. Unfortunately it has a couple of drawbacks: it's available only in BGA packaging and there's a significant amount of external RF circuitry required around the antenna. Both these issues are swept away by RAK's excellent 4260 module which embeds the SAMR34, all its associated RF circuitry and two XTAL oscillators.

Sadly RAK did not adopt the same GPIO usage as on Atmel/Microchip's SAMR34 Xplained board. This means that none of the example software on Microchip's SAMR34 web-site will work out-of-the-box - check-out PB03, PA28, and PA09. RAK's one piece of example code is a copy of Microchip's but with some quick and dirty modifications to fix the incompatibilities. It's available to clone from github via a link on their 'Quick-Start' -> 'Burning the Firmware' guide and runs on their 4260 eval board, see below. Documentation for RAK's evaluation board is currently rather sketchy. Here's a random list of some of the things I've learned so far:

UPDATE:Feb2021: Microchip have recently launched their own very similar SAMR34-based radio module, the WLR089U0 - same price-level, performance and dimensions - available at MicrochipDirect from March 2021

  • RAK's 'Burning the Firmware' documentation is misleading...
  • You DO need a J-Link unit to program RAK's 4260 evaluation board.
  • The J-Link signals must be hand wired to the eval board's J4 connector thusly:
        J-link pin  Signal   J4 pin  RAK4260 pin
        ----------  -------  ------  -----------
        7           SWDATA   2       31
        9           SWDCLK   3       30
        1           Vdd      1       11,12
        4,6,8 etc   GND      4       10,18,28,36 etc
        15          RESET    5*	 29
        * Older modules may not have a J4p5, in which case wire direct to Module pin 29
        Alternatively see our J-link adapter board below 
  • The schematic for the 4260 'stamp' carrier board (that fits to the 5005) is incomplete.
  • The schematic for the RAK5005 base-board is not currently published but...
  • The eval-board USB port is for both power & serial comms.
  • The 5005 base-board includes an FTDI-type chip wired to push UART1 out through the USB port.
  • The SAMR34's native on-chip USB port is not used by RAK's demo software or eval hardware.
  • The demo software actually uses UART1 at 115.2Kbaud for debug and user interaction.
  • The quick-start stuff re Segger J-Flash etc is a waste of time - it demands a s/w license but...
  • You can drive your J-Link/Atmel-SAM-ICE SWD programmer direct from Atmel Studio 7.
  • Don't bother with RAK's serial tool, use TeraTerm or Putty or any of the many others.
  • Refer also to Atmel's SAM-R34-MLS-Getting-Started guide #DS50002812A (for R34 Xplained h/w).
  • There's a Device EUI printed on each 4260 module but it is not actually stored in the device.
  • You must update the device EUI, TTN Application EUI and AppKey fields in conf_app.h
  • The above changes may not take effect until you 'Clear PDS' from the 'Main menu'
  • The sample code requires A LOT of work to make it remotely useful, but most of the pieces are there.
  • Check this link re extended sleep times: https://www.microchip.com/forums/FindPost/1121324
  • If you want to use the ADC you'll have to modify temp_sensor.c to release the ADC after use.
  • RAK recommend editing conf_regparams.h -> #if (EUBAND == 1) -> FEATURES_SUPOPORTED_EU:
  • Bug fix required in RAK's example code to correct missing radio switch chip activation:
       In file:
       edit these two existing functions like so:
        void HAL_TCXOPowerOn(void)
          port_pin_set_output_level(TCXO_PWR_PIN, TCXO_PWR_ACTIVE);
          port_pin_set_output_level(RFSW_PWR_PIN, RFSW_PWR_ACTIVE); // also enable RF switch
        void HAL_TCXOPowerOff(void)
          port_pin_set_output_level(TCXO_PWR_PIN, TCXO_PWR_INACTIVE);
          port_pin_set_output_level(RFSW_PWR_PIN, RFSW_PWR_INACTIVE); // also disable RF switch
  • The on-chip ADC's performance is disappointing - at best 8 or 9 bits of useable resolution.
  • Don't try to use PA09 for analog input - it will break the LoRaWAN stack.
  • Accuracy of the on-chip temperature sensor is poor (+/-5C) even with the calibration mechanism.
  • Expect about 2uA current consumption for the module (alone) when in standby sleep mode.
  • PCB cleaning solvents erase the module's label - deleting your device's devEUI.
  • So cover or scan your module labels BEFORE manufacture
  • Our in-house Studio7 node firmware package is now open-source and available for download below.
  • Please also see the postscript on this page re gateway packet forwarder shortcommings
  • We recommend this patched packet-forwarder from JoTo systems for your Pi-based gateway.

    For some time I struggled with down-link reliability - from gateway to node. Some correspondents also see this but others do not. It becomes especially troublesome when using CONFIRMED mode transmission because many re-trys can be consumed trying to get the confirmation packet through - this of course eats away at the node's energy budget. The problem has been solved by:

  • Implementing the bug-fix and edit detailed above
  • Disabling the lorawan stack's simplistic re-try mechanism and handling re-trys in dedicated code
  • More significantly though, at the gateway:
  •   Setting zero antenna gain in global_conf.json - this provides a small tx power boost.
  •   Using a modified legacy UDP packet forwarder that:
  •   - does not reject down-link packets with un-matched tx_lut power levels
  •   - runs the SPI bus at 2MHz rather than 8MHz, see above.

    The up-side being that it all lead to the development of very robust node-side application code (see below).

    J-Link adapter board

    We designed this little board to facilitate in-system programming of RAK4260 modules without the need for any on-board JTAG/SWD support. With this board up your sleeve you'll be able to make super-small nodes with no SWD connector or infrastructure. The board uses a 20-pin pin-header to connect to an old-style J-link box and 9 pogo pins to locate onto the 4260 module. Four links are provided for enabling pull-up resistors on the signal pins as required. Eg the datasheet states that a 1K pull up is mandatory on SWCLOCK. Design files available below. Pins: Multicomp p/n P50-B-120-G, Farnell:1568260.

    4-20mA sensor node

    We now have a design for a LoRa node that interfaces to any 4-20mA sensor unit eg water depth, IR temperature etc. Featuring:

    • 9-15V supply with reverse polarity fuse protection
    • On-demand 24V boost supply for sensor drive
    • Micro-power 3v3 supply for LoRa module
    • Built-in (low accuracy) temperature sensor
    • Battery voltage monitoring
    • SWD programming & async-serial connectors
    • UFL antenna connector
    • Very small 40 x 45mm SMT board
    • Very low power consumption - less than 6uA while sleeping
    • Years of life from a cheap rechargeable 12V SLA battery
    • Advanced, robust and flexible application firmware - now open-sourced, see below

    Contact us for details.

    Further developments   available on request
    • More flexible, more configurable, more capable node firmware
    •   i2c support
    •   s/w K-type thermocouple linearisation (0-500C)
    • Dual 4-20mA sensor node
    •   as above but with 16-bit ADC
    • Multi-purpose node:
    •   Powered by 2 AAA cells, around 4uA sleep current
    •   Accurate temperature-sensor - Si7051 - 0.25C
    •   Vibration-sensor
    •   Magnet-sensor
    •   Pulse-counter
    •   I2C expansion
    •   Multi-channel 16-bit analog front-end with PGA (ADS1114/5)

      Gerber file pack for our J-link to RAK4260 adapter PCB
      We highly recommend JLCPCB.com PCB manufacturer.
      RAK Store
      RAK's 4260 Schematics etc
      RAK's 4260 'Datasheet'
      RAK's 4260 Quick start
      RAK's 4260 GitHub
      Atmel/Microchip SAMR34 pages
      Check out our LoRa Gateway project here
      Download our open-source Studio7 example project for the Node20mA here
      Download our open-hardware Node20mA node hardware: Gerber_files, BOM, Schematic

  •       marvellconsultants.com