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

nrf51822 gpiote could not enter interrupt routine

Hello I am using SDK12.3 without softdevice on a custom board (with nrf51822 256k flash, 16kram without 32768 crystal).

I have written some code using GPIOTE to detect two buttons (with app_button library) when pressed and it worked no problem on nrf5 dev board.

However when i ported the code to the custom board i found that button press could only wake up the MCU but it won't enter the interrupt routine (button handler function).

Any idea could lead to this problem??

Thanks. MM

Parents Reply Children
  • Thanks Amigo, tried to add this but it makes no difference (also the original code works in NFF51 DK board do not need it)

    Below are the code i initialize the buttons...

    static void buttons_leds_init(bool * p_erase_bonds)
    {    
    	uint32_t err_code;
    	static app_button_cfg_t p_button[] = {{BUTTON_1, APP_BUTTON_ACTIVE_HIGH, NRF_GPIO_PIN_NOPULL, button_handler},		
    											  {BUTTON_2, APP_BUTTON_ACTIVE_LOW, NRF_GPIO_PIN_PULLUP, button_handler}};	
    				
    	APP_GPIOTE_INIT(APP_GPIOTE_MAX_USERS);																					
    	// Initializing the buttons.
    	err_code = app_button_init(p_button, sizeof(p_button) / sizeof(p_button[0]), BUTTON_DEBOUNCE_DELAY);
    	
    	APP_ERROR_CHECK(err_code);																					
    	err_code = app_button_enable();	
    	APP_ERROR_CHECK(err_code); 
    }
    
    1. So the exact same code works on the nRF51, but not your custom board?
    2. I assume you have double checked that you use the correct pins?
    3. Is there a reason why you configure Button 1 without pullup resistor, and button 2 with pullup?
  • @ Martin

    1. Yes, except i have to change the pin definition correspondingly
    2. Yes.
    3. This is due to the hardware limitation.

    Just a thought...is it possible due to the absent of 32768 crystal and somehow i do not configure to use internal RC properly? I have set the CLOCK_CONFIG_LF_SRC to RC in Configuration Wizard. Do i need to change any code in the project files??

    Thanks

  • Are you able to run BLE applications? If you can do BLE you can be sure that you have handled the LF clock is working correctly. It shouldn't be necessary to change anything other than the setting is the wizard.

Related