LoRaWAN demo application using grove peripherals generating Cayenne LPP

Dependencies:   lorawan1v1

radio chip selection

Radio chip driver is not included, because two options are available.
If you're using SX1272 or SX1276, then import sx127x driver into your program.
if you're using SX1261 or SX1262, then import sx126x driver into your program.
If you're using NAmote72 or Murata discovery, then you must import only sx127x driver.

Grove peripherals -> Cayenne demo

Read LoRaWAN-1.1 page for configuration instructions.

This project adds support for Murata discovery board, in addition to LoRa shields on NUCLEO boards.

Use with sx1272 shield with grove peripherals connected:

D8 D9: ButtonRX TXA3 A4: TempSense
D6 D7:SCL SDA : LEDA1 A2: Pot

Button

Sends two different payload types: short press (under 1 sec)
long press: held down > 1 sec.

serial console keys

115200bps, 8N1
Enter key not used
Keys '0' to '3': cayenne channel number
'0': pot (rotary sensor)
'1': temperature
'2': digital out
'3': analog out

DevEUI configuration

For use on networks which force you to use DevEUI defined by network, comment out HardwareIDtoDevEUI().
HardwareIDtoDevEUI() obtains DevEUI from the CPU unique hardware serial number. However, some networks may force you to use their DevEUI value.

SerialDisplay.h

Committer:
Wayne Roberts
Date:
2018-07-25
Revision:
11:09556b27dbce
Parent:
5:53cd6c24a4ab

File content as of revision 11:09556b27dbce:

/*
 / _____)             _              | |
( (____  _____ ____ _| |_ _____  ____| |__
 \____ \| ___ |    (_   _) ___ |/ ___)  _ \
 _____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
    (C)2015 Semtech

Description: VT100 serial display management

License: Revised BSD License, see LICENSE.TXT file include in the project

Maintainer: Miguel Luis and Gregory Cristian
*/
#ifndef __SERIAL_DISPLAY_H__
#define __SERIAL_DISPLAY_H__

#include "vt100.h"
#include "LoRaMac1v1.h"

#ifdef ENABLE_VT100

#define ROW_START       5
#ifdef LORAWAN_JOIN_EUI
    #define ROW_DEVEUI          ROW_START
    #define ROW_JOINEUI         (ROW_DEVEUI+1)
    #define ROW_NWKKEY          (ROW_JOINEUI+1)
    #ifdef OPTNEG
        #define ROW_APPKEY          (ROW_JOINEUI+2)
        #define ROW_NwkId           (ROW_JOINEUI+5)
    #else
        #define ROW_NwkId        (ROW_JOINEUI+4)
    #endif
#else
    #define ROW_NwkId           ROW_START       /* ABP */
#endif /* LORAWAN_JOIN_EUI */

#define ROW_DevAddr         (ROW_NwkId+1)
#define ROW_FNwkSIntKey     (ROW_NwkId+2)
#ifdef OPTNEG
    #define ROW_SNwkSIntKey     (ROW_NwkId+3)
    #define ROW_NwkSEncKey      (ROW_NwkId+4)
    #define ROW_AppSKey         (ROW_NwkId+5)
#else
    #define ROW_AppSKey         (ROW_NwkId+3)
#endif

#define ROW_FrameType       (ROW_AppSKey+2)
#define ROW_ADR             (ROW_AppSKey+3)
#define ROW_DUTY            (ROW_AppSKey+4)
#define ROW_PUBLIC          (ROW_AppSKey+6)
#ifdef LORAWAN_JOIN_EUI
    #define ROW_JOINED             (ROW_PUBLIC+1)
    #define ROW_UPLINK_ACKED       (ROW_PUBLIC+3)
#else
    #define ROW_UPLINK_ACKED       (ROW_PUBLIC+2)
#endif /* LORAWAN_JOIN_EUI */

#define ROW_UPLINK_DR       (ROW_UPLINK_ACKED+1)
#define ROW_UPLINK_FCNT      (ROW_UPLINK_DR+1)
#define ROW_UPLINK_PORT     (ROW_UPLINK_DR+2)
#define ROW_UPLINK_PAYLOAD     (ROW_UPLINK_DR+3)

#define ROW_DOWNLINK_RSSI     (ROW_UPLINK_PAYLOAD+5)
#define ROW_DOWNLINK_SNR     (ROW_DOWNLINK_RSSI+1)
#define ROW_DOWNLINK_FCNT     (ROW_DOWNLINK_SNR+1)
#define ROW_DOWNLINK_FPORT     (ROW_DOWNLINK_FCNT+1)
#define ROW_DOWNLINK_PAYLOAD     (ROW_DOWNLINK_FPORT+1)

#define ROW_END             (ROW_DOWNLINK_PAYLOAD+6)

void SerialDisplayInit( void );
void SerialDisplayUplink(uint8_t fport, const uint8_t* buffer, uint8_t bufferSize );
void SerialDisplayMcpsConfirm( const McpsConfirm_t*);
void SerialDisplayMcpsIndication(const McpsIndication_t* mi);
void SerialDisplayPrintCheckBox( bool activated );
#ifdef LORAWAN_JOIN_EUI
void SerialDisplayUpdateActivationMode( bool otaa );
void SerialDisplayUpdateEui( uint8_t line, const uint8_t *eui );
void SerialDisplayUpdateNetworkIsJoined( bool state );
#endif /* LORAWAN_JOIN_EUI */
void SerialDisplayUpdateKey( uint8_t line, const uint8_t *key );
void SerialDisplayUpdateNwkId( uint8_t id );
void SerialDisplayUpdateDevAddr( uint32_t addr );
void SerialDisplayUpdateFrameType( bool confirmed );
void SerialDisplayUpdateAdr( bool adr );
void SerialDisplayUpdateDutyCycle( bool dutyCycle );
void SerialDisplayUpdatePublicNetwork( bool network );
void SerialDisplayUpdateData( const uint8_t *buffer );
void SerialDisplayUpdateUplinkAcked( bool state );
void SerialDisplayUpdateDonwlinkRxData( bool state );
bool SerialDisplayReadable( void );
uint8_t SerialDisplayGetChar( void );
extern VT100 vt;
#endif /* ENABLE_VT100 */

#endif // __SERIAL_DISPLAY_H__