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

Workaround for Errata 97

Hi,

As per the Errata 97, there is increase in current consumption if GPIOTE is used in Input mode. We are working on low power device and cannot afford increase in current consumption.

My question is how can we get interrupts on the PORT without using GPIOTE?

The workaround for this erratum says "Use Port event to detect transitions on inputs instead of GPIOTE input mode". Can you guide us to the example code to use port events for interrupts?

Will there be any fix for this erratum from nordic side in near future?

Thanks,

Justin

Parents
  • Hi,

    If you are using the GPIOTE driver, you can use PORT mode by setting the hi_accuracy parameter in the config to 0. If you are writing the registers directly, it should be sufficient to configure the GPIO with SENSE enabled and enable interrupts for the EVENTS_PORT event.

    This errata has been inherited from nRF52832 engineering A revision, I do not expect it to be fixed in any potential future spin of this chip. It seems to be fixed in never nRF52 series chips.

    Best regards,
    Jørgen

  • Hi,

    This is a simple example for configuring and enabling interrupts for GPIOTE PORT event:

    #include "nrf.h"
    #include "nrf_gpio.h"
    #include "boards.h"
    
    
    void GPIOTE_IRQHandler()
    {
        if(NRF_GPIOTE->EVENTS_PORT == 1)
        {
            nrf_gpio_pin_toggle(LED_1); // Toggle LED1 when BUTTON1 is pressed
            NRF_GPIOTE->EVENTS_PORT = 0;
        }
    }
    
    /**
     * @brief Function for application main entry.
     */
    int main(void)
    {
        // Configure the GPIO pin for LED 1 on the nRF52832 dev kit
        // and turn off led
        nrf_gpio_cfg_output(LED_1);
        nrf_gpio_pin_clear(LED_1);
    
        // Configure the GPIO pin for Button 1 on the nRF52832 dev kit
        // as input with pull-up resistor enabled and low-sensing.
        NRF_GPIO->PIN_CNF[BUTTON_1] = (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) |
                                         (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) |
                                         (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) |
                                         (GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) |
                                         (GPIO_PIN_CNF_SENSE_Low << GPIO_PIN_CNF_SENSE_Pos);
        
        NRF_GPIOTE->EVENTS_PORT = 0;
        
        //Enable interrupts for PORT event
        NRF_GPIOTE->INTENSET = GPIOTE_INTENSET_PORT_Enabled << GPIOTE_INTENSET_PORT_Pos;
        NVIC_SetPriority(GPIOTE_IRQn, 7);
        NVIC_EnableIRQ(GPIOTE_IRQn);
    
        while (true)
        {
            __WFE();
        }
    }
    

    Best regards,
    Jørgen

Reply
  • Hi,

    This is a simple example for configuring and enabling interrupts for GPIOTE PORT event:

    #include "nrf.h"
    #include "nrf_gpio.h"
    #include "boards.h"
    
    
    void GPIOTE_IRQHandler()
    {
        if(NRF_GPIOTE->EVENTS_PORT == 1)
        {
            nrf_gpio_pin_toggle(LED_1); // Toggle LED1 when BUTTON1 is pressed
            NRF_GPIOTE->EVENTS_PORT = 0;
        }
    }
    
    /**
     * @brief Function for application main entry.
     */
    int main(void)
    {
        // Configure the GPIO pin for LED 1 on the nRF52832 dev kit
        // and turn off led
        nrf_gpio_cfg_output(LED_1);
        nrf_gpio_pin_clear(LED_1);
    
        // Configure the GPIO pin for Button 1 on the nRF52832 dev kit
        // as input with pull-up resistor enabled and low-sensing.
        NRF_GPIO->PIN_CNF[BUTTON_1] = (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) |
                                         (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) |
                                         (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) |
                                         (GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) |
                                         (GPIO_PIN_CNF_SENSE_Low << GPIO_PIN_CNF_SENSE_Pos);
        
        NRF_GPIOTE->EVENTS_PORT = 0;
        
        //Enable interrupts for PORT event
        NRF_GPIOTE->INTENSET = GPIOTE_INTENSET_PORT_Enabled << GPIOTE_INTENSET_PORT_Pos;
        NVIC_SetPriority(GPIOTE_IRQn, 7);
        NVIC_EnableIRQ(GPIOTE_IRQn);
    
        while (true)
        {
            __WFE();
        }
    }
    

    Best regards,
    Jørgen

Children
No Data
Related