Zephyr + NRF5340: change GPIO function in runtime

The project uses nRF5340. A signal is connected to P0.27/AIN6, and during "normal" mode the pin is used as an ADC.

Before going into sleep mode we would need this pin to become a GPIO Input with enabled interrupt, so as to waking up the MCU (and then back again to ADC during "normal mode").

Some previous posts state that Zephyr did not allow for runtime configuration of pins. Is that still the case? If this is not available and we use direct configuration of the MCU's registers, what are the "special concerns" in the device tree that we have to take in order not to mess up Zephyr usage of the pin?

Parents Reply
  • So this is where I get confused - pardon me for the lack of experience with Zephyr:
    We know how to configure the pin using DT for EITHER of those functions... but what is the best practice when we need both? Can I simply ignore DT completely for this "dual function" pin? Or should I configure both functions of the pin in DT and disable the via register as mentioned? Note that the project has a ton of other devices configured in DT, so that layer will still be there for the rest of the hardware.

Children
Related