I'm struggling with SDKConnect and the device tree stuff... and finding it hard to get good examples or docs TBH
So, I have the sample dts files for the nRF5340DK, which defines the config for the 'uart0' node:
I'm struggling with SDKConnect and the device tree stuff... and finding it hard to get good examples or docs TBH
So, I have the sample dts files for the nRF5340DK, which defines the config for the 'uart0' node:
Hi BrianW,
I empathize with your difficulties in getting starts with Devicetree. We do offer an online course to help with the early stages, but what you are trying to do is unfortunately more advanced than what the course covers.
You will first want to look into the concept of phandle, then you can find the pin control API here: https://docs.nordicsemi.com/bundle/ncs-2.6.1/page/zephyr/build/dts/api/api.html#pinctrl-pin-control.
Devicetree API is makes it more straightforward when using the Zephyr API to access peripheral. As you want to use nrfx drives, it becomes a little more complex.
The benefit of using the API above is that your hardware description is still concentrated in the Devicetree, allowing the project to support multiple hardware with just the Devicetree board files change. You can just disable the nodes in Devicetree, and use pin number directly in code, at the cost of this benefit.
Hieu
Devicetree API is makes it more straightforward when using the Zephyr API to access peripheral. As you want to use nrfx drives, it becomes a little more complex.
Yes, it does. And I was kind of hoping for a reply with more specific help about how to do it, the documentation is VERY basic.
Specific questions then:
I want to get the uart config to populate an nrfx uarte config structure,
by the way, I tried doing
char* nodepath = DT_PATH(DT_ALIAS(console));
and this fails to compile:
C:/work/dev/nordic_connect/zephyr/include/zephyr/devicetree.h:90:17: error: 'DT_N_S_DT_N_S_soc_S_peripheral_40000000_S_uart_8000' undeclared (first use in this function); did you mean 'DT_N_S_soc_S_peripheral_40000000_S_uart_8000_ORD'?
The duplicated "DT_N_S_" part makes me think that the DT_PATH and DT_ALIAS macros don't play well together, despite what I understand the parameter to DT_PATH to be? (a node id).
any pointers on this?