"Wireless Made Easy!" - Control SAM R34 IC or WLR089U0 Module with ASCII commands over UART
Device | RF Transceiver | Supported Evaluation Kit | Supported IDEs |
---|---|---|---|
SAMR34J18B | SX1276 (in SIP) | SAMR34 XPRO | Microchip Studio v7.0 |
WLR089U0 | SX1276 (in SIP) | WLR089U0 Module XPRO | Microchip Studio v7.0 |
- Development Board:
- Micro-USB cable
- LoRaWAN Gateway (e.g. The Things Industries)
- Microchip Studio 7.0
- TeraTerm - Terminal Emulator
- Network Server with Gateway and end device registered
- LoRaWAN Gateway connected to Network Server
Notice that Network Servers supporting LoRaWAN 1.04 will only be compatible with this sample code which use Microchip LoRaWAN Stack MLS_SDK_1_0_P_5 (The Things Industries server supports LoRaWAN 1.0.4).
In LoRaWAN 1.0.4 Specification,
DevNonce
is an incrementing 16-bit value. Make sure DevNonce values are aligned between end device and network/join server to pass successfully the join procedure.DevNonce
is incremented on each join request tentative from the end device and the value is tracked by the server.DevNonce
is stored in Persistent Data Storage in the Microchip LoRaWAN Stack.
- Connect your board (EDBG USB) to your computer with a micro USB cable. Your personal computer will recognize the board as a Virtual COM port.
- Open the virtual COM port in a terminal emulator
Connect to Network Server using pre-programmed provisioning keys
- Open TeraTerm. Choose the EDBG Virtual COM port and enable local echo
- The default settings for the UART interface are 115200 bps, 8-bit, no parity, one stop bit and no flow control (115200 8 N 1)
- Press RESET button to reboot the board
Last reset cause: External Reset
LoRaWAN Stack UP
USER BOARD MLS_SDK_1_0_P_5 Oct 29 2020 16:10:55
- Initialize the LoRaWAN stack using
mac reset <band>
command. Check out the MAC Command User's Guide for more details.
mac reset 868
ok
- Provision the device for OTAA with your own keys
mac set deveui 000425191801d748
mac set joineui 0004251918010000
mac set appkey 000425191801d748000425191801d748
- Join the network
mac join otaa
ok
accepted
- Transmit unconfirmed message on port 1
mac tx uncnf 1 AABBCCDDEEFF
ok
mac_tx_ok
- Transmit confirmed message on port 1
mac tx cnf 1 0011223344556688
ok
mac_tx_ok
- Place jumper J102 in MEAS position to measure MCU current
- Place jumper J101 in BY-PS position to bypass I/Os current
- Initialize the stack with
mac reset <band>
command - Put the device in standby mode for 60 seconds
Example:
mac reset 868
sys sleep standby 60000
..
sleep_ok 59991 ms
To enable secure LoRaWAN Authentication, check out the links below for guidance on Hardware Setup and instructions to claim and activate end device to the Join Server:
- Adding ATECC608-TNGLORA (TTI) Secure Element to SAM R34 IC and WLR089U0 Module
- Adding ATECC608-TNGACT (Actility) Secure Element to SAM R34 IC and WLR089U0 Module
- Initialize the LoRaWAN stack
mac reset 868
ok
- Enable crypto device
mac set cryptodevenabled on
ok
- Print crypto device info
// print crypto serial number
sys get cryptosn
01236e0a6ded6e6827
// print crypto dev eui
sys get cryptodeveui
0004A310001FFA2B
// print crypto join eui
sys get cryptojoineui
70b3d57ed0000000
// print crypto tkm info (used for Actility)
sys get cryptotkminfo
aa2301236e0a6ded6e68
- Join the network
mac join otaa
ok
accepted
- Transmit unconfirmed message on port 1
mac tx uncnf 1 AABBCCDDEEFF
ok
mac_tx_ok
Secure element is loaded with unique EUI-64 which is stored in
DEV_EUI_SLOT
memory. By default in the code,DEV_EUI_SLOT
is used as deveui key. If required this settings can be changed inconf_sal.h
.
#define SERIAL_NUM_AS_DEV_EUI 0 // Value is 1 if ECC608 Serial number is used as DEV_EUI otherwise DEV_EUI will be read from DEV_EUI_SLOT