This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Zephyr power management issues

Dear Nordic, 

As per power management, could you please suggest any thoughts for following:

We have two ICs on the board connected to nRF52840: 6-DOF sensor (over SPI) and flash mem (over QSPI). Both of them are powered from one external LDO regulator controlled by GPIO output, and there is a 'regulator' node has been defined for it. 

1. 'nordic,qspi-nor' device node model doesn't include 'vin-supply' parameter, how we could connect it to regulator to take automatic control over QSPI flash power?

2. When accessing 6-DOF sensor, we need to take manual control over it's powering, and - when it is not in work - it should be disabled completely, including SPI lines. For now, when we turn off the regulator manually, the SPI lines stays active and give parasitic supply to the sensor and increase overall consumption. What approach is preferred to implement here? Something like that? (https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/pm/device_pm/src/main.c)

  • Hi Dmitry

    1. I'm not sure I understand the question. It sounds like you don't have a Vin on the QSPI device you're using, but I find that hard to believe. How do you power the QSPI device?

    2. Yes, I think the power managemer in the nRFConnect SDK should be able to handle power management on the chip. You could alternatively set these SPI lines low so they don't draw any current at all during this time.

    Best regards,
    Simon

  • Hi Simonr, 

    1. Of course it has power :) We have GPIO-controlled LDO 3.6->1.8V on the board and both QSPI flash and 6-DOF sensor are powered from this LDO. For good battery life it's necessary to turn off LDO when devices are not in use (when disconnected from Bluetooth central). So, for example, 'jedec,spi-nor' device has 'vin-supply' property, why don't the 'nordic,qspi-nor' have? How it can be controlled? 

    2. Could you please suggest proper example / description we shoud consider to control powering of the sensor?

  • Thank you for the update. 

    1. The regulator subsystem here describes how you can add a regulator to any kind of external device (like sensors or external flash drives). It should be possible to implement something like this for both the QSPI flash and sensor you're using.

    2. Check out the subsystem linked to above as well as the regulator.h file in \NCS_VERSION\zephyr\include\drivers\

    Best regards,

    Simon

  • Hi Simonr, 

    We applied the regulator susbystem as well by your recommendation (at another ticket). 

    The question is not about the regulator module itself (it works fine enough for the moment) still about the proper approach to implement that in the application.

    The dummy_driver application shows relatively clear approach about regulator PM chain management (parent - child suspending), and we're going to implement someting like that.

    The still active questions are:

    1. Basic 'nordic,qspi-nor' driver doesn't have 'vin-supply' field, should we implement our custom driver for NOR flash based on this driver? Or should we manually turn on-off the regulator for flash? Please note there will be logging and perhaps bootloader modules in chain with QSPI driver.

    2. Should we consider using PM_DEVICE_RUNTIME functionality and related functions for PM management of external ICs?

    3. As of SPI driver, there is an issue with PM function: although it has de-initialization for SCK/MOSI/MISO pins, the CS pin still remains active and leads parasitic supply of external ICs (spi_context_cs_configure() - the only function for CS pin configuration from spi_context.h). How we should deal that?

    PS. pls note the pm/device_runtime.h header has no closing '}' bracket for 'external "C" {' definition. It leads to error on using the module with C++ sources.

  • Hi

    1. Yes, in order to add a 'vin-supply' field I'd recommend making a custom implementation of the QSPI driver with this field.

    2. That sounds like a good idea if you need to manage the power usage of multiple external devices, as PM_DEVICE_RUNTIME lets devices be suspended/resumed based on device usage.

    3. The SPI documentation specifies that a GPIO node is supposed to be used when instantiating a SPI_CS_CONTROL structure. 

    Thank you for notifying us of the missing bracket. I've reported it internally.

    Best regards,

    Simon

Related