Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…#175, include Atos-Research-and-Innovation#171, and test ASIA923

fix Atos-Research-and-Innovation#170 and Atos-Research-and-Innovation#175, include Atos-Research-and-Innovation#171, and test ASIA923
And I checked to work in Japan
  • Loading branch information
takurx committed Jul 16, 2023
1 parent 647cf97 commit 3c84a43
Show file tree
Hide file tree
Showing 14 changed files with 1,095 additions and 360 deletions.
11 changes: 11 additions & 0 deletions examples/devices/stm32/Projects/B-L072Z-LRWAN1/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>B-L072Z-LRWAN1</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,28 @@
* \remark see STATIC_DEVICE_EUI comments
*/
#define LORAWAN_DEVICE_EUI { IEEE_OUI, 0x01, 0x01, 0x01, 0x01, 0x01 }
//#define LORAWAN_DEVICE_EUI { IEEE_OUI, 0x7E, 0xD0, 0x05, 0xE7, 0x57 }
//70B3D57ED005E757

/*!
* App/Join server IEEE EUI (big endian)
*/
#define LORAWAN_JOIN_EUI { 0x70, 0xB3, 0xD5, 0x7E, 0xD0, 0x00, 0x98, 0x5F }
//70B3D57ED000985F

/*!
* Application root key
* WARNING: NOT USED FOR 1.0.x DEVICES
*/
#define LORAWAN_APP_KEY { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C }

//#define LORAWAN_APP_KEY { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C }
#define LORAWAN_APP_KEY { 0xE5, 0xDE, 0xE0, 0xE4, 0xA3, 0xFF, 0x22, 0x91, 0x29, 0x68, 0x6A, 0x09, 0xCD, 0xDF, 0x9B, 0xB3 }
//E5 DE E0 E4 A3 FF 22 91 29 68 6A 09 CD DF 9B B3
/*!
* Network root key
* WARNING: FOR 1.0.x DEVICES IT IS THE \ref LORAWAN_APP_KEY
*/
#define LORAWAN_NWK_KEY { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C }
//#define LORAWAN_NWK_KEY { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C }
#define LORAWAN_NWK_KEY { 0xE5, 0xDE, 0xE0, 0xE4, 0xA3, 0xFF, 0x22, 0x91, 0x29, 0x68, 0x6A, 0x09, 0xCD, 0xDF, 0x9B, 0xB3 }

#if( OVER_THE_AIR_ACTIVATION == 0 )

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/

#define REGION_AS923 1
#define USE_B_L072Z_LRWAN1 1
/*!
* CAYENNE_LPP is myDevices Application server.
*/
Expand All @@ -42,7 +44,8 @@
/*!
* Defines the application data transmission duty cycle. 5s, value in [ms].
*/
#define APP_TX_DUTYCYCLE 10000
//#define APP_TX_DUTYCYCLE 10000
#define APP_TX_DUTYCYCLE 120000
/*!
* LoRaWAN Adaptive Data Rate
* @note Please note that when ADR is enabled the end-device should be static
Expand Down Expand Up @@ -259,42 +262,52 @@ static void Send( void* context )
TimerStart( &TxLedTimer );
#endif

BSP_sensor_Read( &sensor_data );
//BSP_sensor_Read( &sensor_data );

#ifdef CAYENNE_LPP
uint8_t cchannel=0;
uint8_t cchannel=3;
//temperature = ( int16_t )( sensor_data.temperature * 10 ); /* in �C * 10 */
pressure = ( uint16_t )( sensor_data.pressure * 100 / 10 ); /* in hPa / 10 */
humidity = ( uint16_t )( sensor_data.humidity * 2 ); /* in %*2 */
//pressure = ( uint16_t )( sensor_data.pressure * 100 / 10 ); /* in hPa / 10 */
//humidity = ( uint16_t )( sensor_data.humidity * 2 ); /* in %*2 */
//temperature = 0x255;
pressure = 2;
humidity = 3;
uint32_t i = 0;
uint16_t temperatureDegreeC = HW_GetTemperatureLevel();
uint16_t temperatureDegreeC_Int= (temperatureDegreeC)>>8;
uint16_t temperatureDegreeC_Frac= ((temperatureDegreeC-(temperatureDegreeC_Int<<8))*100)>>8;
temperature = ( int16_t )( temperatureDegreeC_Int* 10 + temperatureDegreeC_Frac/10);
batteryLevel = HW_GetBatteryLevel( ); /* 1 (very low) to 254 (fully charged) */
//uint16_t temperatureDegreeC = HW_GetTemperatureLevel();
//uint16_t temperatureDegreeC = temperature;
//uint16_t temperatureDegreeC_Int= (temperatureDegreeC)>>8;
//uint16_t temperatureDegreeC_Frac= ((temperatureDegreeC-(temperatureDegreeC_Int<<8))*100)>>8;
//temperature = ( int16_t )( temperatureDegreeC_Int* 10 + temperatureDegreeC_Frac/10);
//temperature = 0x255;
temperature = 0x100;
//batteryLevel = HW_GetBatteryLevel( ); /* 1 (very low) to 254 (fully charged) */
batteryLevel = 200;

