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

Can't get button presses to work on nRF52840 DK

I have looked at other reports on this issue the most thorough one being 

https://devzone.nordicsemi.com/f/nordic-q-a/65624/nrf52840-dk-implementing-board-button-event-handler-but-no-response-on-button-press

(There is probably a better way of referencing the issue but I don't know how to do it.)

I have done everything stated in that report (but I am not trying to do UART logging). The funny thing is, I have several other projects following a similar scenario and the button presses DO work when run on the same DK. THis is a SES project using SoftDevice for Ble and flash writes.

So there must be something stupid that I am missing but after a couple of days I am still at a loss.

In main I have 

timers_init();
leds_init();
buttons_init();

and in the sdk_config.h I have 

#define BUTTON_ENABLED 1

The first line of the timers_init() file has the same 

ret_code_t err_code = app_timer_init();
APP_ERROR_CHECK(err_code);

plus additional timers I have defined. It is the same as the other projects I have where the buttons do work.

Is there something in the SES options that I am missing?

Parents
  • Hi,

    Are you using the BSP library? What pins are you using? Could you share a minimal example that reproduces the issue on the development kit?

    regards

    Jared

  • DK_ButtonsDontWork.zip

    I am working on it. I had a major bug in my flash writes that got exposed and it took me a decade to find (just missed an * for a pointer to a pointer...ARRG!) so with that fixed I will be able to simply give you this project - there are two issues that are related here - I cannot get the buttons to work on the DK (everything else does) and when I run on the actual dongle, the call NVIC_SystemReset(); does not work. (I have already made an issue with that but it has not been resolved). On the DK the call works fine - the app restarts. On the dongle it doesn't. Doing some cleanup and further testing to make sure a side effect of the write is not the cause.

    I have attached the project. You can drop it into the /examples/ folder of the nRF5_SDK_17.0.2_d674dde SDK.

    The parameter that decides whether the DK is used is USE_DK == 1. It is now set to one and does not work because you need to press button 3 on the DK to start advertising. But no button press works. I have a default case where a message is printed should anything trigger the button event handler. Nothing does.

Reply
  • DK_ButtonsDontWork.zip

    I am working on it. I had a major bug in my flash writes that got exposed and it took me a decade to find (just missed an * for a pointer to a pointer...ARRG!) so with that fixed I will be able to simply give you this project - there are two issues that are related here - I cannot get the buttons to work on the DK (everything else does) and when I run on the actual dongle, the call NVIC_SystemReset(); does not work. (I have already made an issue with that but it has not been resolved). On the DK the call works fine - the app restarts. On the dongle it doesn't. Doing some cleanup and further testing to make sure a side effect of the write is not the cause.

    I have attached the project. You can drop it into the /examples/ folder of the nRF5_SDK_17.0.2_d674dde SDK.

    The parameter that decides whether the DK is used is USE_DK == 1. It is now set to one and does not work because you need to press button 3 on the DK to start advertising. But no button press works. I have a default case where a message is printed should anything trigger the button event handler. Nothing does.

Children
Related