Hi @ all. I have a strange behaviour that I can't get rid of. But first some specs:
- SD130 (2.0.0)
- nrf51822
- SDK 11
- custom board
I have an application where i use a lis3dh accelerometer to realize if the product is moving. The lis3dh toggles on nrf51 pin 13 on movement. I use the nrf_drv_gpiote module to configure pin 13 to trigger a function as soon as it senses a change. For test reasons, i use the handler to turn on an led on the board.
Here is the strange thing. I can turn on and off my leds just fine. but the one indicating that movement happened does not light up. Than is start the j-link rtt Viewer and zapp, the interrupt handler for pin 13 and the LED start working magically. Also - if I quit the RTT Viewer, the system keeps working as supposed. But if restarting - the handler again does not get called until i fire up the RTT-Viewer again.
Here some Code Snippets:
// config for pin 13 (movement)
nrf_drv_gpiote_in_config_t movement_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
// handler function (should get called if something happens on pin 13
static void gpiote_event_handler (nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
// just show that function got called
FL_LEDblink_switch_BTLE_R_LED(2);
}
// initialize gpiote and pins
init(void){
uint32_t err_code;
if(!nrf_drv_gpiote_is_init())
{
err_code = nrf_drv_gpiote_init();
}
movement_config.pull = GPIO_PIN_CNF_PULL_Disabled; /*also tested pull_down, pull_up, ...*/
nrf_drv_gpiote_in_init(13, &movement_config, gpiote_event_handler);
nrf_drv_gpiote_in_event_enable(13, true);
}
While doing some power profiling, i saw that as soon as i start the RTT Viewer, power consumption goes up - ans stays up even if i quit rtt viewer.