Hi everyone,
For mthe prject I'm working I must use the LPCOMP module to detect a cross. but anytime a init the LPCOMP module my code seems to freeze and nothing else happen. So it put a check inside and my code just loop since the init is never true.
prj.conf
CONFIG_NRFX_LPCOMP=y
CHIP_ERROR AppTask::InitLPCOMP()
{
nrfx_lpcomp_config_t cfg = NRFX_LPCOMP_DEFAULT_CONFIG(NRFX_ANALOG_EXTERNAL_AIN3);
cfg.reference = NRF_LPCOMP_REF_SUPPLY_9_16; //
cfg.hyst = NRF_LPCOMP_HYST_ENABLED,// NRF_LPCOMP_HYST_50mV;
cfg.interrupt_priority = NRFX_DEFAULT_IRQ_PRIORITY;
cfg.detection = NRF_LPCOMP_DETECT_CROSS; // permet UP et DOWN
int err = nrfx_lpcomp_init(&cfg, (nrfx_lpcomp_event_handler_t)LPCOMP_Handler);
while( nrfx_lpcomp_init_check() != true)
{
nrf_gpio_pin_toggle(SbgGpio2);
k_usleep(10);
}
nrfx_lpcomp_start( NRF_LPCOMP_INT_READY_MASK | NRF_LPCOMP_INT_CROSS_MASK, 0 );
return CHIP_NO_ERROR;
}
If anyone can provide some help.
Thanks.