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

How to run nrf52 SAADC continuously non-stop without interrupts?

Hi, I need to monitor voltage very frequently, have access to the latest value and also to have interrupt on low limit. But I do not want to have interrupt on EVT_DONE, like all SAADC samples have. Frequent interrupts may screw up timing of my other tasks. I see that SAADC has "Continuous mode", but is not really continuous because it stops after reaching RESULT.MAXCNT. So, questions are:

  1. Can I configure EasyDMA to overwrite the same buffer again and again? Other MCU brands have DMA ring buffer mode. Does nRF52 allow that?
  2. If not, then can I somehow shortcut EVT_DONE to TASKS_START, so that it will reload EasyDMA and continue sampling? Something else?

Thank your

Parents
  • That sample has lines:

    /************************* STOP SAMPLING AT END EVENT (When buffer is full.) *************************/   
    NRF_PPI->CH[2].EEP = (uint32_t)&NRF_SAADC->EVENTS_END;
    NRF_PPI->CH[2].TEP = (uint32_t)&NRF_SAADC->TASKS_STOP;
    NRF_PPI->CHEN |= PPI_CHENSET_CH2_Enabled << PPI_CHENSET_CH2_Pos;
    

    But I need the opposite: run SAADC non-stop. Can I enter these lines:

    NRF_PPI->CH[2].EEP = (uint32_t)&NRF_SAADC->EVENTS_END;
    NRF_PPI->CH[2].TEP = (uint32_t)&NRF_SAADC->TASKS_SAMPLE;
    NRF_PPI->FORK[2].TEP = (uint32_t)&NRF_SAADC->TASKS_START;
    NRF_PPI->CHEN |= PPI_CHENSET_CH2_Enabled << PPI_CHENSET_CH2_Pos;
    

    Would this work? Then I would not need RTC, right?

Reply
  • That sample has lines:

    /************************* STOP SAMPLING AT END EVENT (When buffer is full.) *************************/   
    NRF_PPI->CH[2].EEP = (uint32_t)&NRF_SAADC->EVENTS_END;
    NRF_PPI->CH[2].TEP = (uint32_t)&NRF_SAADC->TASKS_STOP;
    NRF_PPI->CHEN |= PPI_CHENSET_CH2_Enabled << PPI_CHENSET_CH2_Pos;
    

    But I need the opposite: run SAADC non-stop. Can I enter these lines:

    NRF_PPI->CH[2].EEP = (uint32_t)&NRF_SAADC->EVENTS_END;
    NRF_PPI->CH[2].TEP = (uint32_t)&NRF_SAADC->TASKS_SAMPLE;
    NRF_PPI->FORK[2].TEP = (uint32_t)&NRF_SAADC->TASKS_START;
    NRF_PPI->CHEN |= PPI_CHENSET_CH2_Enabled << PPI_CHENSET_CH2_Pos;
    

    Would this work? Then I would not need RTC, right?

Children
No Data
Related