Hello devs,
I have been testing Zephyr PM on a rak11720 and maybe stumbled upon a bug I haven’t been able to resolve. I have some GPIO pins configured and set across the application. If I run the application only enabling CONFIG_PM, everything goes well. I tried to enable CONFIG_PM_DEVICE and use pm_device_action_run for suspending UART peripherals. But whenever I enable CONFIG_PM_DEVICE, gpios don’t work anymore. Has anyone had this same issue?
Hello @Giovanni
Welcome to forum. Please take a look following example project. rak-zephyr-app/app/basic/uart_sleep at main · srcnert/rak-zephyr-app · GitHub
Please also do not forget to apply patches. If this is not solving your problem, please provide more info like Zephyr RTOS version, problematic pins names etc.
Best regards,
Sercan.
Hi @sercan, thank you for the tip. I downloaded your example project and applied all the necessary patches in order to make it work. Although, the issue persists using CONFIG_PM_DEVICE.
Hereby, I’ll provide you with the necessary information for testing our environment:
Zephyr OS Version 4.2
The attached project is an edited version of your uart_sleep example where we only added configuration for two GPIO pins, respectively vcc_pin (gpio31) and gps_backup_pin (gpio5), that in our case study we use for controlling a gps module.
CASE #1 - CONFIG_PM_DEVICE DISABLED
When this flag is disabled, both pins get properly controlled as described in main.c.
backup_pin remains high, while vcc_pin toggles.
int main(void)
{
/* setup here... */
gpio_pin_set_dt(&vcc_pin, 0);
gpio_pin_set_dt(&backup_pin, 1);
while (1) {
// pm_device_action_run(uart_dev, PM_DEVICE_ACTION_RESUME);
gpio_pin_set_dt(&vcc_pin, 0);
print_uart("Hello! Uart Sleep Test.\r\n");
k_msleep(2000);
// pm_device_action_run(uart_dev, PM_DEVICE_ACTION_SUSPEND);
gpio_pin_set_dt(&vcc_pin, 1);
k_msleep(10000);
}
return 0;
}
CASE #2 - CONFIG_PM_DEVICE ENABLED
In this case, vcc_pin keeps working correctly, while backup_pin looks forced low.
Let me know if you need anything else for testing it. Thank you for your help.
uart_sleep.tgz (11.8 KB)
Hello @Giovanni
I take a look your case. In my opinion, it is not related to Zephyr RTOS. GP5 is used by I2C0&SPI0 and GP31 is used by BLE side. It is possible to close SPI0 with following overlay file addition:
&iom0 {
spi0: spi {
status = "disabled";
};
};
However, there is no way to close GP31 pin as far as I know. If it is possible, please try to change this pin. Please also inform me about GP5 is started to work with overlay change or not. I tested it with led pins which are GP44 and GP45 and everything seems okay to me.
Best regards,
Sercan.
Hi @sercan,
I have just tested the patched overlay and it is working fine. However, I don’t understand which is the correlation between GP5 (spi0) and CONFIG_PM_DEVICE. Why does this concurrency occur using this specific configuration?
By the way, thank you for the tip!
@Giovanni it is coming enabled at dts file. Due to this, it must be disabled to use GP5. You can take a look these files for further development.
You are welcome ![]()
Sercan.