Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: X_NUCLEO_IKS01A1 mbed LoRaWAN-lib SX1276Lib
Fork of LoRaWAN-demo-76 by
Revision 7:3173f0508a98, committed 2016-07-05
- Comitter:
- mluis
- Date:
- Tue Jul 05 15:01:57 2016 +0000
- Parent:
- 6:a48936885eac
- Child:
- 8:7b1d5fb9cf72
- Commit message:
- Synchronized example application with GitHub LoRaMac-node examples; Updated mbed and LoRaWAN-lib libraries
Changed in this revision
--- a/app/Comissioning.h Wed May 18 11:34:12 2016 +0000
+++ b/app/Comissioning.h Tue Jul 05 15:01:57 2016 +0000
@@ -6,14 +6,14 @@
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2015 Semtech
-Description: End device comissioning parameters
+Description: End device commissioning parameters
License: Revised BSD License, see LICENSE.TXT file include in the project
Maintainer: Miguel Luis and Gregory Cristian
*/
-#ifndef __LORA_COMISSIONING_H__
-#define __LORA_COMISSIONING_H__
+#ifndef __LORA_COMMISSIONING_H__
+#define __LORA_COMMISSIONING_H__
/*!
* When set to 1 the application uses the Over-the-Air activation procedure
@@ -26,8 +26,6 @@
*/
#define LORAWAN_PUBLIC_NETWORK true
-#if( OVER_THE_AIR_ACTIVATION != 0 )
-
/*!
* IEEE Organizationally Unique Identifier ( OUI ) (big endian)
*/
@@ -48,8 +46,6 @@
*/
#define LORAWAN_APPLICATION_KEY { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C }
-#else
-
/*!
* Current network ID
*/
@@ -70,6 +66,4 @@
*/
#define LORAWAN_APPSKEY { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C }
-#endif
-
-#endif // __LORA_COMISSIONING_H__
+#endif // __LORA_COMMISSIONING_H__
--- a/app/main.cpp Wed May 18 11:34:12 2016 +0000
+++ b/app/main.cpp Tue Jul 05 15:01:57 2016 +0000
@@ -21,11 +21,6 @@
#include "SerialDisplay.h"
/*!
- * Join requests trials duty cycle.
- */
-#define OVER_THE_AIR_ACTIVATION_DUTYCYCLE 10000000 // 10 [s] value in us
-
-/*!
* Defines the application data transmission duty cycle. 5s, value in [us].
*/
#define APP_TX_DUTYCYCLE 5000000
@@ -96,13 +91,11 @@
#endif
-#if( OVER_THE_AIR_ACTIVATION != 0 )
-
static uint8_t DevEui[] = LORAWAN_DEVICE_EUI;
static uint8_t AppEui[] = LORAWAN_APPLICATION_EUI;
static uint8_t AppKey[] = LORAWAN_APPLICATION_KEY;
-#else
+#if( OVER_THE_AIR_ACTIVATION == 0 )
static uint8_t NwkSKey[] = LORAWAN_NWKSKEY;
static uint8_t AppSKey[] = LORAWAN_APPSKEY;
@@ -251,11 +244,10 @@
SerialDisplayUpdateDevAddr( DevAddr );
SerialDisplayUpdateKey( 12, NwkSKey );
SerialDisplayUpdateKey( 13, AppSKey );
-#else
+#endif
SerialDisplayUpdateEui( 5, DevEui );
SerialDisplayUpdateEui( 6, AppEui );
SerialDisplayUpdateKey( 7, AppKey );
-#endif
mibReq.Type = MIB_NETWORK_JOINED;
LoRaMacMibGetRequestConfirm( &mibReq );
@@ -483,6 +475,11 @@
LoRaMacUplinkStatus.Datarate = mcpsConfirm->Datarate;
LoRaMacUplinkStatus.UplinkCounter = mcpsConfirm->UpLinkCounter;
+ // Switch LED 1 ON
+ Led1State = true;
+ Led1StateChanged = true;
+ TimerStart( &Led1Timer );
+
UplinkStatusUpdated = true;
}
NextTx = true;
@@ -644,6 +641,20 @@
LoRaMacMlmeRequest( &mlmeReq );
}
break;
+ case 6: // (ix)
+ {
+ MlmeReq_t mlmeReq;
+
+ mlmeReq.Type = MLME_JOIN;
+
+ mlmeReq.Req.Join.DevEui = DevEui;
+ mlmeReq.Req.Join.AppEui = AppEui;
+ mlmeReq.Req.Join.AppKey = AppKey;
+
+ LoRaMacMlmeRequest( &mlmeReq );
+ DeviceState = DEVICE_STATE_SLEEP;
+ }
+ break;
default:
break;
}
@@ -677,6 +688,8 @@
{
// Status is OK, node has joined the network
IsNetworkJoinedStatusUpdate = true;
+ DeviceState = DEVICE_STATE_SEND;
+ NextTx = true;
break;
}
case MLME_LINK_CHECK:
@@ -711,6 +724,17 @@
BoardInit( );
SerialDisplayInit( );
+ SerialDisplayUpdateEui( 5, DevEui );
+ SerialDisplayUpdateEui( 6, AppEui );
+ SerialDisplayUpdateKey( 7, AppKey );
+
+#if( OVER_THE_AIR_ACTIVATION == 0 )
+ SerialDisplayUpdateNwkId( LORAWAN_NETWORK_ID );
+ SerialDisplayUpdateDevAddr( DevAddr );
+ SerialDisplayUpdateKey( 12, NwkSKey );
+ SerialDisplayUpdateKey( 13, AppSKey );
+#endif
+
DeviceState = DEVICE_STATE_INIT;
while( 1 )
@@ -788,6 +812,10 @@
LoRaMacChannelAdd( 7, ( ChannelParams_t )LC8 );
LoRaMacChannelAdd( 8, ( ChannelParams_t )LC9 );
LoRaMacChannelAdd( 9, ( ChannelParams_t )LC10 );
+
+ mibReq.Type = MIB_RX2_CHANNEL;
+ mibReq.Param.Rx2Channel = ( Rx2ChannelParams_t ){ 869525000, DR_3 };
+ LoRaMacMibSetRequestConfirm( &mibReq );
#endif
#endif
@@ -815,15 +843,7 @@
{
LoRaMacMlmeRequest( &mlmeReq );
}
-
- SerialDisplayUpdateEui( 5, DevEui );
- SerialDisplayUpdateEui( 6, AppEui );
- SerialDisplayUpdateKey( 7, AppKey );
-
- // Schedule next packet transmission
- TxDutyCycleTime = OVER_THE_AIR_ACTIVATION_DUTYCYCLE;
- DeviceState = DEVICE_STATE_CYCLE;
-
+ DeviceState = DEVICE_STATE_SLEEP;
#else
mibReq.Type = MIB_NET_ID;
mibReq.Param.NetID = LORAWAN_NETWORK_ID;
@@ -845,11 +865,6 @@
mibReq.Param.IsNetworkJoined = true;
LoRaMacMibSetRequestConfirm( &mibReq );
- SerialDisplayUpdateNwkId( LORAWAN_NETWORK_ID );
- SerialDisplayUpdateDevAddr( DevAddr );
- SerialDisplayUpdateKey( 12, NwkSKey );
- SerialDisplayUpdateKey( 13, AppSKey );
-
DeviceState = DEVICE_STATE_SEND;
#endif
IsNetworkJoinedStatusUpdate = true;
@@ -864,11 +879,6 @@
PrepareTxFrame( AppPort );
NextTx = SendFrame( );
-
- // Switch LED 1 ON
- Led1State = true;
- Led1StateChanged = true;
- TimerStart( &Led1Timer );
}
if( ComplianceTest.Running == true )
{
--- a/mac/LoRaWAN-lib.lib Wed May 18 11:34:12 2016 +0000 +++ b/mac/LoRaWAN-lib.lib Tue Jul 05 15:01:57 2016 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/Semtech/code/LoRaWAN-lib/#d7a34ded7c87 +http://developer.mbed.org/teams/Semtech/code/LoRaWAN-lib/#c16969e0f70f
--- a/mbed.bld Wed May 18 11:34:12 2016 +0000 +++ b/mbed.bld Tue Jul 05 15:01:57 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/7c328cabac7e \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34 \ No newline at end of file
--- a/system/timer.cpp Wed May 18 11:34:12 2016 +0000
+++ b/system/timer.cpp Tue Jul 05 15:01:57 2016 +0000
@@ -17,7 +17,7 @@
Timer TimeCounter;
Ticker LoadTimeCounter;
-volatile uint32_t CurrentTime = 0;
+volatile uint64_t CurrentTime = 0;
void TimerResetTimeCounter( void )
{
--- a/system/timer.h Wed May 18 11:34:12 2016 +0000
+++ b/system/timer.h Tue Jul 05 15:01:57 2016 +0000
@@ -22,7 +22,7 @@
*/
typedef struct TimerEvent_s
{
- uint32_t value;
+ uint64_t value;
void ( *Callback )( void );
Ticker Timer;
}TimerEvent_t;
@@ -31,7 +31,7 @@
* \brief Timer time variable definition
*/
#ifndef TimerTime_t
-typedef uint32_t TimerTime_t;
+typedef uint64_t TimerTime_t;
#endif
/*!
