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

Creation of custom DTS file for describing custom device connections


I need to create a custom dts for a custom board where I need to define the pins used for interfacing to some external devices. The generic "gpio-leds"/"gpio-keys", to my best understanding, do not feed my needs as I need more values per entry.

I would like to be able to create something like:

// Just for illustration, everything is hypothetical.
/ {
    model = "Huge bird detector NRF52832";
    compatible = "savanna,struthio-camelus-detector";
    detectors {
		compatible = "sc-detector";
		// Definition of first channel
		det0: det_0 {
		    irqpin = <&gpio0 13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
		    // ainpin and dettype are integer values, ainpin is an index
		    // into an ADC channel, dettype is just a flag.
			ainpin = <1>;
			dettype = <1>
			label = "S-C detector channel 1";
	// ...etc...

Where can I find detailed information covering this topic and, possibly, some examples?

I'm using nRF Connect SDK version 1.9.1 and Visual Studio Code.

Thanks a lot in advance.


Parents Reply Children
  • Hello Kazi, thanks for your replay.

    Maybe I'll need to clarify my question.

    The question is not related to how to [physically] interface with all the devices I'm integrating in the hardware and how to control them or how to write some source code.

    What I need your support for is for pointing me to where I can find information/manuals/samples about creating and using custom DTS' (device tree source files), so I can create different "boards", with their associated DTS', to address properly the hardware differences that I can have in different board variants.

    If I, for instance, include the hypothetical device tree source from my original question in my board's dts file, the devicetree_unfixed.h file created by the toolchain does not contain all the information, e.g. it does not include any information for irqpin.

    That clearly means I'm missing some crucial steps in the workflow, especially the YAML file for bindings.

    I've created my custom boards in a different root directory, outside of the nRF Connect SDK root folder.

    1) Where, relative to the custom board's root directory, should I locate the customised YAML file required by my custom DTS file?

    2) Is there any example/template available for such YAML file, besides taking as reference the ones available in the zephyr tree for other devices/manufacturers?

    3) If I want to create driver files for the devices I want to integrate, where should I place them, relative to the board's root directory? I want to keep my code as isolated as possible from the SDK code to be able to switch between SDK versions the smoothest as possible.

    4) How do I do it for creating configuration options for the inclusion or not of those drivers in the project during compile, like with CONFIG_PUT_MY_STUFF=y in the prj.conf file?

    Thanks in advance.