This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

LPCOMP doesn't sense the pulse count correctly

Hii every one, We are working on a project where we are using a temperature sensor LMT01, its giving a pulse output the pulse out is from 220mV to 600m. So I'm using lpcomp to count the number of pulses. my config is like this

> Blockquote/**
 * @brief Initialize LPCOMP driver.
 */

static void lpcomp_init(void)
{
    uint32_t                err_code;

    nrf_drv_lpcomp_config_t config;

    config.hal.reference = NRF_LPCOMP_REF_SUPPLY_1_8;
    config.hal.detection = NRF_LPCOMP_DETECT_UP;
    config.input = TEMP_VN_PIN;

    // initialize LPCOMP driver, from this point LPCOMP will be active and provided
    // event handler will be executed when defined action is detected
    err_code = nrf_drv_lpcomp_init(&config, lpcomp_event_handler);
    APP_ERROR_CHECK(err_code);
    nrf_drv_lpcomp_enable();
}
my power supply is 3.3V as I think refrence will be 3.3/8 = 0.4125
 and incremented the pulse count in event handler

void lpcomp_event_handler(nrf_lpcomp_event_t event)
{
	if(event ==  NRF_LPCOMP_EVENT_UP)
    {
		m_temp_pulse_count++;
}
}

in the span of 50ms the temp sensor giving more than a thousand pulses but lpcomp showing the output as 17. I want someone to help in this regards

Thanks in advance

Related