From 67ab90b8ec2962243bd3bc5413099cfb18d3f314 Mon Sep 17 00:00:00 2001 From: Otso Jousimaa Date: Thu, 19 Apr 2018 13:21:01 +0200 Subject: [PATCH 1/9] Fix crash on non-GATT enabled FW having bond information --- drivers/bluetooth/ble_event_handlers.c | 8 +- drivers/bluetooth/bluetooth_core.c | 21 +- drivers/init/init.c | 89 +++-- drivers/init/init.c.orig | 308 ------------------ .../eddystone/sdk_application_config.h | 5 +- .../application_ble_event_handlers.c | 5 + ruuvi_examples/ruuvi_firmware/main.c | 48 ++- .../ruuvi_firmware/sdk_application_config.h | 9 +- 8 files changed, 121 insertions(+), 372 deletions(-) delete mode 100644 drivers/init/init.c.orig diff --git a/drivers/bluetooth/ble_event_handlers.c b/drivers/bluetooth/ble_event_handlers.c index 911b3726..b50e262b 100644 --- a/drivers/bluetooth/ble_event_handlers.c +++ b/drivers/bluetooth/ble_event_handlers.c @@ -1,4 +1,5 @@ #include "ble_event_handlers.h" +#include "sdk_application_config.h" #include #include @@ -34,9 +35,11 @@ bool is_ble_connected() */ void sys_evt_dispatch(uint32_t sys_evt) { + #if APP_GATT_PROFILE_ENABLED // Dispatch the system event to the fstorage module, where it will be // dispatched to the Flash Data Storage (FDS) module. fs_sys_event_handler(sys_evt); + #endif // Dispatch to the Advertising module last, since it will check if there are any // pending flash operations in fstorage. Let fstorage process system events first, @@ -324,11 +327,14 @@ void ble_evt_dispatch(ble_evt_t * p_ble_evt) { NRF_LOG_DEBUG("Dispatching BLE Event to modules\r\n"); ble_conn_state_on_ble_evt(p_ble_evt); - pm_on_ble_evt(p_ble_evt); ble_conn_params_on_ble_evt(p_ble_evt); bsp_btn_ble_on_ble_evt(p_ble_evt); ble_advertising_on_ble_evt(p_ble_evt); on_ble_evt(p_ble_evt); application_on_ble_evt(p_ble_evt); nrf_ble_qwr_on_ble_evt(&m_qwr, p_ble_evt); + + #if PEER_MANAGER_ENABLED + pm_on_ble_evt(p_ble_evt); + #endif } diff --git a/drivers/bluetooth/bluetooth_core.c b/drivers/bluetooth/bluetooth_core.c index 0c3752a0..aa12e0b9 100644 --- a/drivers/bluetooth/bluetooth_core.c +++ b/drivers/bluetooth/bluetooth_core.c @@ -134,10 +134,13 @@ ble_advdata_t scanresp = }; static bool advertising = false; -static ble_gap_conn_params_t gap_conn_params; static ble_gap_conn_sec_mode_t sec_mode; static ble_advdata_manuf_data_t m_manufacturer_data; +#if APP_GATT_PROFILE_ENABLED + static ble_gap_conn_params_t gap_conn_params; +#endif + /** * Generate name "BASEXXXX", where Base is human-readable (i.e. Ruuvi) and XXXX is last 4 chars of mac address * @@ -232,6 +235,7 @@ ret_code_t bluetooth_apply_configuration() return err_code; } +#if APP_GATT_PROFILE_ENABLED /**@brief Function for the GAP initialization. * * @details This function will set up all the necessary GAP (Generic Access Profile) parameters of @@ -254,7 +258,6 @@ static void gap_params_init(void) APP_ERROR_CHECK(err_code); } - /**@brief Function for initializing the Connection Parameters module. */ static void conn_params_init(void) @@ -279,6 +282,8 @@ static void conn_params_init(void) //nrf_delay_ms(10); APP_ERROR_CHECK(err_code); } +#endif + //TODO: Enable & differentiate slow / fast advertising static void advertising_init(void) { @@ -336,8 +341,10 @@ ret_code_t bluetooth_stack_init(void) ble_enable_params.gatt_enable_params.att_mtu = NRF_BLE_MAX_MTU_SIZE; #endif + #if APP_GATT_PROFILE_ENABLED //Init filesystem err_code |= fs_init(); + #endif // Subscribe for BLE events. err_code |= softdevice_ble_evt_handler_set(ble_evt_dispatch); @@ -354,8 +361,9 @@ ret_code_t bluetooth_stack_init(void) NRF_LOG_INFO("Softdevice enabled, status: %s\r\n", (uint32_t)ERR_TO_STR(err_code)); nrf_delay_ms(10); - //Enable peer manager, erase bonds - peer_manager_init(true); + //Enable peer manager, do not erase bonds + #if APP_GATT_PROFILE_ENABLED + peer_manager_init(false); NRF_LOG_INFO("Peer manager init \r\n"); nrf_delay_ms(10); @@ -365,11 +373,12 @@ ret_code_t bluetooth_stack_init(void) gap_params_init(); NRF_LOG_INFO("GAP params init\r\n"); - //nrf_delay_ms(10); + nrf_delay_ms(10); conn_params_init(); NRF_LOG_INFO("Conn params init, status\r\n"); - //nrf_delay_ms(10); + nrf_delay_ms(10); + #endif advertising_init(); NRF_LOG_INFO("Advertising init, status\r\n"); diff --git a/drivers/init/init.c b/drivers/init/init.c index 68d6f985..f7a3efac 100644 --- a/drivers/init/init.c +++ b/drivers/init/init.c @@ -44,7 +44,7 @@ * * This function initializes logging peripherals, and must be called before using NRF_LOG(). * Exact functionality depends on defines at sdk_config.h. - * + * * @return 0 Operation successful * @retval 1 Something went wrong * @@ -72,27 +72,27 @@ init_err_code_t init_ble(void) //Enable DC/DC for BLE NRF_POWER->DCDCEN = 1; NRF_LOG_DEBUG("BLE Stack init start\r\n"); - + //Enable scheduler - required for BLE stack APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE); APP_TIMER_APPSH_INIT(RUUVITAG_APP_TIMER_PRESCALER, SCHED_QUEUE_SIZE, true); //Enable BLE STACK err_code = bluetooth_stack_init(); - + // Application Replies are sent by BLE GATT set_ble_gatt_handler(ble_std_transfer_asynchronous); set_reply_handler(ble_std_transfer_asynchronous); - + NRF_LOG_DEBUG("BLE Stack init done\r\n"); return (NRF_SUCCESS == err_code) ? INIT_SUCCESS : INIT_ERR_UNKNOWN; } /** * Initialize NFC driver - * + * * Puts NFC on standby, ready to transmit ID of the tag. - * + * * @return 0 Operation successful * @retval 1 Something went wrong * @@ -125,10 +125,10 @@ init_err_code_t init_timer(app_timer_id_t main_timer_id, uint32_t main_interval, // Requires low-frequency clock initialized. // Create timer init_err_code_t err_code = app_timer_create(&main_timer_id, - APP_TIMER_MODE_REPEATED, - timer_handler); + APP_TIMER_MODE_REPEATED, + timer_handler); APP_ERROR_CHECK(err_code); - + //Start timer err_code = app_timer_start(main_timer_id, APP_TIMER_TICKS(main_interval, RUUVITAG_APP_TIMER_PRESCALER), NULL); // 1 event / MAIN_TIMER_INTERVAL APP_ERROR_CHECK(err_code); @@ -145,18 +145,18 @@ init_err_code_t init_timer(app_timer_id_t main_timer_id, uint32_t main_interval, */ init_err_code_t init_leds(void) { - if(LED_RED) - { - nrf_gpio_cfg_output (LED_RED); - nrf_gpio_pin_set(LED_RED); - } - if(LED_GREEN) - { - nrf_gpio_cfg_output (LED_GREEN); - nrf_gpio_pin_set(LED_GREEN); - } - NRF_LOG_DEBUG("LEDs init\r\n"); - return INIT_SUCCESS; // Cannot fail under any reasonable circumstance + if (LED_RED) + { + nrf_gpio_cfg_output (LED_RED); + nrf_gpio_pin_set(LED_RED); + } + if (LED_GREEN) + { + nrf_gpio_cfg_output (LED_GREEN); + nrf_gpio_pin_set(LED_GREEN); + } + NRF_LOG_DEBUG("LEDs init\r\n"); + return INIT_SUCCESS; // Cannot fail under any reasonable circumstance } /** @@ -187,7 +187,7 @@ init_err_code_t init_lis2dh12(void) { NRF_LOG_ERROR("LIS2DH12 init Failed: Error Code: %d\r\n", (int32_t)err_code); } - return err_code; + return err_code; } init_err_code_t init_bme280(void) @@ -197,7 +197,7 @@ init_err_code_t init_bme280(void) err_code = bme280_init(); if (INIT_SUCCESS != err_code) { - return (BME280_RET_ERROR_SELFTEST == (BME280_Ret)err_code) ? INIT_ERR_SELFTEST : INIT_ERR_NO_RESPONSE; + return (BME280_RET_ERROR_SELFTEST == (BME280_Ret)err_code) ? INIT_ERR_SELFTEST : INIT_ERR_NO_RESPONSE; } //TODO: reset bme280_set_mode(BME280_MODE_SLEEP); //Set sleep mode to allow configuration, sensor might have old config in internal RAM @@ -213,7 +213,7 @@ init_err_code_t init_bme280(void) } else { - NRF_LOG_ERROR("BME280 init Failed: Error Code: %d\r\n", (uint32_t)err_code); + NRF_LOG_ERROR("BME280 init Failed: Error Code: %d\r\n", (uint32_t)err_code); } return err_code; @@ -223,7 +223,7 @@ init_err_code_t init_bme280(void) * Initialize sensors * * This function initializes the sensor drivers. - * It should be called even if sensors are not used, + * It should be called even if sensors are not used, * since initialization will put sensors in low-power mode * * @@ -247,8 +247,8 @@ init_err_code_t init_sensors(void) */ init_err_code_t init_pwm(void) { - pwm_init(200, LED_RED, LED_GREEN, 0, 0); - return INIT_SUCCESS; + pwm_init(200, LED_RED, LED_GREEN, 0, 0); + return INIT_SUCCESS; } /** @@ -259,37 +259,34 @@ init_err_code_t init_pwm(void) */ init_err_code_t init_watchdog(watchdog_event_handler_t handler) { - if(NULL == handler) { handler = watchdog_default_handler; } - init_err_code_t err_code = INIT_SUCCESS; - err_code |= watchdog_init(handler); - watchdog_enable(); - return err_code; - + if (NULL == handler) { handler = watchdog_default_handler; } + init_err_code_t err_code = INIT_SUCCESS; + err_code |= watchdog_init(handler); + watchdog_enable(); + return err_code; + } /** * Display init status + * Blinks 10 times if there was error in init and returns. * - * This function checks the init status from previous - * init operations, and blinks the led in infinite loop - * if there was error. - * * @param init_status number of errors occured in init, 0 on successful init. */ init_err_code_t init_blink_status(uint8_t init_status) { - nrf_gpio_pin_clear(LED_RED); - do + if (init_status) { - for(uint8_t ii = 0; ii < init_status * 2; ii++) - { + nrf_gpio_pin_clear(LED_RED); + + for (uint8_t ii = 0; ii < 10 * 2; ii++) + { nrf_gpio_pin_toggle(LED_RED); - nrf_delay_ms(150u);//Delay prevents power saving, use with care + nrf_delay_ms(250u);//Delay prevents power saving, use with care }//infinite loop if there is error - nrf_delay_ms(1000u); // Gives user time to count the blinks - }while(init_status); - nrf_gpio_pin_set(LED_RED); - + nrf_gpio_pin_set(LED_RED); + } + return INIT_SUCCESS; } diff --git a/drivers/init/init.c.orig b/drivers/init/init.c.orig deleted file mode 100644 index 69ac7927..00000000 --- a/drivers/init/init.c.orig +++ /dev/null @@ -1,308 +0,0 @@ -#include -#include "init.h" - -//Nordic SDK -#include "ble_advdata.h" -#include "nordic_common.h" -#include "softdevice_handler.h" -#include "app_scheduler.h" -#include "app_timer_appsh.h" -#include "nrf_drv_clock.h" -#include "nrf_gpio.h" -#include "nrf_delay.h" - - -//BSP -#include "bsp.h" -#include "boards.h" - -//Drivers -#include "lis2dh12.h" -#include "bme280.h" -#include "battery.h" -#include "ble_bulk_transfer.h" -#include "bluetooth_core.h" -#include "bme280_temperature_handler.h" -#include "lis2dh12.h" -#include "lis2dh12_acceleration_handler.h" -#include "nfc.h" -#include "pin_interrupt.h" -#include "pwm.h" -#include "watchdog.h" - -//Libraries -#include "ruuvi_endpoints.h" -#include "chain_channels.h" - - -#define NRF_LOG_MODULE_NAME "INIT" -#include "nrf_log.h" -#include "nrf_log_ctrl.h" - -/** - * Initialize logging - * - * This function initializes logging peripherals, and must be called before using NRF_LOG(). - * Exact functionality depends on defines at sdk_config.h. - * - * @return 0 Operation successful - * @retval 1 Something went wrong - * - */ -init_err_code_t init_log(void) -{ - init_err_code_t err_code; - err_code = NRF_LOG_INIT(NULL); - APP_ERROR_CHECK(err_code); - NRF_LOG_DEBUG("Logging init\r\n"); - return (NRF_SUCCESS == err_code) ? INIT_SUCCESS : INIT_ERR_UNKNOWN; -} - -/** - * Initialize ble stack - * - * This function initializes BLE stack, related timers and clock sources. - * Most of the functions of RuuviTag require BLE stack initialization for timers - * and clocks even if the do not use BLE functionality - */ -init_err_code_t init_ble(void) -{ - init_err_code_t err_code; - - //Enable DC/DC for BLE - NRF_POWER->DCDCEN = 1; - NRF_LOG_DEBUG("BLE Stack init start\r\n"); - - //Enable scheduler - required for BLE stack - APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE); - APP_TIMER_APPSH_INIT(RUUVITAG_APP_TIMER_PRESCALER, SCHED_QUEUE_SIZE, true); - - //Enable BLE STACK - err_code = bluetooth_stack_init(); - - // Application Replies are sent by BLE GATT - set_ble_gatt_handler(ble_std_transfer_asynchronous); - set_reply_handler(ble_std_transfer_asynchronous); - - NRF_LOG_DEBUG("BLE Stack init done\r\n"); - return (NRF_SUCCESS == err_code) ? INIT_SUCCESS : INIT_ERR_UNKNOWN; -} - -/** - * Initialize NFC driver - * - * Puts NFC on standby, ready to transmit ID of the tag. - * - * @return 0 Operation successful - * @retval 1 Something went wrong - * - */ -<<<<<<< HEAD -uint8_t init_nfc(void) -{ - uint32_t err_code; - - //Enable NFC with empty data message - err_code = nfc_init(NULL, 0); - APP_ERROR_CHECK(err_code); -======= -init_err_code_t init_nfc(void) -{ - init_err_code_t err_code = NRF_SUCCESS; - - //Enable NFC with empty data message - err_code = nfc_init(NULL, 0); ->>>>>>> master - - NRF_LOG_INFO("NFC init\r\n"); - return (NRF_SUCCESS == err_code) ? 0 : 1; -} - -/** - * Initialize timers - * - * This function initializes timers used by main application. - * Requires low-frequency clock source initialized by BLE init - * - * @param main_timer_id pointer to timer data structure - * @param main_interval Interval at which the main loop should be run in ms - * @param timer_handler function to be called at main interval - * - */ -init_err_code_t init_timer(app_timer_id_t main_timer_id, uint32_t main_interval, void (*timer_handler)(void *)) -{ - //TODO Check lfclk config - // Requires low-frequency clock initialized. - // Create timer - init_err_code_t err_code = app_timer_create(&main_timer_id, - APP_TIMER_MODE_REPEATED, - timer_handler); - APP_ERROR_CHECK(err_code); - - //Start timer - err_code = app_timer_start(main_timer_id, APP_TIMER_TICKS(main_interval, RUUVITAG_APP_TIMER_PRESCALER), NULL); // 1 event / MAIN_TIMER_INTERVAL - APP_ERROR_CHECK(err_code); - NRF_LOG_DEBUG("Timers init\r\n"); - return (NRF_SUCCESS == err_code) ? INIT_SUCCESS : INIT_ERR_UNKNOWN; -} - -/** - * Initialize leds - * - * This function initializes GPIO for leds - * TODO: Generalise - * - */ -init_err_code_t init_leds(void) -{ - if(LED_RED) - { - nrf_gpio_cfg_output (LED_RED); - nrf_gpio_pin_set(LED_RED); - } - if(LED_GREEN) - { - nrf_gpio_cfg_output (LED_GREEN); - nrf_gpio_pin_set(LED_GREEN); - } - NRF_LOG_DEBUG("LEDs init\r\n"); - return INIT_SUCCESS; // Cannot fail under any reasonable circumstance -} - -/** - * Initialize buttons - * - * This function initializes GPIO for buttons, setting pull-up and sensing hi-to-low transition. - * - */ -init_err_code_t init_buttons(void) -{ - nrf_gpio_cfg_sense_input(BUTTON_1, - BUTTON_PULL, - NRF_GPIO_PIN_SENSE_LOW); - return INIT_SUCCESS; // Cannot fail under any reasonable circumstance -} - -init_err_code_t init_lis2dh12(void) -{ - init_err_code_t err_code = INIT_SUCCESS; - err_code |= lis2dh12_init(); - - if (INIT_SUCCESS == err_code) - { - NRF_LOG_DEBUG("LIS2DH12 init Done\r\n"); - set_acceleration_handler(lis2dh12_acceleration_handler); - // Interrupt handler is defined in lis2dh12_acceleration_handler.c, reads the buffer and passes the data onwards to application as configured. - // Try using PROPRIETARY as a target of accelerometer to implement your own logic. - err_code |= pin_interrupt_enable(INT_ACC1_PIN, NRF_GPIOTE_POLARITY_LOTOHI, lis2dh12_int1_handler); - } - else - { - NRF_LOG_ERROR("LIS2DH12 init Failed: Error Code: %d\r\n", (int32_t)err_code); - } - return err_code; -} - -init_err_code_t init_bme280(void) -{ - // Read calibration - init_err_code_t err_code = INIT_SUCCESS; - err_code = bme280_init(); - if (INIT_SUCCESS != err_code) - { - return (BME280_RET_ERROR_SELFTEST == (BME280_Ret)err_code) ? INIT_ERR_SELFTEST : INIT_ERR_NO_RESPONSE; - } - //TODO: reset - bme280_set_mode(BME280_MODE_SLEEP); //Set sleep mode to allow configuration, sensor might have old config in internal RAM - err_code |= bme280_set_interval(BME280_STANDBY_1000_MS); - err_code |= bme280_set_oversampling_hum(BME280_OVERSAMPLING_1); - err_code |= bme280_set_oversampling_temp(BME280_OVERSAMPLING_1); - err_code |= bme280_set_oversampling_press(BME280_OVERSAMPLING_1); - - if (BME280_RET_OK == (BME280_Ret)err_code) - { - NRF_LOG_DEBUG("BME280 init Done, setting up message handlers\r\n"); - set_temperature_handler(bme280_temperature_handler); - } - else - { - NRF_LOG_ERROR("BME280 init Failed: Error Code: %d\r\n", (uint32_t)err_code); - } - - return err_code; -} - -/** - * Initialize sensors - * - * This function initializes the sensor drivers. - * It should be called even if sensors are not used, - * since initialization will put sensors in low-power mode - * - * - */ -init_err_code_t init_sensors(void) -{ - init_err_code_t err_code = INIT_SUCCESS; - //Init accelerometer lis2dh12 - err_code |= init_lis2dh12(); - //init environmental sensor bme280 - err_code |= init_bme280(); - //init chain channels - chain_handler_init(); - set_chain_handler(chain_handler); - - return err_code; -} - -/** - * Initialise PWM channels - */ -init_err_code_t init_pwm(void) -{ - pwm_init(200, LED_RED, LED_GREEN, 0, 0); - return INIT_SUCCESS; -} - -/** - * Initialize and enable watchdog. After calling this function - * watchdog_feed() must be called at interval defined by sdk_config. - * If NULL is given as a handler, default handler which prints error - * log is used. - */ -init_err_code_t init_watchdog(watchdog_event_handler_t handler) -{ - if(NULL == handler) { handler = watchdog_default_handler; } - init_err_code_t err_code = INIT_SUCCESS; - err_code |= watchdog_init(handler); - watchdog_enable(); - return err_code; - -} - -/** - * Display init status - * - * This function checks the init status from previous - * init operations, and blinks the led in infinite loop - * if there was error. - * - * @param init_status number of errors occured in init, 0 on successful init. - */ -init_err_code_t init_blink_status(uint8_t init_status) -{ - nrf_gpio_pin_clear(LED_RED); - do - { - for(uint8_t ii = 0; ii < init_status * 2; ii++) - { - nrf_gpio_pin_toggle(LED_RED); - nrf_delay_ms(150u);//Delay prevents power saving, use with care - }//infinite loop if there is error - - nrf_delay_ms(1000u); // Gives user time to count the blinks - }while(init_status); - nrf_gpio_pin_set(LED_RED); - - return INIT_SUCCESS; -} diff --git a/ruuvi_examples/eddystone/sdk_application_config.h b/ruuvi_examples/eddystone/sdk_application_config.h index 3317fb45..501f32b8 100644 --- a/ruuvi_examples/eddystone/sdk_application_config.h +++ b/ruuvi_examples/eddystone/sdk_application_config.h @@ -17,14 +17,17 @@ #define TIMER1_ENABLED 0 //CSense #define TIMER2_ENABLED 0 //CSense #define TIMER3_ENABLED 0 -#define TIMER4_ENABLED 0 //Required by NFC +#define TIMER4_ENABLED 0 //Reserved by NFC #define NFC_HAL_ENABLED 1 #define CRC16_ENABLED 1 //Required by DFU #define CRC32_ENABLED 1 #define NRF_LOG_ENABLED 0 +#define APP_GATT_PROFILE_ENABLED 1 #define PEER_MANAGER_ENABLED 1 #define BLE_DIS_ENABLED 1 +#define BLE_NUS_ENABLED 0 +#define BLE_DFU_ENABLED 0 #define FDS_OP_QUEUE_SIZE 10 #define FDS_CHUNK_QUEUE_SIZE 15 diff --git a/ruuvi_examples/ruuvi_firmware/ble_services/application_ble_event_handlers.c b/ruuvi_examples/ruuvi_firmware/ble_services/application_ble_event_handlers.c index 6c0254cf..a75e060d 100644 --- a/ruuvi_examples/ruuvi_firmware/ble_services/application_ble_event_handlers.c +++ b/ruuvi_examples/ruuvi_firmware/ble_services/application_ble_event_handlers.c @@ -1,6 +1,7 @@ #include "application_ble_event_handlers.h" #include "application_service_if.h" +#include "sdk_application_config.h" #define NRF_LOG_MODULE_NAME "APP_BLE_EVENT_HANDLER" #include "nrf_log.h" @@ -17,10 +18,14 @@ void application_on_ble_evt(ble_evt_t * p_ble_evt) { /** Return pointer to BLE dfu service **/ + #if BLE_NUS_ENABLED ble_dfu_t* p_dfu = get_dfu(); ble_dfu_on_ble_evt(p_dfu, p_ble_evt); + #endif /** Return pointer to BLE nus service **/ + #if BLE_DFU_ENABLED ble_nus_t* p_nus = get_nus(); ble_nus_on_ble_evt(p_nus, p_ble_evt); + #endif } diff --git a/ruuvi_examples/ruuvi_firmware/main.c b/ruuvi_examples/ruuvi_firmware/main.c index d44f76df..c74872bb 100644 --- a/ruuvi_examples/ruuvi_firmware/main.c +++ b/ruuvi_examples/ruuvi_firmware/main.c @@ -149,6 +149,7 @@ static void power_manage(void) nrf_gpio_pin_set(LED_RED); uint32_t err_code = sd_app_evt_wait(); + NRF_LOG_INFO("SD_Wait status %d\r\n", err_code); APP_ERROR_CHECK(err_code); // Signal mode by led color. @@ -230,26 +231,47 @@ void main_timer_handler(void * p_context) */ int main(void) { + + ret_code_t err_code = 0; // counter, gets incremented by each failed init. It is 0 in the end if init was ok. - if(NRF_SUCCESS == init_sensors()) { model_plus = true; } - // Initialize log. + nrf_delay_ms(10); err_code |= init_log(); - + // Initialize log. + // Setup leds. LEDs are active low, so setting high them turns leds off. err_code |= init_leds(); // INIT leds first and turn RED on. nrf_gpio_pin_clear(LED_RED); // If INIT fails at later stage, RED will stay lit. + nrf_delay_ms(10); + + NRF_LOG_INFO("LOG INIT \r\n"); + + if(NRF_SUCCESS == init_sensors()) + { + NRF_LOG_INFO("SENSORS INIT \r\n"); + model_plus = true; + } + nrf_delay_ms(10); + + + //Init NFC ASAP in case we're waking from deep sleep via NFC (todo) err_code |= init_nfc(); + NRF_LOG_INFO("NFC INIT \r\n"); + nrf_delay_ms(10); // Start interrupts. err_code |= pin_interrupt_init(); + nrf_delay_ms(10); // Initialize button. err_code |= pin_interrupt_enable(BSP_BUTTON_0, NRF_GPIOTE_POLARITY_HITOLO, button_press_handler); + nrf_delay_ms(10); // Interrupt handler is defined in lis2dh12_acceleration_handler.c, reads the buffer and passes the data onwards to application as configured. // Try using PROPRIETARY as a target of accelerometer to implement your own logic. err_code |= pin_interrupt_enable(INT_ACC1_PIN, NRF_GPIOTE_POLARITY_LOTOHI, lis2dh12_int1_handler); + NRF_LOG_INFO("INTERRUPT INIT \r\n"); + nrf_delay_ms(10); // Initialize BME 280 and lis2dh12. if (model_plus) @@ -264,6 +286,8 @@ int main(void) // Sample rate 10 for activity detection. lis2dh12_set_sample_rate(LIS2DH12_RATE_1); lis2dh12_set_resolution(LIS2DH12_RES12BIT); + NRF_LOG_INFO("LIS INIT \r\n"); + nrf_delay_ms(10); // Setup BME280 - oversampling must be set for each used sensor. bme280_set_oversampling_hum(BME280_OVERSAMPLING_1); @@ -272,25 +296,35 @@ int main(void) bme280_set_iir(BME280_IIR_16); bme280_set_interval(BME280_STANDBY_1000_MS); bme280_set_mode(BME280_MODE_NORMAL); - NRF_LOG_DEBUG("BME280 configuration done\r\n"); + NRF_LOG_INFO("BME280 configuration done\r\n"); + nrf_delay_ms(10); } // Initialize BLE Stack. Required in all applications for timer operation. err_code |= init_ble(); + nrf_delay_ms(10); // Start advertising only after sensors have valid data - err_code |= bluetooth_advertising_stop(); + err_code |= bluetooth_tx_power_set(BLE_TX_POWER); err_code |= bluetooth_configure_advertising_interval(MAIN_LOOP_INTERVAL_RAW); err_code |= bluetooth_configure_advertisement_type(BLE_GAP_ADV_TYPE_ADV_NONCONN_IND); + NRF_LOG_INFO("BLE INIT \r\n"); + nrf_delay_ms(10); // Init ok, start watchdog with default wdt event handler (reset). - init_watchdog(NULL); + // init_watchdog(NULL); + NRF_LOG_INFO("WATCHDOG INIT \r\n"); + nrf_delay_ms(10); // Used only for button debounce err_code |= init_rtc(); + NRF_LOG_INFO("RTC INIT \r\n"); + nrf_delay_ms(10); // Initialize the application timer module. err_code |= init_timer(main_timer_id, MAIN_LOOP_INTERVAL_RAW, main_timer_handler); + NRF_LOG_INFO("TIMER INIT \r\n"); + nrf_delay_ms(10); // Visually display init status. Hangs if there was an error, waits 3 seconds on success. init_blink_status(err_code); @@ -305,6 +339,8 @@ int main(void) // Enter main loop. bluetooth_advertising_start(); + NRF_LOG_INFO("ADVERTISING START \r\n"); + nrf_delay_ms(10); for (;;) { app_sched_execute(); diff --git a/ruuvi_examples/ruuvi_firmware/sdk_application_config.h b/ruuvi_examples/ruuvi_firmware/sdk_application_config.h index c6fc8e08..236c6c70 100644 --- a/ruuvi_examples/ruuvi_firmware/sdk_application_config.h +++ b/ruuvi_examples/ruuvi_firmware/sdk_application_config.h @@ -18,10 +18,11 @@ #define CRC16_ENABLED 1 //Required by DFU #define CRC32_ENABLED 1 #define NRF_LOG_ENABLED 0 - -#define PEER_MANAGER_ENABLED 1 -#define BLE_DIS_ENABLED 1 -#define BLE_NUS_ENABLED 1 +#define APP_GATT_PROFILE_ENABLED 0 +#define PEER_MANAGER_ENABLED 0 +#define BLE_DIS_ENABLED 0 +#define BLE_NUS_ENABLED 0 +#define BLE_DFU_ENABLED 0 // WDT_CONFIG_RELOAD_VALUE - Reload value <15-4294967295> (ms) // Watchdog cannot be stopped even when entering bootloader, From 47b524bb1047d4dfde4c50a9dcdaca64e4700df1 Mon Sep 17 00:00:00 2001 From: Otso Jousimaa Date: Thu, 19 Apr 2018 13:21:37 +0200 Subject: [PATCH 2/9] Ignore build files --- .gitignore | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 21d642d2..4ac57a33 100644 --- a/.gitignore +++ b/.gitignore @@ -43,9 +43,10 @@ ui_*.h keys -# Build directories - +# Build directories, files _build +*.hex +*.zip # VisualGDB Makefile @@ -70,3 +71,4 @@ nRF5_SDK_12.1.0_0d23e2a.zip nRF5_SDK_12.2.* nRF5_SDK_12.3.* nRF5_SDK_13.* +nRF5_SDK_14.* From 4ad68c0efef3e30029e6b6d21bce75145d4ed859 Mon Sep 17 00:00:00 2001 From: Otso Jousimaa Date: Thu, 19 Apr 2018 13:29:07 +0200 Subject: [PATCH 3/9] Update SW revision in header --- ruuvi_examples/ruuvi_firmware/bluetooth_application_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruuvi_examples/ruuvi_firmware/bluetooth_application_config.h b/ruuvi_examples/ruuvi_firmware/bluetooth_application_config.h index a3c914aa..fe37aebd 100644 --- a/ruuvi_examples/ruuvi_firmware/bluetooth_application_config.h +++ b/ruuvi_examples/ruuvi_firmware/bluetooth_application_config.h @@ -7,7 +7,7 @@ #define APP_DEVICE_NAME_LENGTH APPLICATION_DEVICE_NAME_LENGTH #define APPLICATION_ADV_INTERVAL 1000 /**< ms **/ #define APP_TX_POWER 4 /**< dBm **/ -#define INIT_FWREV "Ruuvi 1.2.8" /**< Github tag **/ +#define INIT_FWREV "Ruuvi 1.2.10" /**< Github tag **/ #define INIT_SWREV INIT_FWREV /**< Essentially same s FWrev since there is no separate SW (i.e. Espruino) **/ From 2ac2ec4823645e1889645bc44201ef82cf2f94a8 Mon Sep 17 00:00:00 2001 From: Otso Jousimaa Date: Thu, 22 Mar 2018 23:53:52 +0700 Subject: [PATCH 4/9] Fix WDT on large reload values --- .../ruuvitag_b/s132/armgcc/Makefile | 2 +- sdk_overrides/nrf_drv_wdt.c | 176 ++++++++++++++++++ 2 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 sdk_overrides/nrf_drv_wdt.c diff --git a/ruuvi_examples/ruuvi_firmware/ruuvitag_b/s132/armgcc/Makefile b/ruuvi_examples/ruuvi_firmware/ruuvitag_b/s132/armgcc/Makefile index 375281ac..11fa95e5 100644 --- a/ruuvi_examples/ruuvi_firmware/ruuvitag_b/s132/armgcc/Makefile +++ b/ruuvi_examples/ruuvi_firmware/ruuvitag_b/s132/armgcc/Makefile @@ -39,6 +39,7 @@ SRC_FILES += \ $(PROJ_DIR)/../../libraries/ruuvi_sensor_formats/chain_channels.c \ $(PROJ_DIR)/../../libraries/ruuvi_sensor_formats/sensortag.c \ $(PROJ_DIR)/../../sdk_overrides/app_button.c \ + $(PROJ_DIR)/../../sdk_overrides/nrf_drv_wdt.c \ $(PROJ_DIR)/ble_services/application_ble_event_handlers.c \ $(PROJ_DIR)/ble_services/application_service_if.c \ $(PROJ_DIR)/ble_services/nrf_dfu_flash_buttonless.c \ @@ -75,7 +76,6 @@ SRC_FILES += \ $(SDK_ROOT)/components/drivers_nrf/saadc/nrf_drv_saadc.c \ $(SDK_ROOT)/components/drivers_nrf/hal/nrf_saadc.c \ $(SDK_ROOT)/components/drivers_nrf/gpiote/nrf_drv_gpiote.c \ - $(SDK_ROOT)/components/drivers_nrf/wdt/nrf_drv_wdt.c \ $(SDK_ROOT)/components/ble/ble_advertising/ble_advertising.c \ $(SDK_ROOT)/components/libraries/bootloader/dfu/nrf_dfu_settings.c \ $(SDK_ROOT)/components/libraries/crc16/crc16.c \ diff --git a/sdk_overrides/nrf_drv_wdt.c b/sdk_overrides/nrf_drv_wdt.c new file mode 100644 index 00000000..040cda8d --- /dev/null +++ b/sdk_overrides/nrf_drv_wdt.c @@ -0,0 +1,176 @@ +/** + * Copyright (c) 2015 - 2017, Nordic Semiconductor ASA + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(WDT) +#include "nrf_drv_wdt.h" +#include "nrf_drv_common.h" +#include "nrf_error.h" +#include "nrf_assert.h" +#include "nrf_wdt.h" +#include "app_util_platform.h" +#include +#include + +#define NRF_LOG_MODULE_NAME "WDT" + +#if WDT_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL WDT_CONFIG_LOG_LEVEL +#define NRF_LOG_INFO_COLOR WDT_CONFIG_INFO_COLOR +#define NRF_LOG_DEBUG_COLOR WDT_CONFIG_DEBUG_COLOR +#else //WDT_CONFIG_LOG_ENABLED +#define NRF_LOG_LEVEL 0 +#endif //WDT_CONFIG_LOG_ENABLED +#include "nrf_log.h" +#include "nrf_log_ctrl.h" + + +/**@brief WDT event handler. */ +static nrf_wdt_event_handler_t m_wdt_event_handler; + +/**@brief WDT state. */ +static nrf_drv_state_t m_state; + +/**@brief WDT alloc table. */ +static uint32_t m_alloc_index; + +static const nrf_drv_wdt_config_t m_default_config = NRF_DRV_WDT_DEAFULT_CONFIG; + +/**@brief WDT interrupt handler. */ +void WDT_IRQHandler(void) +{ + if (nrf_wdt_int_enable_check(NRF_WDT_INT_TIMEOUT_MASK) == true) + { + nrf_wdt_event_clear(NRF_WDT_EVENT_TIMEOUT); + m_wdt_event_handler(); + } +} + + +ret_code_t nrf_drv_wdt_init(nrf_drv_wdt_config_t const * p_config, + nrf_wdt_event_handler_t wdt_event_handler) +{ + ASSERT(wdt_event_handler != NULL); + ret_code_t err_code; + m_wdt_event_handler = wdt_event_handler; + + if (m_state == NRF_DRV_STATE_UNINITIALIZED) + { + m_state = NRF_DRV_STATE_INITIALIZED; + } + else + { + err_code = NRF_ERROR_INVALID_STATE; + NRF_LOG_WARNING("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; + } + + if (p_config == NULL) + { + p_config = &m_default_config; + } + + nrf_wdt_behaviour_set(p_config->behaviour); + + + + + + + + nrf_wdt_reload_value_set((p_config->reload_value * 32768) / 1000); + + nrf_drv_common_irq_enable(WDT_IRQn, p_config->interrupt_priority); + + err_code = NRF_SUCCESS; + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code)); + return err_code; +} + + +void nrf_drv_wdt_enable(void) +{ + ASSERT(m_alloc_index != 0); + ASSERT(m_state == NRF_DRV_STATE_INITIALIZED); + nrf_wdt_int_enable(NRF_WDT_INT_TIMEOUT_MASK); + nrf_wdt_task_trigger(NRF_WDT_TASK_START); + m_state = NRF_DRV_STATE_POWERED_ON; + NRF_LOG_INFO("Enabled.\r\n"); +} + + +void nrf_drv_wdt_feed(void) +{ + ASSERT(m_state == NRF_DRV_STATE_POWERED_ON); + for (uint32_t i = 0; i < m_alloc_index; i++) + { + nrf_wdt_reload_request_set((nrf_wdt_rr_register_t)(NRF_WDT_RR0 + i)); + } +} + +ret_code_t nrf_drv_wdt_channel_alloc(nrf_drv_wdt_channel_id * p_channel_id) +{ + ret_code_t result; + ASSERT(p_channel_id); + ASSERT(m_state == NRF_DRV_STATE_INITIALIZED); + + CRITICAL_REGION_ENTER(); + if (m_alloc_index < NRF_WDT_CHANNEL_NUMBER) + { + *p_channel_id = (nrf_drv_wdt_channel_id)(NRF_WDT_RR0 + m_alloc_index); + m_alloc_index++; + nrf_wdt_reload_request_enable(*p_channel_id); + result = NRF_SUCCESS; + } + else + { + result = NRF_ERROR_NO_MEM; + } + CRITICAL_REGION_EXIT(); + NRF_LOG_INFO("Function: %s, error code: %s.\r\n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(result)); + return result; +} + +void nrf_drv_wdt_channel_feed(nrf_drv_wdt_channel_id channel_id) +{ + ASSERT(m_state == NRF_DRV_STATE_POWERED_ON); + nrf_wdt_reload_request_set(channel_id); +} +#endif //NRF_MODULE_ENABLED(WDT) From 6b9a5a6aeeda0e1658d6045e5f6bb4f33095f9a2 Mon Sep 17 00:00:00 2001 From: Otso Jousimaa Date: Fri, 23 Mar 2018 00:10:39 +0700 Subject: [PATCH 5/9] Import overflow check from sdk14 --- sdk_overrides/nrf_drv_wdt.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sdk_overrides/nrf_drv_wdt.c b/sdk_overrides/nrf_drv_wdt.c index 040cda8d..17207e2e 100644 --- a/sdk_overrides/nrf_drv_wdt.c +++ b/sdk_overrides/nrf_drv_wdt.c @@ -109,13 +109,11 @@ ret_code_t nrf_drv_wdt_init(nrf_drv_wdt_config_t const * p_config, nrf_wdt_behaviour_set(p_config->behaviour); - - - - - - - nrf_wdt_reload_value_set((p_config->reload_value * 32768) / 1000); + if ((((uint64_t) p_config->reload_value * 32768) / 1000) > UINT32_MAX) // Check for overflow + { + return NRF_ERROR_INVALID_PARAM; + } + nrf_wdt_reload_value_set(((uint64_t) p_config->reload_value * 32768) / 1000); nrf_drv_common_irq_enable(WDT_IRQn, p_config->interrupt_priority); From 664be6f2af7046ffeb66b85824ee0c16c8797f17 Mon Sep 17 00:00:00 2001 From: Otso Jousimaa Date: Thu, 19 Apr 2018 13:34:31 +0200 Subject: [PATCH 6/9] Backport WDT fix --- ruuvi_examples/ruuvi_firmware/bluetooth_application_config.h | 2 +- ruuvi_examples/ruuvi_firmware/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ruuvi_examples/ruuvi_firmware/bluetooth_application_config.h b/ruuvi_examples/ruuvi_firmware/bluetooth_application_config.h index fe37aebd..ebe03d01 100644 --- a/ruuvi_examples/ruuvi_firmware/bluetooth_application_config.h +++ b/ruuvi_examples/ruuvi_firmware/bluetooth_application_config.h @@ -7,7 +7,7 @@ #define APP_DEVICE_NAME_LENGTH APPLICATION_DEVICE_NAME_LENGTH #define APPLICATION_ADV_INTERVAL 1000 /**< ms **/ #define APP_TX_POWER 4 /**< dBm **/ -#define INIT_FWREV "Ruuvi 1.2.10" /**< Github tag **/ +#define INIT_FWREV "Ruuvi 1.2.11" /**< Github tag **/ #define INIT_SWREV INIT_FWREV /**< Essentially same s FWrev since there is no separate SW (i.e. Espruino) **/ diff --git a/ruuvi_examples/ruuvi_firmware/main.c b/ruuvi_examples/ruuvi_firmware/main.c index c74872bb..6e253cf5 100644 --- a/ruuvi_examples/ruuvi_firmware/main.c +++ b/ruuvi_examples/ruuvi_firmware/main.c @@ -312,7 +312,7 @@ int main(void) nrf_delay_ms(10); // Init ok, start watchdog with default wdt event handler (reset). - // init_watchdog(NULL); + init_watchdog(NULL); NRF_LOG_INFO("WATCHDOG INIT \r\n"); nrf_delay_ms(10); From 583a7ab18c5a3b93ae44f04b0a1c48855dfc18bc Mon Sep 17 00:00:00 2001 From: Otso Jousimaa Date: Thu, 19 Apr 2018 15:32:29 +0200 Subject: [PATCH 7/9] Fix name on tags which have ID starting with 0 --- drivers/bluetooth/bluetooth_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bluetooth/bluetooth_core.c b/drivers/bluetooth/bluetooth_core.c index aa12e0b9..0d99c443 100644 --- a/drivers/bluetooth/bluetooth_core.c +++ b/drivers/bluetooth/bluetooth_core.c @@ -151,7 +151,7 @@ void bluetooth_name_postfix_add(char* name_base, size_t base_length) { unsigned int addr0 = NRF_FICR->DEVICEADDR[0]; char postfix[4] = { 0 }; - sprintf(postfix,"%x", addr0&0xFFFF); + sprintf(postfix,"%04x", addr0&0xFFFF); memcpy(name_base + base_length, postfix, sizeof(postfix)); } From 42d042192ff3d9d17311230d1149a14d0196ee7d Mon Sep 17 00:00:00 2001 From: Otso Jousimaa Date: Thu, 19 Apr 2018 15:34:15 +0200 Subject: [PATCH 8/9] Use fixed WDT, do not call unused DFU service --- .../eddystone/ble_services/application_ble_event_handlers.c | 3 +++ ruuvi_examples/eddystone/bluetooth_application_config.h | 2 +- ruuvi_examples/eddystone/ruuvitag_b/s132/armgcc/Makefile | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ruuvi_examples/eddystone/ble_services/application_ble_event_handlers.c b/ruuvi_examples/eddystone/ble_services/application_ble_event_handlers.c index ac18aa79..f6020f4e 100644 --- a/ruuvi_examples/eddystone/ble_services/application_ble_event_handlers.c +++ b/ruuvi_examples/eddystone/ble_services/application_ble_event_handlers.c @@ -18,8 +18,11 @@ void application_on_ble_evt(ble_evt_t * p_ble_evt) { /** Return pointer to BLE dfu service **/ + #if BLE_DFU_ENABLED ble_dfu_t* p_dfu = get_dfu(); ble_dfu_on_ble_evt(p_dfu, p_ble_evt); + #endif + nrf_ble_es_on_ble_evt(p_ble_evt); } diff --git a/ruuvi_examples/eddystone/bluetooth_application_config.h b/ruuvi_examples/eddystone/bluetooth_application_config.h index d8c234f4..5747dce2 100644 --- a/ruuvi_examples/eddystone/bluetooth_application_config.h +++ b/ruuvi_examples/eddystone/bluetooth_application_config.h @@ -8,7 +8,7 @@ #define APPLICATION_ADV_INTERVAL 500 /**< ms **/ #define APP_TX_POWER 4 /**< dBm **/ -#define INIT_FWREV "Eddystone_1.3.3" /**< Github tag **/ +#define INIT_FWREV "Eddystone 1.3.4" /**< Github tag **/ #define INIT_SWREV INIT_FWREV /**< Practicially same thing, as there is no separate SW **/ #endif \ No newline at end of file diff --git a/ruuvi_examples/eddystone/ruuvitag_b/s132/armgcc/Makefile b/ruuvi_examples/eddystone/ruuvitag_b/s132/armgcc/Makefile index 34753c02..8566f567 100644 --- a/ruuvi_examples/eddystone/ruuvitag_b/s132/armgcc/Makefile +++ b/ruuvi_examples/eddystone/ruuvitag_b/s132/armgcc/Makefile @@ -15,6 +15,7 @@ SRC_FILES += \ $(PROJ_DIR)/ble_services/application_ble_event_handlers.c \ $(PROJ_DIR)/ble_services/application_service_if.c \ $(PROJ_DIR)/../../sdk_overrides/es_battery_voltage_saadc.c \ + $(PROJ_DIR)/../../sdk_overrides/nrf_drv_wdt.c \ $(PROJ_DIR)/ble_services/nrf_dfu_flash_buttonless.c \ $(PROJ_DIR)/../../bsp/bsp.c \ $(PROJ_DIR)/../../bsp/bsp_btn_ble.c \ @@ -93,7 +94,6 @@ SRC_FILES += \ $(SDK_ROOT)/components/drivers_nrf/spi_master/nrf_drv_spi.c \ $(SDK_ROOT)/components/drivers_nrf/uart/nrf_drv_uart.c \ $(SDK_ROOT)/components/drivers_nrf/hal/nrf_saadc.c \ - $(SDK_ROOT)/components/drivers_nrf/wdt/nrf_drv_wdt.c \ $(SDK_ROOT)/components/softdevice/common/softdevice_handler/softdevice_handler.c \ $(SDK_ROOT)/components/ble/ble_advertising/ble_advertising.c \ $(SDK_ROOT)/components/ble/ble_services/ble_dfu/ble_dfu.c \ From 8ceea3e27cf4529e2d78d0034f3932e613a3701b Mon Sep 17 00:00:00 2001 From: Otso Jousimaa Date: Thu, 19 Apr 2018 15:35:27 +0200 Subject: [PATCH 9/9] Enable DFU service --- ruuvi_examples/eddystone/sdk_application_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruuvi_examples/eddystone/sdk_application_config.h b/ruuvi_examples/eddystone/sdk_application_config.h index 501f32b8..124e785c 100644 --- a/ruuvi_examples/eddystone/sdk_application_config.h +++ b/ruuvi_examples/eddystone/sdk_application_config.h @@ -27,7 +27,7 @@ #define PEER_MANAGER_ENABLED 1 #define BLE_DIS_ENABLED 1 #define BLE_NUS_ENABLED 0 -#define BLE_DFU_ENABLED 0 +#define BLE_DFU_ENABLED 1 #define FDS_OP_QUEUE_SIZE 10 #define FDS_CHUNK_QUEUE_SIZE 15