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

initialize device to DEVICE_PM_OFF_STATE?

I have a nRF5340 with a UART that connects to a circuit that is not powered on until it is needed by the application.  So the UART must be powered off until the application requires it.  I see that there is a function device_set_power_state that I can use with DEVICE_PM_ACTIVE_STATE to turn it on.  However, I don't see a way to initialize the device to DEVICE_PM_OFF_STATE.  Is there something I need to do in the dts to indicate that?

Parents
  • Hey Denis!

    It is a bit tricky to make make the peripheral not to start off being initialized. The Zephyr drivers don't allow you to do that, though you can use the nrfx ones.

    Take a look at this post.

    Best regards,

    Elfving

  • When the device driver is initialized it brings the TX pin high (and RX high with a pull-up).  These pins are going to an unpowered circuit.  That exceeds the maximum allowed voltage on the pins in that unpowered circuit.  Electrically this is violating the specifications.

    Using other SDKs this has never been an issue, since typically the application explicitly initializes the drivers after main is started and it has full control over the sequence.

    It would be a great addition to Zephyr if the device driver configurations from the device tree were typically simply default initial values, device initialization can be deferred to the application, and there was support for reconfiguration and de-initialization.

    It looks like I will need to use the Nordic peripheral directly, or use nrfx to access the peripheral, since the Zephyr driver doesn't support this.  Which is a shame since there is a fair amount of useful code in the Zephyr driver that I will probably need to reproduce...

  • Hey Denis!

    I understand.

    Then I guess you are stuck with either seeing if manipulating the drivers to do something along the lines of the -EBUSY trick can help, or using the nrfx drivers.

    denis said:
    It would be a great addition to Zephyr if the device driver configurations from the device tree were typically simply default initial values

    Yeah, sadly I don't know when or even if this will be implemented.

    Best regards,

    Elfving

Reply
  • Hey Denis!

    I understand.

    Then I guess you are stuck with either seeing if manipulating the drivers to do something along the lines of the -EBUSY trick can help, or using the nrfx drivers.

    denis said:
    It would be a great addition to Zephyr if the device driver configurations from the device tree were typically simply default initial values

    Yeah, sadly I don't know when or even if this will be implemented.

    Best regards,

    Elfving

Children
No Data
Related