Weird RUI3 GPIO Sleep Behaviour for P13 and P33

We’re using a rak11720, we noticed some weird behaviour with P33. We’re using it as an output pin. After sleep the pin refuses to change state.

Upon further inspection we found this:

void uhal_gpio_suspend(void) {
     for (int i = 0 ; i < M_MAX_GPIO_PIN ; i++) 
     {
        if (i == 20 || i == 21 
            ) {
            continue;
        }
        
        if (i == WB_A0 || i == WB_A1)
        {

            // GPIO INPUT
            uint32_t err_code = am_hal_gpio_pinconfig(i, GPIO_OPENDRAIN);
            ERROR_CHECK(err_code);

            // GPIO OPENDRAIN
            // uint32_t err_code = am_hal_gpio_pinconfig(i, GPIO_OPENDRAIN);
            // ERROR_CHECK(err_code);

        }

        if (gpio_status[i].wakeup_source == true)
        {
            uhal_gpio_wakeup_trigger_mode(i, uhal_gpio_wakeup_mode);
            continue;
        }

#if defined(SUPPORT_LORA) || defined(SUPPORT_LORA_P2P)
        //if (i == RADIO_RESET)
        //{
        //    am_hal_gpio_pinconfig(i, g_AM_HAL_GPIO_DISABLE);
        //    continue;
        //}
        if (i == RADIO_ANT_SW)
        {
            am_hal_gpio_pinconfig(i, g_AM_HAL_GPIO_DISABLE);
            continue;
        }
        //if (i == RADIO_NSS)
        //{
        //    am_hal_gpio_pinconfig(i, g_AM_HAL_GPIO_DISABLE);
        //    continue;
        //}
        //if (i == RADIO_BUSY)
        //{
        //    am_hal_gpio_pinconfig(i, g_AM_HAL_GPIO_DISABLE);
        //    continue;
        //}
#endif

        if (sg_gpio_isr[i] != NULL)
        {
            continue;
        }

        //am_hal_gpio_pinconfig(i, g_AM_HAL_GPIO_DISABLE); // (Why are we disabling all pin???)
    }

    return;
}

Pins P13 and P33 are set to High Impedance mode, this changes the existing state of the pin (it needs to remain HIGH in our application). Is there a reason why these pins are configured this way? It’s rather odd.

These pins are defined as A0 and A1 analog input pins in RUI3.
They are de-initialized during sleep for power saving reasons.

So I cannot use this as an output pin if I’m using sleep mode too. Is that correct?

Yes, unless you change the RUI3 sources itself.
Which you can do, they are open sourced.

1 Like

Yeah, that would make sense but I don’t think my organization wants to maintain a fork. But that makes sense, thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.