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

GPIOTE interrupt count

Hi

I am using nRF51822 (pca10001).I am unable to discover my device. I used the ble_app_template_s130_pca10028 as my base and added the code for gpiote handler as following.

static void gpiote_event_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{

    int32_t count = 0;
    count = nrf_drv_gpiote_in_is_set(INPUT_PIN);
    
	our_characteristic_update(&m_our_service, &count);
}

int main(void)
{   

    uint32_t err_code;
    bool erase_bonds;
    
    nrf_drv_gpiote_init();
    nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_LOTOHI(true);

    err_code = nrf_drv_gpiote_in_init(INPUT_PIN, &config, gpiote_event_handler);
    
    nrf_drv_gpiote_in_event_enable(INPUT_PIN, true);

I suppose i made mistake in the handler.

Does changing:

nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_LOTOHI(true);

to

nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_LOTOHI(false);

resolve my problem

I am in need of urgent help

Thank you

Parents
  • Hi, on my nRF51822 I use this configuration:

    nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false); 
    in_config.pull = NRF_GPIO_PIN_NOPULL;
    in_config. sense = NRF_GPIO_PIN_SENSE_LOW;
    

    Then in gpiote_event_handler I catch the action NRF_GPIOTE_POLARITY_TOGGLE and check with nrf_drv_gpiote_in_is_set(pin) whether we have a low to high or high to low pin event.

    if (action == NRF_GPIOTE_POLARITY_TOGGLE) {
    		if (!nrf_drv_gpiote_in_is_set(pin)) {
    			// high to low pin event
    		} else {
    			// low to high pin event
    		}
    

    }

    I avoid using GPIOTE_CONFIG_IN_SENSE_LOTOHI(true) . Because of a bug in this NRF51822 revision, individual pin interrupts (true) uses HF and 1mA current!

    HTH Johannes

  • Hi Roger Clark. Thank you so much. Since I am new to BLE I would like to ask you some help for my project. I am trying to capture the changes in PIN28 and transfer the count(number of changes) to another nRF51822, with which I communicate with my android phone. I've identified the softdevices to be used from this link link text

    I would be happy if you could help me with program flow (if possible some important code snippets since i have my project deadline on 1st march)

    Thanks a lot in advance.

Reply
  • Hi Roger Clark. Thank you so much. Since I am new to BLE I would like to ask you some help for my project. I am trying to capture the changes in PIN28 and transfer the count(number of changes) to another nRF51822, with which I communicate with my android phone. I've identified the softdevices to be used from this link link text

    I would be happy if you could help me with program flow (if possible some important code snippets since i have my project deadline on 1st march)

    Thanks a lot in advance.

Children
No Data
Related