This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

button handler interrupt - nrf52840 dongle

Hello,

I guess it is a simple problem, but I am new to the nrf world, so here is my issue: 

 

#include <stdint.h>
#include <string.h>
#include "nordic_common.h"
#include "boards.h"
#include "pca10059.h"
#include "app_timer.h"
#include "app_button.h"
#include "app_scheduler.h"

static void button_handler(uint8_t pin, uint8_t action)
{
    if (pin == BSP_BUTTON_0){
        if (action == APP_BUTTON_PUSH){
            bsp_board_led_on(BSP_BOARD_LED_0);
        } else if (action == APP_BUTTON_RELEASE){
            bsp_board_led_off(BSP_BOARD_LED_0);
        }
    }
}

/**@brief Function for application main entry.
 */
int main()
{
    bsp_board_init(BSP_INIT_LEDS);
    app_timer_init();
    //The array must be static because a pointer to it will be saved in the button handler module.
    static app_button_cfg_t buttons[] =
    {
        {BSP_BUTTON_0, false, BUTTON_PULL, button_handler}
    };
    app_button_init(buttons, ARRAY_SIZE(buttons), APP_TIMER_TICKS(50));
    app_button_enable();
}
/**
 * @}
 */

I want to use this code to switch on a LED by pressing the on board button (BSP_BUTTON_0) on my nrf dongle. But when I run it and press the button, no interrupt is fired and nothing happens. But if I add a softdevice and add 

nrf_sdh_enable_request();

to my main, it works perfectly. So, is there a way to get this code running without any softdevice? And why is it just working with it?

Thanks

Maboo

Ps: I am using SDK17 on Linux, VS Code

