Commit e8f0b833 authored by Reto Da Forno's avatar Reto Da Forno
Browse files

issue with baseboard timestamp watchdog fixed and FlockLab-specific elwb settings added

parent 856d970f
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#define FW_NAME "DPP2eLWB" /* max. 8 chars */ #define FW_NAME "DPP2eLWB" /* max. 8 chars */
#define FW_VERSION_MAJOR 0 /* 0..6 */ #define FW_VERSION_MAJOR 0 /* 0..6 */
#define FW_VERSION_MINOR 2 /* 0..99 */ #define FW_VERSION_MINOR 2 /* 0..99 */
#define FW_VERSION_PATCH 6 /* 0..99 */ #define FW_VERSION_PATCH 7 /* 0..99 */
#define FLOCKLAB 1 /* set to 1 to run on FlockLab */ #define FLOCKLAB 1 /* set to 1 to run on FlockLab */
#define BASEBOARD 0 /* set to 1 if the comboard will be installed on a baseboard */ #define BASEBOARD 0 /* set to 1 if the comboard will be installed on a baseboard */
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
#if FLOCKLAB #if FLOCKLAB
#define NODE_HEALTH_MSG_PERIOD 15 /* in seconds */ #define NODE_HEALTH_MSG_PERIOD 15 /* in seconds */
#else /* FLOCKLAB */ #else /* FLOCKLAB */
#define NODE_HEALTH_MSG_PERIOD 60 /* in seconds */ #define NODE_HEALTH_MSG_PERIOD 300 /* in seconds */
#endif #endif
#define COLLECT_FLOODING_DATA 0 #define COLLECT_FLOODING_DATA 0
#define PS_TIMESTAMP() elwb_get_time(0) #define PS_TIMESTAMP() elwb_get_time(0)
...@@ -100,6 +100,7 @@ ...@@ -100,6 +100,7 @@
/* Gloria config */ /* Gloria config */
#if FLOCKLAB #if FLOCKLAB
/* use different settings on FlockLab */
#define GLORIA_INTERFACE_POWER 1 /* transmit power in dBm (max. value is 14 for most RF bands); keep non-zero init for binary patching!; config will be overwritten by binary patching! */ #define GLORIA_INTERFACE_POWER 1 /* transmit power in dBm (max. value is 14 for most RF bands); keep non-zero init for binary patching!; config will be overwritten by binary patching! */
#define GLORIA_INTERFACE_MODULATION 10 /* 7 = LoRa SF5, 10 = FSK 250kbit/s (see radio_constants.c for details); config will be overwritten by binary patching! */ #define GLORIA_INTERFACE_MODULATION 10 /* 7 = LoRa SF5, 10 = FSK 250kbit/s (see radio_constants.c for details); config will be overwritten by binary patching! */
#define GLORIA_INTERFACE_RF_BAND 46 /* 869.01 MHz (see table in radio_constants.c for options); config will be overwritten by binary patching! */ #define GLORIA_INTERFACE_RF_BAND 46 /* 869.01 MHz (see table in radio_constants.c for options); config will be overwritten by binary patching! */
...@@ -112,18 +113,25 @@ ...@@ -112,18 +113,25 @@
/* eLWB config */ /* eLWB config */
#define ELWB_ENABLE 1 #define ELWB_ENABLE 1
#define ELWB_CONF_NETWORK_ID 0x3333 #define ELWB_CONF_NETWORK_ID 0x3333
#define ELWB_CONF_N_TX 2 /* number of transmissions */ #if FLOCKLAB
#define ELWB_CONF_NUM_HOPS 6 /* network diameter in number of hops */ /* use different settings on FlockLab */
#define ELWB_CONF_N_TX 2 /* number of transmissions */
#define ELWB_CONF_NUM_HOPS 6 /* network diameter in number of hops */
#define ELWB_CONF_MAX_NODES 30
#define ELWB_CONF_SCHED_NODE_LIST 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, 19, 20, 21, 22, 23, 24, 26, 27, 28, 31, 32 /* nodes to pre-register in the scheduler, also include HOST_ID here! */
#else /* FLOCKLAB */
#define ELWB_CONF_N_TX 2 /* number of transmissions */
#define ELWB_CONF_NUM_HOPS 3 /* network diameter in number of hops */
#define ELWB_CONF_MAX_NODES 10
#endif /* FLOCKLAB */
#define ELWB_CONF_T_GAP ELWB_MS_TO_TICKS(10) #define ELWB_CONF_T_GAP ELWB_MS_TO_TICKS(10)
#define ELWB_CONF_SCHED_PERIOD 15 #define ELWB_CONF_SCHED_PERIOD 15
#define ELWB_CONF_DATA_ACK 1 #define ELWB_CONF_DATA_ACK 1
#define ELWB_CONF_CONT_USE_HSTIMER 1 #define ELWB_CONF_CONT_USE_HSTIMER 1
#define ELWB_CONF_MAX_PAYLOAD_LEN 100 #define ELWB_CONF_MAX_PAYLOAD_LEN 100
#define ELWB_CONF_MAX_NODES 30
#define ELWB_CONF_MAX_DATA_SLOTS ELWB_CONF_MAX_NODES #define ELWB_CONF_MAX_DATA_SLOTS ELWB_CONF_MAX_NODES
#define ELWB_ON_WAKEUP() lpm_update_opmode(OP_MODE_EVT_WAKEUP) #define ELWB_ON_WAKEUP() lpm_update_opmode(OP_MODE_EVT_WAKEUP)
#define ELWB_CONF_T_PREPROCESS ELWB_MS_TO_TICKS(50) #define ELWB_CONF_T_PREPROCESS ELWB_MS_TO_TICKS(50)
#define ELWB_CONF_SCHED_NODE_LIST 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, 19, 20, 21, 22, 23, 24, 26, 27, 28, 31, 32 /* nodes to pre-register in the scheduler, also include HOST_ID here! */
/* baseboard */ /* baseboard */
#if BASEBOARD #if BASEBOARD
...@@ -217,4 +225,8 @@ ...@@ -217,4 +225,8 @@
#error "BASEBOARD_TREQ_WATCHDOG must be >= 120" #error "BASEBOARD_TREQ_WATCHDOG must be >= 120"
#endif #endif
#if BASEBOARD_TREQ_WATCHDOG && !TIMESTAMP_USE_HS_TIMER
#error "BASEBOARD_TREQ_WATCHDOG requires TIMESTAMP_USE_HS_TIMER"
#endif
#endif /* __APP_CONFIG_H */ #endif /* __APP_CONFIG_H */
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
/* /*
v0.2.7
- issue fixed with baseboard time request watchdog
- use different eLWB settings on FlockLab
v0.2.6 v0.2.6
- code refactoring, some adjustments to message handling and debug prints - code refactoring, some adjustments to message handling and debug prints
- timestamping fixed - timestamping fixed
......
Subproject commit bd359ed285926e891f308c7101675e2bc68f90fb Subproject commit c611ff668555e5b5ccf36bc0b7fc86b0bd2a556c
...@@ -103,8 +103,8 @@ void handle_treq(void) ...@@ -103,8 +103,8 @@ void handle_treq(void)
uint32_t curr_ticks = (uint32_t)bolt_trq_hs_timestamp; uint32_t curr_ticks = (uint32_t)bolt_trq_hs_timestamp;
uint32_t elapsed_hs_ticks = curr_ticks - htim2.Instance->CCR4; uint32_t elapsed_hs_ticks = curr_ticks - htim2.Instance->CCR4;
bolt_trq_hs_timestamp -= elapsed_hs_ticks; bolt_trq_hs_timestamp -= elapsed_hs_ticks;
bolt_trq_timestamp -= (elapsed_hs_ticks / (HS_TIMER_FREQUENCY / LPTIMER_SECOND)); bolt_trq_timestamp -= HS_TIMER_TICKS_TO_LPTIMER(elapsed_hs_ticks);
LOG_VERBOSE("timestamp request received %lums ago", (elapsed_hs_ticks / (HS_TIMER_FREQUENCY / 1000))); LOG_VERBOSE("timestamp request received %lums ago", HS_TIMER_TICKS_TO_MS(elapsed_hs_ticks));
__HAL_TIM_CLEAR_FLAG(&htim2, TIM_FLAG_CC4); /* clear capture compare interrupt flag */ __HAL_TIM_CLEAR_FLAG(&htim2, TIM_FLAG_CC4); /* clear capture compare interrupt flag */
__HAL_TIM_CLEAR_FLAG(&htim2, TIM_FLAG_CC4OF); /* clear capture overrun flag */ __HAL_TIM_CLEAR_FLAG(&htim2, TIM_FLAG_CC4OF); /* clear capture overrun flag */
...@@ -248,16 +248,16 @@ void vTask_pre(void const * argument) ...@@ -248,16 +248,16 @@ void vTask_pre(void const * argument)
} }
#if BASEBOARD_TREQ_WATCHDOG && BASEBOARD #if BASEBOARD_TREQ_WATCHDOG && BASEBOARD
static uint64_t last_treq = 0; static uint64_t last_treq = 0; /* hs timestamp of last request */
if (bolt_trq_timestamp > last_treq) { if (bolt_trq_hs_timestamp > last_treq) {
last_treq = bolt_trq_timestamp; last_treq = bolt_trq_hs_timestamp;
} }
/* only use time request watchdog when baseboard is enabled */ /* only use time request watchdog when baseboard is enabled */
if (BASEBOARD_IS_ENABLED()) { if (BASEBOARD_IS_ENABLED()) {
bool powercycle = false; bool powercycle = false;
/* check when was the last time we got a time request */ /* check when was the last time we got a time request */
if (((hs_timer_now() - last_treq) / HS_TIMER_FREQUENCY) > BASEBOARD_TREQ_WATCHDOG) { if (HS_TIMER_TICKS_TO_S(hs_timer_now() - last_treq) > BASEBOARD_TREQ_WATCHDOG) {
last_treq = hs_timer_now(); last_treq = hs_timer_now();
powercycle = true; powercycle = true;
} }
if (powercycle) { if (powercycle) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment