Hello,
I have an own hardware using nRF5340. So I created first an own board in the device tree. I took the definition of the nRF5340 development board and simply removed all the connectors, button, leds that were not on the pure processor. That seems to work. As this definition should be used for other similar boards, I keept all the status at disabled.
In an overlay file of my current project I changed the status now to ok:
/ {
soc {
peripheral@50000000 {
pwm0: pwm@21000 {
status = "okay";
};
};
};
};
In the generated zephyr.dts I see then, that the status is ok. So that works. But I understand some device tree documentation that the following should also work:
/ {
&pwm0 {
status = "okay";
};
}:
But pressing then Run CMake in SES I got the errors:
Error: nrf5340_ces_app.dts.pre.tmp:616.9-14 syntax error
FATAL ERROR: Unable to parse input tree
CMake Error at C:/ncs/v1.8.0/zephyr/cmake/dts.cmake:225 (message):
Even not so nice I could live for the moment with the first aproach. But would be nice to get knowledge about the problem and how to make it right.
My main problem is with my beeper. I want to use the pwm moduls together with pin 16 of port 0. So I define a beeper (in the overlay file) as
beepernode{
beeper: beepersnode {
pwms = < &pwm0 16 >;
};
};
Run CMake doesn't give an error and I see this part in zephyr.dts
Following the documentation and the blinky_pwm example I try to use my beeper with
pwm = DEVICE_DT_GET(DT_PWMS_CTLR(DT_NODELABEL(beeper)));
if (!device_is_ready(pwm))
{
return;
}
But building is not working and I get the error
4> In file included from C:/ncs/v1.8.0/zephyr/include/toolchain/gcc.h:66,
4> from C:/ncs/v1.8.0/zephyr/include/toolchain.h:50,
4> from C:/ncs/v1.8.0/zephyr/include/kernel_includes.h:19,
4> from C:/ncs/v1.8.0/zephyr/include/kernel.h:17,
4> from C:/ncs/v1.8.0/zephyr/include/zephyr.h:18,
4> from ../BA_Beschlag.cpp:1:
4> ../BA_Beschlag.cpp: In function 'void main()':
4> C:/ncs/v1.8.0/zephyr/include/device.h:81:39: error: '__device_dts_ord_DT_N_S_beepernode_S_beepersnode_P_pwms_IDX_0_PH_ORD' was not declared in this scope
4> C:/ncs/v1.8.0/zephyr/include/toolchain/common.h:124:26: note: in definition of macro '_DO_CONCAT'
4> C:/ncs/v1.8.0/zephyr/include/device.h:81:31: note: in expansion of macro '_CONCAT'
4> C:/ncs/v1.8.0/zephyr/include/device.h:233:37: note: in expansion of macro 'DEVICE_NAME_GET'
4> C:/ncs/v1.8.0/zephyr/include/device.h:247:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
4> ../BA_Beschlag.cpp:32:11: note: in expansion of macro 'DEVICE_DT_GET'
I tried several changes but can't find my error.
What do I have to do to get my beeper working as pwm device?
Erwin