I recently enabled power management in my code base by adding these two oiptions to my prj.conf:
CONFIG_PM_DEVICE=y
CONFIG_PM_DEVICE_RUNTIME=y
<err> qspi_nor: pm_device_runtime_put failed: -16
I recently enabled power management in my code base by adding these two oiptions to my prj.conf:
CONFIG_PM_DEVICE=y
CONFIG_PM_DEVICE_RUNTIME=y
<err> qspi_nor: pm_device_runtime_put failed: -16
Hi
Okay, so I think what's happening here is that this error is caused because you've set CONFIG_NORDIC_QSPI_NOR_XIP=y in your project, because it will keep the QSPI busy to avoid it from being affected by the power management. But something in your project does use power management, that is in turn rejected by the QSPI. Are you trying to put the nRF53 to sleep at all, because that will also call the pm_device_runtime_put I believe.
Best regards,
Simon
Hi
Okay, so I think what's happening here is that this error is caused because you've set CONFIG_NORDIC_QSPI_NOR_XIP=y in your project, because it will keep the QSPI busy to avoid it from being affected by the power management. But something in your project does use power management, that is in turn rejected by the QSPI. Are you trying to put the nRF53 to sleep at all, because that will also call the pm_device_runtime_put I believe.
Best regards,
Simon
Hi SImon,
I am definitely not ttrying to put the MCU to sleep manually. When I enabled CONFIG_PM_DEVICE_RUNTIME, I added various calls to pm_device_runtime_get and pm_device_runtime_put in my code. With these changes in places, power management should be automatic: the PM subsystem should figure out which device(s) it can put to sleep and when (I am not considering device drivers here (which need to do more work), because my code doesn't implement any device drivers, it just uses the existing ones). However, none of the PM calls in my code touch the QSPI NOR device, I just use the existing driver. And the driver should do all the required PM work automatically. Looking at the driver, I don't think it's doing it correctly. I'm talking specifially about https://github.com/nrfconnect/sdk-zephyr/blob/v3.6.99-ncs2/drivers/flash/nrf_qspi_nor.c#L318-L323:
if (!dev_data->xip_enabled) {
qspi_clock_div_change();
pm_device_busy_set(dev);
}
I would think that you want to call pm_device_busy_set when XIP is enabled, not disabled, like the code above does? There might be other places where this isn't used correctly, I just highlighted one that looks suspicious.
Thanks,
Bogdan