Parents Reply Children
  • Thanks for your quick response. 

    That is all the code I use, I striped the ble_app_blinky example, deleted all sdh includes and tested it as it is.

    Switching on a LED in my main works, but not in button_handler. Can it have something to do with my makefile or sdk_config.h, do i have to enable or disable something? 

    makefile:

    PROJECT_NAME     := ble_app_blinky_pca10059_s140
    TARGETS          := nrf52840_xxaa
    OUTPUT_DIRECTORY := _build
    
    SDK_ROOT := ...secret
    PROJ_DIR := ...secret
    
    $(OUTPUT_DIRECTORY)/nrf52840_xxaa.out: \
      LINKER_SCRIPT  := ble_app_blinky_gcc_nrf52.ld
    
    # Source files common to all targets
    SRC_FILES += \
      $(SDK_ROOT)/modules/nrfx/mdk/gcc_startup_nrf52840.S \
      $(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_rtt.c \
      $(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_serial.c \
      $(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_uart.c \
      $(SDK_ROOT)/components/libraries/log/src/nrf_log_default_backends.c \
      $(SDK_ROOT)/components/libraries/log/src/nrf_log_frontend.c \
      $(SDK_ROOT)/components/libraries/log/src/nrf_log_str_formatter.c \
      $(SDK_ROOT)/components/libraries/button/app_button.c \
      $(SDK_ROOT)/components/libraries/util/app_error.c \
      $(SDK_ROOT)/components/libraries/util/app_error_handler_gcc.c \
      $(SDK_ROOT)/components/libraries/util/app_error_weak.c \
      $(SDK_ROOT)/components/libraries/scheduler/app_scheduler.c \
      $(SDK_ROOT)/components/libraries/timer/app_timer2.c \
      $(SDK_ROOT)/components/libraries/util/app_util_platform.c \
      $(SDK_ROOT)/components/libraries/timer/drv_rtc.c \
      $(SDK_ROOT)/components/libraries/hardfault/hardfault_implementation.c \
      $(SDK_ROOT)/components/libraries/util/nrf_assert.c \
      $(SDK_ROOT)/components/libraries/atomic_fifo/nrf_atfifo.c \
      $(SDK_ROOT)/components/libraries/atomic_flags/nrf_atflags.c \
      $(SDK_ROOT)/components/libraries/atomic/nrf_atomic.c \
      $(SDK_ROOT)/components/libraries/balloc/nrf_balloc.c \
      $(SDK_ROOT)/external/fprintf/nrf_fprintf.c \
      $(SDK_ROOT)/external/fprintf/nrf_fprintf_format.c \
      $(SDK_ROOT)/components/libraries/memobj/nrf_memobj.c \
      $(SDK_ROOT)/components/libraries/pwr_mgmt/nrf_pwr_mgmt.c \
      $(SDK_ROOT)/components/libraries/ringbuf/nrf_ringbuf.c \
      $(SDK_ROOT)/components/libraries/experimental_section_vars/nrf_section_iter.c \
      $(SDK_ROOT)/components/libraries/sortlist/nrf_sortlist.c \
      $(SDK_ROOT)/components/libraries/strerror/nrf_strerror.c \
      $(SDK_ROOT)/modules/nrfx/mdk/system_nrf52840.c \
      $(SDK_ROOT)/components/boards/boards.c \
      $(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_clock.c \
      $(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_uart.c \
      $(SDK_ROOT)/modules/nrfx/soc/nrfx_atomic.c \
      $(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_clock.c \
      $(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_gpiote.c \
      $(SDK_ROOT)/modules/nrfx/drivers/src/prs/nrfx_prs.c \
      $(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uart.c \
      $(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uarte.c \
      $(PROJ_DIR)/main.c \
      $(SDK_ROOT)/external/utf_converter/utf.c \
    
    
    # Include folders common to all targets
    INC_FOLDERS += \
      $(SDK_ROOT)/components/nfc/ndef/generic/message \
      $(SDK_ROOT)/components/nfc/t2t_lib \
      $(SDK_ROOT)/components/nfc/t4t_parser/hl_detection_procedure \
      $(SDK_ROOT)/components/libraries/pwm \
      $(SDK_ROOT)/components/libraries/usbd/class/cdc/acm \
      $(SDK_ROOT)/components/libraries/usbd/class/hid/generic \
      $(SDK_ROOT)/components/libraries/usbd/class/msc \
      $(SDK_ROOT)/components/libraries/usbd/class/hid \
      $(SDK_ROOT)/modules/nrfx/hal \
      $(SDK_ROOT)/components/nfc/ndef/conn_hand_parser/le_oob_rec_parser \
      $(SDK_ROOT)/components/libraries/log \
      $(SDK_ROOT)/components/ble/ble_services/ble_gls \
      $(SDK_ROOT)/components/libraries/fstorage \
      $(SDK_ROOT)/components/nfc/ndef/text \
      $(SDK_ROOT)/components/libraries/mutex \
      $(SDK_ROOT)/components/libraries/gpiote \
      $(SDK_ROOT)/components/libraries/bootloader/ble_dfu \
      $(SDK_ROOT)/components/nfc/ndef/connection_handover/common \
      $(SDK_ROOT)/components/boards \
      $(SDK_ROOT)/components/nfc/ndef/generic/record \
      $(SDK_ROOT)/components/nfc/t4t_parser/cc_file \
      $(SDK_ROOT)/components/ble/ble_advertising \
      $(SDK_ROOT)/external/utf_converter \
      $(SDK_ROOT)/components/ble/ble_services/ble_bas_c \
      $(SDK_ROOT)/modules/nrfx/drivers/include \
      $(SDK_ROOT)/components/libraries/experimental_task_manager \
      $(SDK_ROOT)/components/ble/ble_services/ble_hrs_c \
      $(SDK_ROOT)/components/softdevice/s140/headers/nrf52 \
      $(SDK_ROOT)/components/nfc/ndef/connection_handover/le_oob_rec \
      $(SDK_ROOT)/components/libraries/queue \
      $(SDK_ROOT)/components/libraries/pwr_mgmt \
      $(SDK_ROOT)/components/ble/ble_dtm \
      $(SDK_ROOT)/components/toolchain/cmsis/include \
      $(SDK_ROOT)/components/ble/ble_services/ble_rscs_c \
      $(SDK_ROOT)/components/ble/common \
      $(SDK_ROOT)/components/ble/ble_services/ble_lls \
      $(SDK_ROOT)/components/nfc/platform \
      $(SDK_ROOT)/components/nfc/ndef/connection_handover/ac_rec \
      $(SDK_ROOT)/components/ble/ble_services/ble_bas \
      $(SDK_ROOT)/components/libraries/mpu \
      $(SDK_ROOT)/components/libraries/experimental_section_vars \
      $(SDK_ROOT)/components/ble/ble_services/ble_ans_c \
      $(SDK_ROOT)/components/libraries/slip \
      $(SDK_ROOT)/components/libraries/delay \
      $(SDK_ROOT)/components/libraries/csense_drv \
      $(SDK_ROOT)/components/libraries/memobj \
      $(SDK_ROOT)/components/ble/ble_services/ble_nus_c \
      $(SDK_ROOT)/components/softdevice/common \
      $(SDK_ROOT)/components/ble/ble_services/ble_ias \
      $(SDK_ROOT)/components/libraries/usbd/class/hid/mouse \
      $(SDK_ROOT)/components/libraries/low_power_pwm \
      $(SDK_ROOT)/components/nfc/ndef/conn_hand_parser/ble_oob_advdata_parser \
      $(SDK_ROOT)/components/ble/ble_services/ble_dfu \
      $(SDK_ROOT)/external/fprintf \
      $(SDK_ROOT)/components/libraries/svc \
      $(SDK_ROOT)/components/libraries/atomic \
      $(SDK_ROOT)/components \
      $(SDK_ROOT)/components/libraries/scheduler \
      $(SDK_ROOT)/components/libraries/cli \
      $(SDK_ROOT)/components/ble/ble_services/ble_lbs \
      $(SDK_ROOT)/components/ble/ble_services/ble_hts \
      $(SDK_ROOT)/components/libraries/crc16 \
      $(SDK_ROOT)/components/nfc/t4t_parser/apdu \
      $(SDK_ROOT)/components/libraries/util \
      ../config \
      $(SDK_ROOT)/components/libraries/usbd/class/cdc \
      $(SDK_ROOT)/components/libraries/csense \
      $(SDK_ROOT)/components/libraries/balloc \
      $(SDK_ROOT)/components/libraries/ecc \
      $(SDK_ROOT)/components/libraries/hardfault \
      $(SDK_ROOT)/components/ble/ble_services/ble_cscs \
      $(SDK_ROOT)/components/libraries/hci \
      $(SDK_ROOT)/components/libraries/timer \
      $(SDK_ROOT)/components/softdevice/s140/headers \
      $(SDK_ROOT)/integration/nrfx \
      $(SDK_ROOT)/components/nfc/t4t_parser/tlv \
      $(SDK_ROOT)/components/libraries/sortlist \
      $(SDK_ROOT)/components/libraries/spi_mngr \
      $(SDK_ROOT)/components/libraries/led_softblink \
      $(SDK_ROOT)/components/nfc/ndef/conn_hand_parser \
      $(SDK_ROOT)/components/libraries/sdcard \
      $(SDK_ROOT)/components/nfc/ndef/parser/record \
      $(SDK_ROOT)/modules/nrfx/mdk \
      $(SDK_ROOT)/components/ble/ble_services/ble_cts_c \
      $(SDK_ROOT)/components/ble/ble_services/ble_nus \
      $(SDK_ROOT)/components/libraries/twi_mngr \
      $(SDK_ROOT)/components/ble/ble_services/ble_hids \
      $(SDK_ROOT)/components/libraries/strerror \
      $(SDK_ROOT)/components/libraries/crc32 \
      $(SDK_ROOT)/components/nfc/ndef/connection_handover/ble_oob_advdata \
      $(SDK_ROOT)/components/nfc/t2t_parser \
      $(SDK_ROOT)/components/nfc/ndef/connection_handover/ble_pair_msg \
      $(SDK_ROOT)/components/libraries/usbd/class/audio \
      $(SDK_ROOT)/components/nfc/t4t_lib \
      $(SDK_ROOT)/components/ble/peer_manager \
      $(SDK_ROOT)/components/libraries/mem_manager \
      $(SDK_ROOT)/components/libraries/ringbuf \
      $(SDK_ROOT)/components/ble/ble_services/ble_tps \
      $(SDK_ROOT)/components/nfc/ndef/parser/message \
      $(SDK_ROOT)/components/ble/ble_services/ble_dis \
      $(SDK_ROOT)/components/nfc/ndef/uri \
      $(SDK_ROOT)/components/ble/nrf_ble_gatt \
      $(SDK_ROOT)/components/ble/nrf_ble_qwr \
      $(SDK_ROOT)/components/libraries/gfx \
      $(SDK_ROOT)/components/libraries/button \
      $(SDK_ROOT)/modules/nrfx \
      $(SDK_ROOT)/components/libraries/twi_sensor \
      $(SDK_ROOT)/integration/nrfx/legacy \
      $(SDK_ROOT)/components/libraries/usbd/class/hid/kbd \
      $(SDK_ROOT)/components/nfc/ndef/connection_handover/ep_oob_rec \
      $(SDK_ROOT)/external/segger_rtt \
      $(SDK_ROOT)/components/libraries/atomic_fifo \
      $(SDK_ROOT)/components/ble/ble_services/ble_lbs_c \
      $(SDK_ROOT)/components/nfc/ndef/connection_handover/ble_pair_lib \
      $(SDK_ROOT)/components/libraries/crypto \
      $(SDK_ROOT)/components/ble/ble_racp \
      $(SDK_ROOT)/components/libraries/fds \
      $(SDK_ROOT)/components/nfc/ndef/launchapp \
      $(SDK_ROOT)/components/libraries/atomic_flags \
      $(SDK_ROOT)/components/ble/ble_services/ble_hrs \
      $(SDK_ROOT)/components/ble/ble_services/ble_rscs \
      $(SDK_ROOT)/components/nfc/ndef/connection_handover/hs_rec \
      $(SDK_ROOT)/components/libraries/usbd \
      $(SDK_ROOT)/components/nfc/ndef/conn_hand_parser/ac_rec_parser \
      $(SDK_ROOT)/components/libraries/stack_guard \
      $(SDK_ROOT)/components/libraries/log/src \
    
    # Libraries common to all targets
    LIB_FILES += \
    
    # Optimization flags
    OPT = -O3 -g3
    # Uncomment the line below to enable link time optimization
    #OPT += -flto
    
    # C flags common to all targets
    CFLAGS += $(OPT)
    CFLAGS += -DAPP_TIMER_V2
    CFLAGS += -DAPP_TIMER_V2_RTC1_ENABLED
    CFLAGS += -DBSP_DEFINES_ONLY
    CFLAGS += -DBOARD_PCA10059
    CFLAGS += -DCONFIG_GPIO_AS_PINRESET
    CFLAGS += -DFLOAT_ABI_HARD
    CFLAGS += -DMBR_PRESENT
    CFLAGS += -DDEBUG
    CFLAGS += -DDEBUG_NRF
    CFLAGS += -DNRF52840_XXAA
    CFLAGS += -DNRF_SD_BLE_API_VERSION=7
    CFLAGS += -mcpu=cortex-m4
    CFLAGS += -mthumb -mabi=aapcs
    # CFLAGS += -Wall -Werror
    CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
    # keep every function in a separate section, this allows linker to discard unused ones
    CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
    CFLAGS += -fno-builtin -fshort-enums
    
    # C++ flags common to all targets
    CXXFLAGS += $(OPT)
    # Assembler flags common to all targets
    ASMFLAGS += -g3
    ASMFLAGS += -mcpu=cortex-m4
    ASMFLAGS += -mthumb -mabi=aapcs
    ASMFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
    ASMFLAGS += -DAPP_TIMER_V2
    ASMFLAGS += -DAPP_TIMER_V2_RTC1_ENABLED
    ASMFLAGS += -DBSP_DEFINES_ONLY
    ASMFLAGS += -DDEBUG_NRF
    ASMFLAGS += -DDEBUG
    ASMFLAGS += -DMBR_PRESENT
    ASMFLAGS += -DBOARD_PCA10059
    ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET
    ASMFLAGS += -DFLOAT_ABI_HARD
    ASMFLAGS += -DNRF52840_XXAA
    
    # Linker flags
    LDFLAGS += $(OPT)
    LDFLAGS += -mthumb -mabi=aapcs -L$(SDK_ROOT)/modules/nrfx/mdk -T$(LINKER_SCRIPT)
    LDFLAGS += -mcpu=cortex-m4
    LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
    # let linker dump unused sections
    LDFLAGS += -Wl,--gc-sections
    # use newlib in nano version
    LDFLAGS += --specs=nano.specs
    
    nrf52840_xxaa: CFLAGS += -D__HEAP_SIZE=8192
    nrf52840_xxaa: CFLAGS += -D__STACK_SIZE=8192
    nrf52840_xxaa: ASMFLAGS += -D__HEAP_SIZE=8192
    nrf52840_xxaa: ASMFLAGS += -D__STACK_SIZE=8192
    
    # Add standard libraries at the very end of the linker input, after all objects
    # that may need symbols provided by these libraries.
    LIB_FILES += -lc -lnosys -lm -lstdc++
    
    
    .PHONY: default help
    
    # Default target - first one defined
    default: nrf52840_xxaa
    
    # Print all targets that can be built
    help:
    	@echo following targets are available:
    	@echo		nrf52840_xxaa
    	@echo		flash_softdevice
    	@echo		sdk_config - starting external tool for editing sdk_config.h
    	@echo		flash      - flashing binary
    
    TEMPLATE_PATH := $(SDK_ROOT)/components/toolchain/gcc
    
    
    include $(TEMPLATE_PATH)/Makefile.common
    
    $(foreach target, $(TARGETS), $(call define_target, $(target)))
    
    .PHONY: flash flash_softdevice erase
    
    # Flash the program
    flash: default
    	@echo Flashing: $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex
    	nrfjprog -f nrf52 --program $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex --sectorerase
    	nrfjprog -f nrf52 --reset
    
    # Flash softdevice
    flash_softdevice:
    	@echo Flashing: s140_nrf52_7.0.1_softdevice.hex
    	nrfjprog -f nrf52 --program $(SDK_ROOT)/components/softdevice/s140/hex/s140_nrf52_7.0.1_softdevice.hex --sectorerase
    	nrfjprog -f nrf52 --reset
    
    erase:
    	nrfjprog -f nrf52 --eraseall
    
    SDK_CONFIG_FILE := ../config/sdk_config.h
    CMSIS_CONFIG_TOOL := $(SDK_ROOT)/external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar
    sdk_config:
    	java -jar $(CMSIS_CONFIG_TOOL) $(SDK_CONFIG_FILE)

    part of sdk_config:

    / <h> app_button - buttons handling module
    
    //==========================================================
    // <q> BUTTON_ENABLED  - Enables Button module
     
    
    #ifndef BUTTON_ENABLED
    #define BUTTON_ENABLED 1
    #endif
    
    // <q> BUTTON_HIGH_ACCURACY_ENABLED  - Enables GPIOTE high accuracy for buttons
     
    
    #ifndef BUTTON_HIGH_ACCURACY_ENABLED
    #define BUTTON_HIGH_ACCURACY_ENABLED 0
    #endif
    
    //==========================================================
    
    // <h> nrf_log in nRF_Libraries 
    
    //==========================================================
    // <e> APP_BUTTON_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef APP_BUTTON_CONFIG_LOG_ENABLED
    #define APP_BUTTON_CONFIG_LOG_ENABLED 0
    #endif
    // <o> APP_BUTTON_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef APP_BUTTON_CONFIG_LOG_LEVEL
    #define APP_BUTTON_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> APP_BUTTON_CONFIG_INITIAL_LOG_LEVEL  - Initial severity level if dynamic filtering is enabled.
     
    
    // <i> If module generates a lot of logs, initial log level can
    // <i> be decreased to prevent flooding. Severity level can be
    // <i> increased on instance basis.
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef APP_BUTTON_CONFIG_INITIAL_LOG_LEVEL
    #define APP_BUTTON_CONFIG_INITIAL_LOG_LEVEL 3
    #endif
    
    // <o> APP_BUTTON_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef APP_BUTTON_CONFIG_INFO_COLOR
    #define APP_BUTTON_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> APP_BUTTON_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef APP_BUTTON_CONFIG_DEBUG_COLOR
    #define APP_BUTTON_CONFIG_DEBUG_COLOR 0
    #endif
    
    // </e>
    
    // <e> APP_TIMER_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef APP_TIMER_CONFIG_LOG_ENABLED
    #define APP_TIMER_CONFIG_LOG_ENABLED 0
    #endif
    // <o> APP_TIMER_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef APP_TIMER_CONFIG_LOG_LEVEL
    #define APP_TIMER_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> APP_TIMER_CONFIG_INITIAL_LOG_LEVEL  - Initial severity level if dynamic filtering is enabled.
     
    
    // <i> If module generates a lot of logs, initial log level can
    // <i> be decreased to prevent flooding. Severity level can be
    // <i> increased on instance basis.
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef APP_TIMER_CONFIG_INITIAL_LOG_LEVEL
    #define APP_TIMER_CONFIG_INITIAL_LOG_LEVEL 3
    #endif
    
    // <o> APP_TIMER_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef APP_TIMER_CONFIG_INFO_COLOR
    #define APP_TIMER_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> APP_TIMER_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef APP_TIMER_CONFIG_DEBUG_COLOR
    #define APP_TIMER_CONFIG_DEBUG_COLOR 0
    #endif
    
    
    // </e>
    
    // <e> APP_TIMER_ENABLED - app_timer - Application timer functionality
    //==========================================================
    #ifndef APP_TIMER_ENABLED
    #define APP_TIMER_ENABLED 1
    #endif
    // <o> APP_TIMER_CONFIG_RTC_FREQUENCY  - Configure RTC prescaler.
     
    // <0=> 32768 Hz 
    // <1=> 16384 Hz 
    // <3=> 8192 Hz 
    // <7=> 4096 Hz 
    // <15=> 2048 Hz 
    // <31=> 1024 Hz 
    
    #ifndef APP_TIMER_CONFIG_RTC_FREQUENCY
    #define APP_TIMER_CONFIG_RTC_FREQUENCY 1
    #endif
    
    // <o> APP_TIMER_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    
    // <i> Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef APP_TIMER_CONFIG_IRQ_PRIORITY
    #define APP_TIMER_CONFIG_IRQ_PRIORITY 6
    #endif
    
    // <o> APP_TIMER_CONFIG_OP_QUEUE_SIZE - Capacity of timer requests queue. 
    // <i> Size of the queue depends on how many timers are used
    // <i> in the system, how often timers are started and overall
    // <i> system latency. If queue size is too small app_timer calls
    // <i> will fail.
    
    #ifndef APP_TIMER_CONFIG_OP_QUEUE_SIZE
    #define APP_TIMER_CONFIG_OP_QUEUE_SIZE 10
    #endif
    
    // <q> APP_TIMER_CONFIG_USE_SCHEDULER  - Enable scheduling app_timer events to app_scheduler
     
    
    #ifndef APP_TIMER_CONFIG_USE_SCHEDULER
    #define APP_TIMER_CONFIG_USE_SCHEDULER 0
    #endif
    
    // <q> APP_TIMER_KEEPS_RTC_ACTIVE  - Enable RTC always on
     
    
    // <i> If option is enabled RTC is kept running even if there is no active timers.
    // <i> This option can be used when app_timer is used for timestamping.
    
    #ifndef APP_TIMER_KEEPS_RTC_ACTIVE
    #define APP_TIMER_KEEPS_RTC_ACTIVE 0
    #endif
    
    // <o> APP_TIMER_SAFE_WINDOW_MS - Maximum possible latency (in milliseconds) of handling app_timer event. 
    // <i> Maximum possible timeout that can be set is reduced by safe window.
    // <i> Example: RTC frequency 16384 Hz, maximum possible timeout 1024 seconds - APP_TIMER_SAFE_WINDOW_MS.
    // <i> Since RTC is not stopped when processor is halted in debugging session, this value
    // <i> must cover it if debugging is needed. It is possible to halt processor for APP_TIMER_SAFE_WINDOW_MS
    // <i> without corrupting app_timer behavior.
    
    #ifndef APP_TIMER_SAFE_WINDOW_MS
    #define APP_TIMER_SAFE_WINDOW_MS 300000
    #endif
    
    // <h> App Timer Legacy configuration - Legacy configuration.
    
    //==========================================================
    // <q> APP_TIMER_WITH_PROFILER  - Enable app_timer profiling
     
    
    #ifndef APP_TIMER_WITH_PROFILER
    #define APP_TIMER_WITH_PROFILER 0
    #endif
    
    // <q> APP_TIMER_CONFIG_SWI_NUMBER  - Configure SWI instance used.
     
    
    #ifndef APP_TIMER_CONFIG_SWI_NUMBER
    #define APP_TIMER_CONFIG_SWI_NUMBER 0
    #endif
    
    // </e>

  • I striped the ble_app_blinky example

    you must have missed something.

    I don't think it's worth the effort trying to pursue it - just start from an example that is designed to work without the SoftDevice!

    Are you programming the device via the bootloader? I'm not sure if that has any dependencies on the SD ...

    Again, a DK would make this all so much easier.

  • Are you programming the device via the bootloader?

    I use nrf connect programmer, if thats what you mean? Ok, you convinced me, I own a DK so I going to test it there first. Could you explain why would it make this all much easier? I mean, yes it can debug but in the end I want to use this program on my nrf dongle. 

  • ...and can you please recommend an example to start with?

  • the main thing is that you get the debugger, and most of the examples are focussed on the DK

    you also get more LEDs and buttons, and breakouts of all the chip's pins

Related