I am trying to port some code from the nrf52840dk (PCA10056) to the dongle (PCA10059) and everything seems to work fine until an interrupt is triggered. All serial output stops but a hard reset from the watchdog doesn't get triggered. Any help is appreciated!
I want to know why the following can run on the DK but not the Dongle and hopefully how to solve this issue. I simplified the code for debugging to init 2 interrupt pins which callback a printf/LED something to show me its acknowledged. My code is the following;
#include "contiki.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "nrfx_gpiote.h"
#include "app_error.h"
#define INT_PIR_L NRF_GPIO_PIN_MAP(0,20)
#define INT_PIR_R NRF_GPIO_PIN_MAP(0,17)
PROCESS(env_test_process, "ENV_TEST");
AUTOSTART_PROCESSES(&env_test_process);
/*---------------------------------------------------------------------------*//*!
* @brief Event Handler for when the right PIR sensor is triggered
*
* @param pin pin number the event was triggered
* @param action the type of value change that occurred (e.g. rising edge)
*
*/
static void pir_right_int_callback(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
printf("[PIR]: RIGHT callback triggered \n");
}
/*!
* @brief Event Handler for when the left PIR sensor is triggered
*
* @param pin pin number the event was triggered
* @param action the type of value change that occurred (e.g. rising edge)
*
*/
static void pir_left_int_callback(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
printf("[PIR]: LEFT callback triggered \n");
}
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(env_test_process, ev, data)
{
PROCESS_BEGIN();
nrfx_err_t err_code;
/* Set up Interrupt */
nrfx_gpiote_in_config_t gpio_config = NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI(true);
gpio_config.pull = NRF_GPIO_PIN_PULLDOWN;
err_code = nrfx_gpiote_in_init(INT_PIR_R, &gpio_config, pir_right_int_callback);
APP_ERROR_CHECK(err_code);
err_code = nrfx_gpiote_in_init(INT_PIR_L, &gpio_config, pir_left_int_callback);
APP_ERROR_CHECK(err_code);
nrfx_gpiote_in_event_enable(INT_PIR_R, true);
nrfx_gpiote_in_event_enable(INT_PIR_L, true);
while(1)
{
}
PROCESS_END();
}
BOARD: NRF52840 Dongle (PCA10059)
OS: Contiki-NG
SDK version: 17.0.2
EDIT: I have tried replacing printf with an LED toggle but nothing is different.