nrf5340 I2C peripheral power management query

Hi,
I have a question regarding the nRF power management APIs. I'm trying to implement power management in my code, and I found that the pm_device_action_run()  API can be used to manage peripheral power consumption by putting the peripheral into a PM_DEVICE_ACTION_SUSPEND or PM_DEVICE_ACTION_SUSPEND state.

I tried using this API with the I2C peripheral in my code,However, when I call the API to put the I2C peripheral into the PM_DEVICE_ACTION_SUSPEND state, I receive a return value of -120, which indicates that the "device is already at the requested state."

Is it necessary to call the pm_device_action_run() API to put the I2C peripheral to sleep, or is the power management of I2C peripherals already handled by the I2C driver provided by Zephyr?

I'm using SDK version: v2.4.2.
toolchain version: v2.4.2
nrf board: nrf5340


Thanks.

Parents
  • Is it necessary to call the pm_device_action_run() API to put the I2C peripheral to sleep, or is the power management of I2C peripherals already handled by the I2C driver provided by Zephyr?

    When you get an error of -120 that the driver is already in that requested state when you run pm_device_action_run, then most likely pm_device_action_run was run before. The zephyr\drivers\i2c\i2c_nrfx_twim.c implements the pm_device plugins, so no, it does not handle the RTOS specific power management by itself. 

    I would suggest you to put a breakpoint in twim_nrfx_pm_action function and run your application in debugger to see if there has been any other calls to twim_nrfx_pm_action prior to you calling pm_device_action_run . If yes, then check the function call stack to understand the context of when it was called before.

Reply
  • Is it necessary to call the pm_device_action_run() API to put the I2C peripheral to sleep, or is the power management of I2C peripherals already handled by the I2C driver provided by Zephyr?

    When you get an error of -120 that the driver is already in that requested state when you run pm_device_action_run, then most likely pm_device_action_run was run before. The zephyr\drivers\i2c\i2c_nrfx_twim.c implements the pm_device plugins, so no, it does not handle the RTOS specific power management by itself. 

    I would suggest you to put a breakpoint in twim_nrfx_pm_action function and run your application in debugger to see if there has been any other calls to twim_nrfx_pm_action prior to you calling pm_device_action_run . If yes, then check the function call stack to understand the context of when it was called before.

Children
No Data
Related