Amir Chaudhary
/
LoRaWAN-hello-world_new_mcu_Anish
new code ani
Revision 15:6d177c1f6a15, committed 2019-12-02
- Comitter:
- amirchaudhary
- Date:
- Mon Dec 02 16:01:33 2019 +0000
- Parent:
- 14:fd17c5190f79
- Commit message:
- Ani coe
Changed in this revision
app/Commissioning.h | Show annotated file Show diff for this revision Revisions of this file |
app/main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r fd17c5190f79 -r 6d177c1f6a15 app/Commissioning.h --- a/app/Commissioning.h Wed Jul 24 15:21:23 2019 +0000 +++ b/app/Commissioning.h Mon Dec 02 16:01:33 2019 +0000 @@ -35,17 +35,17 @@ /*! * Mote device IEEE EUI (big endian) */ -#define LORAWAN_DEVICE_EUI { 0x00, 0x52, 0xF7, 0x41, 0x06, 0x67, 0xB2, 0xEE } +#define LORAWAN_DEVICE_EUI { 0x00, 0x52, 0xF7, 0x41, 0x06, 0x67, 0xB1, 0x0E } /*! * Application IEEE EUI (big endian) */ -#define LORAWAN_APPLICATION_EUI { 0x70, 0xB3, 0xD5, 0x7E, 0xD0, 0x01, 0x4D, 0xD1 } +#define LORAWAN_APPLICATION_EUI { 0x70, 0xB3, 0xD5, 0x7E, 0xD0, 0x01, 0x9D, 0xAC } /*! * AES encryption/decryption cipher application key */ -#define LORAWAN_APPLICATION_KEY { 0xC3, 0x65, 0xF6, 0xEF, 0xA0, 0x90, 0x71, 0x16, 0x83, 0x9A, 0x16, 0xC4, 0xF5, 0xF3, 0x20, 0xC7 } +#define LORAWAN_APPLICATION_KEY { 0x76, 0x81, 0xF3, 0xD9, 0x30, 0x1D, 0xCE, 0xAE, 0x2F, 0x58, 0x3E, 0xD0, 0xF2, 0x53, 0x94, 0x11 } /*! * Current network ID
diff -r fd17c5190f79 -r 6d177c1f6a15 app/main.cpp --- a/app/main.cpp Wed Jul 24 15:21:23 2019 +0000 +++ b/app/main.cpp Mon Dec 02 16:01:33 2019 +0000 @@ -83,13 +83,9 @@ /*! * User application data buffer size */ -#if ( LORAWAN_CONFIRMED_MSG_ON == 1 ) -#define LORAWAN_APP_DATA_SIZE 6 +#define LORAWAN_APP_DATA_SIZE 41 -#else -#define LORAWAN_APP_DATA_SIZE 1 -#endif static uint8_t DevEui[] = LORAWAN_DEVICE_EUI; static uint8_t AppEui[] = LORAWAN_APPLICATION_EUI; @@ -216,7 +212,7 @@ // Application Globals -DigitalOut myled(D6); +DigitalOut myled(D7); @@ -543,6 +539,18 @@ mibReq.Type = MIB_ADR; mibReq.Param.AdrEnable = true; LoRaMacMibSetRequestConfirm( &mibReq ); + + // Limiting to just 2nd subband of 8 channels + static uint16_t GatewayChannelsMask[] = {0xFF00, 0x0000, 0x0000, 0x0000, 0x0002, 0x0000}; + mibReq.Type = MIB_CHANNELS_DEFAULT_MASK; + mibReq.Param.ChannelsDefaultMask = GatewayChannelsMask; + LoRaMacMibSetRequestConfirm( &mibReq ); + + mibReq.Type = MIB_CHANNELS_MASK; + mibReq.Param.ChannelsMask = GatewayChannelsMask; + LoRaMacMibSetRequestConfirm( &mibReq ); + + #if defined( USE_BAND_868 ) LoRaMacTestSetDutyCycleOn( false ); @@ -709,9 +717,9 @@ void flash_builtin() { myled = 1; // turn the LED on (HIGH is the voltage level) - wait(2); // wait for a second + wait(2); // wait for 2 second myled = 0; // turn the LED off by making the voltage LOW - wait(1); + wait(1); // wait for 1 second } /** @@ -726,16 +734,26 @@ HAL_StatusTypeDef status; -#if defined(TARGET_NUCLEO_L073RZ) || defined(TARGET_NUCLEO_L152RE) +#if defined(TARGET_NUCLEO_F411RE) + /* Start HSE first */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.HSEState = RCC_HSE_ON; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; + + + + + + + +#elif defined(TARGET_NUCLEO_L073RZ) || defined(TARGET_NUCLEO_L152RE) /* To clear HSE_BYPASS, we need to stop HSE first */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_OFF; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; -#elif defined(TARGET_NUCLEO_F411RE) - /* Start HSE first */ - RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; - RCC_OscInitStruct.HSEState = RCC_HSE_ON; - RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; + + + #else #error "!! Target not supported."; #endif @@ -989,6 +1007,20 @@ mibReq.Type = MIB_PUBLIC_NETWORK; mibReq.Param.EnablePublicNetwork = LORAWAN_PUBLIC_NETWORK; LoRaMacMibSetRequestConfirm( &mibReq ); + + + // Limiting to just 2nd subband of 8 channels + static uint16_t GatewayChannelsMask[] = {0xFF00, 0x0000, 0x0000, 0x0000, 0x0002, 0x0000}; + mibReq.Type = MIB_CHANNELS_DEFAULT_MASK; + mibReq.Param.ChannelsDefaultMask = GatewayChannelsMask; + LoRaMacMibSetRequestConfirm( &mibReq ); + + mibReq.Type = MIB_CHANNELS_MASK; + mibReq.Param.ChannelsMask = GatewayChannelsMask; + LoRaMacMibSetRequestConfirm( &mibReq ); + + + #if defined( USE_BAND_868 ) LoRaMacTestSetDutyCycleOn( LORAWAN_DUTYCYCLE_ON );