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

SEVONPEND setting - how to?

If my way of thinking is not wrong, I have to set SEVONPEND flag to wake up cpu from sd_app_evt_wait on pended event. How to set this flag? I cannot find any function/macro to do this - I don't want to mess up other flags that are stored in that register.

I want my application to wake up (only wakeup, no execution of IRQ handler) when ADC finishes sampling.

Parents
  • Ok, that question was a bit silly.

    uint32_t scr_sevonpend = 1;
    SCB->SCR = ((uint32_t)scr_sevonpend << SCB_SCR_SEVONPEND_Pos) & SCB_SCR_SEVONPEND_Msk;

  • I will decribe You what I want to achieve, and what I am doing:

    • I want my adc to sample 2 channels in 3ms (1chan, 2chan, 3ms delay... ,1chan, 2chan, 3ms delay....)

    • I want this operations to be non-blocking, because sometimes I have to handle connection with high data throughput

    • I want to sleep as much as possible.

    What i do is:

    • periodically call 3ms timer - this timer sets adc input as channel1, start adc, and app goes to sleep

    • wakeup from power_manage when adc finishes sampling - change sampling channel to 2, start adc - go to sleep

    • wakeup again, sample channel2, no more adc operation - waiting for 3ms timer call again, sleeping

    I am setting SCR once, before starting all that operations. I propably could use normal ADC IRQ handlers to achieve this - I'll do some power consumption tests later to check which solution is better.

    I also use: nrf_adc_int_enable(0x01); and sd_nvic_ClearPendingIRQ(ADC_IRQn); I am not sure right now which are really necessary as I DONT call sd_nvic_EnableIRQ(ADC)

Reply
  • I will decribe You what I want to achieve, and what I am doing:

    • I want my adc to sample 2 channels in 3ms (1chan, 2chan, 3ms delay... ,1chan, 2chan, 3ms delay....)

    • I want this operations to be non-blocking, because sometimes I have to handle connection with high data throughput

    • I want to sleep as much as possible.

    What i do is:

    • periodically call 3ms timer - this timer sets adc input as channel1, start adc, and app goes to sleep

    • wakeup from power_manage when adc finishes sampling - change sampling channel to 2, start adc - go to sleep

    • wakeup again, sample channel2, no more adc operation - waiting for 3ms timer call again, sleeping

    I am setting SCR once, before starting all that operations. I propably could use normal ADC IRQ handlers to achieve this - I'll do some power consumption tests later to check which solution is better.

    I also use: nrf_adc_int_enable(0x01); and sd_nvic_ClearPendingIRQ(ADC_IRQn); I am not sure right now which are really necessary as I DONT call sd_nvic_EnableIRQ(ADC)

Children
No Data
Related