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

COMP stop task

Right now I'm stuck with the COMP driver. What I am trying to do is. Initialise COMP, start COMP with interrupt and STOP shortcut. Once I handled the interrupt I just want to start the COMP again with an interrupt and a shortcut. However, when trying to start the COMP I am getting an exeption because in the nrf_drv_comp.c this fails:

ASSERT(m_state == NRF_DRV_STATE_INITIALIZED);

when I call

nrf_drv_comp_start(NRF_DRV_COMP_EVT_EN_DOWN_MASK, NRF_DRV_COMP_SHORT_STOP_AFTER_DOWN_EVT);

My questions:

What is happening exactly when the stop task of the COMP is triggered due to interrupts?

In which state is the peripheral?

How can I use driver functions where m_state is checked when using interrupt shortcuts?

Parents
  • Hi, Did you figure this out yet?

    Te driver state should change from NRF_DRV_STATE_UNINITIALIZED to NRF_DRV_STATE_INITIALIZED when you call nrf_drv_comp_init() and vise versa when you call nrf_drv_comp_uninit().

    Furthermore the state will change to NRF_DRV_STATE_POWERED_ON when you start the comp with nrf_drv_comp_start(). Hence if you try to call nrf_drv_comp_start() once more by calling e.g. nrf_drv_comp_stop(), ASSERT(m_state == NRF_DRV_STATE_POWERED_ON); will assert because the state is NRF_DRV_STATE_POWERED_ON

Reply
  • Hi, Did you figure this out yet?

    Te driver state should change from NRF_DRV_STATE_UNINITIALIZED to NRF_DRV_STATE_INITIALIZED when you call nrf_drv_comp_init() and vise versa when you call nrf_drv_comp_uninit().

    Furthermore the state will change to NRF_DRV_STATE_POWERED_ON when you start the comp with nrf_drv_comp_start(). Hence if you try to call nrf_drv_comp_start() once more by calling e.g. nrf_drv_comp_stop(), ASSERT(m_state == NRF_DRV_STATE_POWERED_ON); will assert because the state is NRF_DRV_STATE_POWERED_ON

Children
No Data
Related