Hi All,
I'm trying to use the COMP module for detecting when a signal from AIN1 input crosses up or down a reference voltage set at the AIN3 input from an external source.
I haven't found any sample code but managed to use the driver's API (nrfx_comp.h
) to initialize the module.
What I'm facing is the LPCOMP/COMP IRQ handler (nrfx_comp_irq_handler
) is not linked into the application, so the COMP IRQ is trapped as a spurious IRQ and handed over to the k_sys_fatal_error_handler()
function, which in turn resets the device.
In my prj.conf
I've enabled CONFIG_NRFX_COMP=y, so the driver code is enabled, but looking at its code (nrfx_comp.c
), the IRQ handler function is surrounded by another optional compilation, see code excerpt below:
#if NRFX_CHECK(NRFX_PRS_ENABLED)
if (nrfx_prs_acquire(NRF_COMP, nrfx_comp_irq_handler) != NRFX_SUCCESS)
{
err_code = NRFX_ERROR_BUSY;
NRFX_LOG_WARNING("Function: %s, error code: %s.",
__func__,
NRFX_LOG_ERROR_STRING_GET(err_code));
return err_code;
}
#endif
How do I enable the IRQ handler for the LPCOMP/COMP module? My SDK version is nRF5_SDK_17.1.0_ddde560.
BR