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

nRF52840 GPIO EVENT

hi All!

I use WAKE UP event from G-SENSOR on some GPIO to wake up the MCU on motion detected.

But sometimes ( ~1% ) the event does not occur for unknown reason until RESET.

By oscilloscope, signal exist, but even doesn't sent.

the init code:

nrf_drv_gpiote_init();
nrf_drv_gpiote_in_config_t in_config = {.is_watcher = false, .hi_accuracy = false, .pull = NRF_GPIO_PIN_NOPULL, .sense = NRF_GPIOTE_POLARITY_LOTOHI};
err_code = nrf_drv_gpiote_in_init(33, &in_config, in_pin_handler);
nrf_drv_gpiote_in_event_enable(33, true);
    

any suggestion why ?

thanks.

  • Hello,

    Just to clarify:

    It happens 1% of times until RESET, so after about 100 times, the chip won't wake up anymore, or does it happen on 1% of the chips? (I assume the first)

     

    I see that you don't use any pull configuration. I also see that you trigger from LoToHi. Can you try to add: .pull = NRF_GPIO_PIN_PULLDOWN, and see if that helps?

     

    Other than might adding a pull, I can't see anything wrong with your setup. Are you sure that it is only the interrupt not working, or could it be that the entire application hangs? Can you please try to add "DEBUG"  to your preprocessor defines, and see if any of the APP_ERROR_CHECK(err_code); receives an err_code != NRF_SUCCESS? 
    Depending on the SDK version that you use, it depends a bit where to set the breakpoint. Just try to add:

    APP_ERROR_CHECK(1);

    somewhere in your main() function, and see where it stops.

     

    Best regards,

    Edvin

  • Hi Edvin.

    I find the reason but not solution.

    I use two PIN's for separate GPIOE events.

    So, the problem is , if one of the PIN is in Active state , another PIN is blind to the event, so the event will lost.

    HOW to solve this issue ? I mean how to provide catch events separatelly even one of the PIN is in hold (active) state ?

    thanks!

  • Hi all,

    I changed .sense = NRF_GPIOTE_POLARITY_TOGGLE , in this case EVENTS does 'nt lost all works ok.

    dont know why (will check then in driver sources) , but possible solution.

    thanks

Related