20171208
Dependencies: mbed simple-demo-76 LoRaWAN-lib_20171208 SX1276Lib_20171208
Fork of simple-demo-76 by
Revision 11:6fdaaa5dc69a, committed 2017-12-08
- Comitter:
- cdebank
- Date:
- Fri Dec 08 14:23:38 2017 +0000
- Parent:
- 10:9364ab3a08eb
- Commit message:
- 20171208
Changed in this revision
--- a/app/main.cpp Mon Oct 30 10:51:44 2017 +0000 +++ b/app/main.cpp Fri Dec 08 14:23:38 2017 +0000 @@ -18,11 +18,11 @@ #include "LoRaMac.h" -#define APPDATA_SIZE 4 +#define APPDATA_SIZE 7 #define LORAWAN_DEFAULT_DATARATE DR_0 #define LORAWAN_DEVICE_ADDRESS ( uint32_t )0x01234567 -#define LORAWAN_NWKSKEY { 0x11, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 } -#define LORAWAN_APPSKEY { 0x11, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 } +#define LORAWAN_NWKSKEY { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 } +#define LORAWAN_APPSKEY { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 } uint8_t AppData[APPDATA_SIZE]; static uint8_t NwkSKey[] = LORAWAN_NWKSKEY; @@ -46,6 +46,8 @@ int main( void ) { //Initialise firmware + DigitalOut led(PA_3); + led = 1; LoRaMacPrimitives_t LoRaMacPrimitives; LoRaMacCallback_t LoRaMacCallbacks; @@ -53,16 +55,16 @@ LoRaMacPrimitives.MacMcpsConfirm = McpsConfirm; LoRaMacPrimitives.MacMcpsIndication = McpsIndication; -// LoRaMacPrimitives.MacMlmeConfirm = McpsConfirm; +// LoRaMacPrimitives.MacMlmeConfirm = McpsConfirm; LoRaMacInitialization( &LoRaMacPrimitives, &LoRaMacCallbacks ); - LoRaMacChannelAdd( 3, ( ChannelParams_t ){ 867100000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } ); - LoRaMacChannelAdd( 4, ( ChannelParams_t ){ 867300000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }); - LoRaMacChannelAdd( 5, ( ChannelParams_t ){ 867500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } ); - LoRaMacChannelAdd( 6, ( ChannelParams_t ){ 867700000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } ); - LoRaMacChannelAdd( 7, ( ChannelParams_t ){ 867900000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } ); - LoRaMacChannelAdd( 8, ( ChannelParams_t ){ 868800000, { ( ( DR_7 << 4 ) | DR_7 ) }, 2 } ); - LoRaMacChannelAdd( 9, ( ChannelParams_t ){ 868300000, { ( ( DR_6 << 4 ) | DR_6 ) }, 1 } ); + LoRaMacChannelAdd( 3, ( ChannelParams_t ){ 868100000, { ( ( DR_5 << 4 ) | DR_5 ) }, 3 } ); + //LoRaMacChannelAdd( 4, ( ChannelParams_t ){ 867300000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } ); + //LoRaMacChannelAdd( 5, ( ChannelParams_t ){ 867500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } ); + //LoRaMacChannelAdd( 6, ( ChannelParams_t ){ 867700000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } ); + //LoRaMacChannelAdd( 7, ( ChannelParams_t ){ 867900000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } ); + //LoRaMacChannelAdd( 8, ( ChannelParams_t ){ 868800000, { ( ( DR_7 << 4 ) | DR_7 ) }, 2 } ); + //LoRaMacChannelAdd( 9, ( ChannelParams_t ){ 868300000, { ( ( DR_6 << 4 ) | DR_6 ) }, 1 } ); //Join ABP @@ -96,24 +98,31 @@ //Prepareframe - AppData[0] = 0xFF; - AppData[1] = 0xFF; - AppData[2] = 0xFF; - AppData[3] = 0xFF; + AppData[0] = 0x43; + AppData[1] = 0x68; + AppData[2] = 0x72; + AppData[3] = 0x69; + AppData[4] = 0x73; + AppData[5] = 0x21; + AppData[6] = 0x21; //Sendframe McpsReq_t mcpsReq; uint8_t AppPort = 3; - mcpsReq.Type = MCPS_CONFIRMED; - mcpsReq.Req.Confirmed.fPort = AppPort; - mcpsReq.Req.Confirmed.fBuffer = AppData; - mcpsReq.Req.Confirmed.fBufferSize = APPDATA_SIZE; - mcpsReq.Req.Confirmed.Datarate = LORAWAN_DEFAULT_DATARATE; + mcpsReq.Type = MCPS_UNCONFIRMED; + mcpsReq.Req.Unconfirmed.fPort = AppPort; + mcpsReq.Req.Unconfirmed.fBuffer = AppData; + mcpsReq.Req.Unconfirmed.fBufferSize = APPDATA_SIZE; + mcpsReq.Req.Unconfirmed.Datarate = DR_5; LoRaMacMcpsRequest( &mcpsReq ); - while(1); + while(1){ + wait(1); + led = !led; + LoRaMacMcpsRequest( &mcpsReq ); + } }
--- a/mac/LoRaWAN-lib.lib Mon Oct 30 10:51:44 2017 +0000 +++ b/mac/LoRaWAN-lib.lib Fri Dec 08 14:23:38 2017 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/Semtech/code/LoRaWAN-lib/#26002607de9c +https://os.mbed.com/users/cdebank/code/LoRaWAN-lib_20171208/#de2cdd1f253e
--- a/radio/SX1276Lib.lib Mon Oct 30 10:51:44 2017 +0000 +++ b/radio/SX1276Lib.lib Fri Dec 08 14:23:38 2017 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/Semtech/code/SX1276Lib/#d09a8ef807e2 +https://os.mbed.com/users/cdebank/code/SX1276Lib_20171208/#5a56a5d281bf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/simple-demo-76_revised.lib Fri Dec 08 14:23:38 2017 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/joshcurry/code/simple-demo-76/#9364ab3a08eb