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

GPIOTE input pins dont work

Hello,

I use NRF52810 with SDK 14.2.0 and softdevice 112. I need to use 7 input pins,  but if I config more than 3 pins, all signals disappear.

GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS is setted to 7.
My configuration for each pins is like below:
	/**< INPUT. */
	nrf_drv_gpiote_in_config_t config_pwr = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
	// BTN_PWR
	err_code = nrf_drv_gpiote_in_init(BTN_PWR, &config_pwr, PIN_EVT_Handler);
	APP_ERROR_CHECK(err_code);
	nrf_drv_gpiote_in_event_enable(BTN_PWR, true);

Parents
  • Hello,

     

    but if I config more than 3 pins, all signals disappear.

     It sounds like your error handler catches something. Have you tried to debug? 

    Probably one of your APP_ERROR_CHECK(err_code) receives an err_code != 0. Turn off optimization to  be able to see the value of err_code while debugging, and set breakpoints on APP_ERROR_CHECK(). Which one has an err_code != 0?

    (NRF_SUCCESS = 0)

  • err_code = 0 always. I have found than it doesnt connect with number of pins. So, if i config some pin (for example, 31), response of  GPIOTE_IRQHandler will disappear. State in IN register is toggled, but CNF->SENS  doesnt react

  • What is your GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS defined to in sdk_config.h?

    And do you have logging enabled? Can you please try to define DEBUG in your preprocessor defines, and monitor the log? Does the log say anything?

    BR,

    Edvin

  • What do you mean by logging?

    // <o> GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins 
    #ifndef GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS
    #define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 8
    #endif

  • If you use one of the examples with BLE, then you probably see some calls to NRF_LOG_INFO(); in the project, do you?

    What is the following defines set to in your sdk_config.h:

    NRF_LOG_ENABLED
    NRF_LOG_BACKEND_UART
    NRF_LOG_BACKEND_RTT

  • Yes. I have this function and log_init(), but dont undestand, how it can help me. 

    // <h> nRF_Log 
    
    //==========================================================
    // <e> NRF_LOG_BACKEND_RTT_ENABLED - nrf_log_backend_rtt - Log RTT backend
    //==========================================================
    #ifndef NRF_LOG_BACKEND_RTT_ENABLED
    #define NRF_LOG_BACKEND_RTT_ENABLED 0
    #endif
    // <o> NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE - Size of buffer for partially processed strings. 
    // <i> Size of the buffer is a trade-off between RAM usage and processing.
    // <i> if buffer is smaller then strings will often be fragmented.
    // <i> It is recommended to use size which will fit typical log and only the
    // <i> longer one will be fragmented.
    
    #ifndef NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE
    #define NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE 64
    #endif
    
    // </e>
    
    // <e> NRF_LOG_BACKEND_UART_ENABLED - nrf_log_backend_uart - Log UART backend
    //==========================================================
    #ifndef NRF_LOG_BACKEND_UART_ENABLED
    #define NRF_LOG_BACKEND_UART_ENABLED 1
    #endif
    // <o> NRF_LOG_BACKEND_UART_TX_PIN - UART TX pin 
    #ifndef NRF_LOG_BACKEND_UART_TX_PIN
    #define NRF_LOG_BACKEND_UART_TX_PIN 6
    #endif

  • Ok. And NRF_LOG_ENABLED is 0 or 1?

    The reason I ask is because it sounds like somewhere in the project the application "crashes", and the most common reason is because an APP_ERROR_CHECK(err_code) receives an err_code != 0.

    I don't know what HW you are testing on, but if you can connect an UART to it (if it is a DK, then it is connected to the on board Segger chip). Alternatively you can use the RTT backend if you have a segger debugger. You can use JLink RTT Viewer.

    The error handler is a very useful tool while developing, and one way is to monitor it via the log. It will let you know if APP_ERROR_CHECK() receives != 0.

    Another way is to define DEBUG in your preprocessor defines and set a breakpoint on line 73 in the app_error.c. But you may need to disable optimization to see what err_code it was and where it occured.

Reply
  • Ok. And NRF_LOG_ENABLED is 0 or 1?

    The reason I ask is because it sounds like somewhere in the project the application "crashes", and the most common reason is because an APP_ERROR_CHECK(err_code) receives an err_code != 0.

    I don't know what HW you are testing on, but if you can connect an UART to it (if it is a DK, then it is connected to the on board Segger chip). Alternatively you can use the RTT backend if you have a segger debugger. You can use JLink RTT Viewer.

    The error handler is a very useful tool while developing, and one way is to monitor it via the log. It will let you know if APP_ERROR_CHECK() receives != 0.

    Another way is to define DEBUG in your preprocessor defines and set a breakpoint on line 73 in the app_error.c. But you may need to disable optimization to see what err_code it was and where it occured.

Children
Related