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

button_event_handler not working properly?

  • Custom Board which has NordicSemi nRF51822-QFAA (QFAAH0, Rev. 3) MCU,

The board follows the internal LDO setup.

(Ref. nRF51822_PS v3.1 Section 11.3.1)

I added LED and button initializing codes.

  • IAR for ARM 7.1

  • Testing with iPhone 5S, 6 and iPad air (iOS 8.3)

    / Nexus 5 and Galaxy Note 3 (Android 4.4.2).

  • Using J-Link Debugger

/****************************************************/

The scheduler, timers, and BLE settings are all fine.

My problem is that the button init doesn't work properly.

buttons

I modified the code in order to divide into files. I don't use the bsp functions.

before

It seems okay at here. However, after calling any functions,

(in this example, after calling timers_start) the mp_buttons become corrupted.

(calling leds_ok didn't changed mp_buttons.)

after

So, when I press the button,

it does call detection_delay_timeout_handler in app_button.c

However, it doesn't jumps to the button_event_handler.

call

Other parts works well. (The timer interrupts, hrs handling, beacon advertising, and etc.)

What could be the reason for the mp_buttons to become corrupted?

What settings did I missed?

The compiler optimization level is "low".

Also, I use the scheduler.

I also tried the bsp_init. Although the event handler function pointer was set to null

err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS,
                    APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),
                    NULL);

in this case, the values of mp_buttons didn't change when the program counter changes.

Plus, when a button is pressed, the program jumps to bsp_button_event_handler.

static void bsp_button_event_handler(uint8_t pin_no, uint8_t button_action)

(Although, it doesn't call any functions since the parameter was NULL)

When the program counter comes here, the values of mp_buttons were valid as I configured.

-Regards

Related