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
  • It seems like I didn't read your initial post carefully enough, but I'm still not sure if I understand your question though. When you call nrf_drv_comp_start() with NRF_DRV_COMP_SHORT_STOP_AFTER_DOWN_EVT as the second parameter you are telling the nRF to stop the the comparator after the first down event. This all happens inside the comparator HW with shortcuts and doesn't seem to change anything in the comp driver. Hence you will need to track this in your application yourself. If you just want the comparator to continue you can call nrf_drv_comp_start(NRF_DRV_COMP_EVT_EN_DOWN_MASK, 0);

Reply
  • It seems like I didn't read your initial post carefully enough, but I'm still not sure if I understand your question though. When you call nrf_drv_comp_start() with NRF_DRV_COMP_SHORT_STOP_AFTER_DOWN_EVT as the second parameter you are telling the nRF to stop the the comparator after the first down event. This all happens inside the comparator HW with shortcuts and doesn't seem to change anything in the comp driver. Hence you will need to track this in your application yourself. If you just want the comparator to continue you can call nrf_drv_comp_start(NRF_DRV_COMP_EVT_EN_DOWN_MASK, 0);

Children
No Data
Related