AppData.Port = LPP_APP_PORT;

/*
AppData.Buff[i++] = cchannel++;
AppData.Buff[i++] = LPP_DATATYPE_BAROMETER;
AppData.Buff[i++] = ( pressure >> 8 ) & 0xFF;
AppData.Buff[i++] = pressure & 0xFF;
*/
AppData.Buff[i++] = cchannel++;
AppData.Buff[i++] = LPP_DATATYPE_TEMPERATURE;
AppData.Buff[i++] = ( temperature >> 8 ) & 0xFF;
AppData.Buff[i++] = temperature & 0xFF;
AppData.Buff[i++] = cchannel++;
AppData.Buff[i++] = LPP_DATATYPE_HUMIDITY;
AppData.Buff[i++] = humidity & 0xFF;
//AppData.Buff[i++] = cchannel++;
//AppData.Buff[i++] = LPP_DATATYPE_HUMIDITY;
//AppData.Buff[i++] = humidity & 0xFF;
#if defined( REGION_US915 ) || defined ( REGION_AU915 )
/* The maximum payload size does not allow to send more data for lowest DRs */
#else
/*
AppData.Buff[i++] = cchannel++;
AppData.Buff[i++] = LPP_DATATYPE_DIGITAL_INPUT;
AppData.Buff[i++] = batteryLevel*100/254;
AppData.Buff[i++] = cchannel++;
AppData.Buff[i++] = LPP_DATATYPE_DIGITAL_OUTPUT;
AppData.Buff[i++] = AppLedStateOn;
*/
#endif /* REGION_XX915 */
#else /* not CAYENNE_LPP */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@
<v6Rtti>0</v6Rtti>
<VariousControls>
<MiscControls>--C99</MiscControls>
<Define>STM32L072xx,USE_B_L072Z_LRWAN1,USE_HAL_DRIVER, REGION_EU868</Define>
<Define>STM32L072xx,USE_B_L072Z_LRWAN1,USE_HAL_DRIVER, REGION_AS923</Define>
<Undefine></Undefine>
<IncludePath>..\LoRaWAN\App\inc;..\Core\inc;..\..\..\..\..\..\Drivers\BSP\CMWX1ZZABZ-0xx;..\..\..\..\..\..\Drivers\STM32L0xx_HAL_Driver\Inc;..\..\..\..\..\..\Drivers\CMSIS\Device\ST\STM32L0xx\Include;..\..\..\..\..\..\Drivers\CMSIS\Include;..\..\..\..\..\..\Middlewares\Third_Party\LoRaWAN\Crypto;..\..\..\..\..\..\Middlewares\Third_Party\LoRaWAN\Mac;..\..\..\..\..\..\Middlewares\Third_Party\LoRaWAN\Phy;..\..\..\..\..\..\Middlewares\Third_Party\LoRaWAN\Utilities;..\..\..\..\..\..\Middlewares\Third_Party\LoRaWAN\Core;..\..\..\..\..\..\Drivers\BSP\Components\Common;..\..\..\..\..\..\Drivers\BSP\Components\hts221;..\..\..\..\..\..\Drivers\BSP\Components\lps22hb;..\..\..\..\..\..\Drivers\BSP\Components\lps25hb;..\..\..\..\..\..\Drivers\BSP\Components\sx1276;..\..\..\..\..\..\Drivers\BSP\X_NUCLEO_IKS01A1;..\..\..\..\..\..\Drivers\BSP\X_NUCLEO_IKS01A2;..\..\..\..\..\..\Drivers\BSP\B-L072Z-LRWAN1;..\..\..\..\..\..\Middlewares\Third_Party\LoRaWAN\Mac\region</IncludePath>
</VariousControls>
Expand Down
Loading

0 comments on commit 3c84a43

Please sign in to comment.