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

app_button & Freertos

Hi,

I've been trying to get the button events from the nrf52832 where FreeRTOS is enabled.

https://gist.github.com/gpgabriel/f070e39f335da8579e9a577b44109237

The 2 function are from `ble_app_blinky` example. When I call `buttons_init` in main, I get:

<error> app: ERROR 8 [NRF_ERROR_INVALID_STATE] at ..//main.c:813

I spent a few hours trying to debug this and I think I found out why I get this but I'm not sure how to solve it.

`app_button_init` will call `app_timer_create` from `app_timer_freertos.c` which checks `pinfo->osHandle` and as it won't be NULL, it returns `NRF_ERROR_INVALID_STATE`.

I think `pinfo->osHandle` won't be null because in `app_button.c`, the same `m_detection_delay_timer_id` is also used in `gpiote_event_handler`.

I'm using nrf52 SDK 14.2. It works fine without FreeRTOS.


I'm not sure if I'm right with my explanation, maybe I'm missing something.

Gabriel

EDIT: I was wrong, the problem is that the osHandle is not empty (not sure why), it doesn't have to do with `m_detection_delay_timer_id`

EDIT2: I'm really confused on how the APP_TIMER_DEF(timer_id) variable can be casted to a 'app_timer_info_t *'

Parents Reply Children
No Data
Related