Hi,
I'm trying to use the nRF COMP peripheral in Zephyr.
My application boots and runs normally until I enable the DeviceTree overlay for the COMP.
As soon as the overlay is added, the device stops booting (no logs appear).
If I remove the overlay entirely, the system boots as expected./ {
aliases {
comp0 = ∁
};
};
#include <zephyr/dt-bindings/comparator/nrf-comp.h>
/* Based on:
* https://docs.zephyrproject.org/latest/build/dts/api/bindings/comparator/nordic%2Cnrf-comp.html
*/
&comp {
status = "okay";
main-mode = "SE";
psel = <NRF_COMP_AIN0>; // P1.04
refsel = "VDD";
sp-mode = "NORMAL";
th-up = <29>; // ≈ 1.70 V
th-down = <27>; // ≈ 1.60 V
isource = "DISABLED";
enable-hyst;
};
my config
CONFIG_COMPARATOR=y
CONFIG_PRINTK=y
CONFIG_LOG=y
my main.c#include <zephyr/sys/printk.h>
#include <zephyr/drivers/comparator.h>
#include <zephyr/kernel.h>
#define COMP_NODE DT_ALIAS(comp0)
static const struct device *comp = DEVICE_DT_GET(COMP_NODE);
static void handle_comparator_event(const struct device *dev, void *user_data)
{
bool output = comparator_get_output(dev);
printk("Comparator event: output is %s\n", output ? "HIGH" : "LOW");
}
int main(void)
{
printk("Starting main\n");
if (!device_is_ready(comp)) {
printk("Comparator device not ready\n");
return 0;
}
comparator_set_trigger(comp, COMPARATOR_TRIGGER_BOTH_EDGES);
comparator_set_trigger_callback(comp, handle_comparator_event, NULL);
printk("Comparator device is ready\n");
while (1) {
printk("Main running ...");
k_sleep(K_MSEC(1000));
}
return 0;
}
- No log output at all
- never reaches printk("Starting main")
I'm using nRF54L15dk with Zephyr 4.3.0