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 Reply Children
  • where and when would you execute this code? I might be thinking silly right now but, if you are executing this code, isn't your device already awake?

  • 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)

  • I see. I do not think that there will be any difference in the power consumption from using IRQ handler, but how would you identify that the system has woken up from only ADC events? With Softdevice, there will be tons of events waking up the system. if your system has even slight timing constraints then this way might disappoint you. I am curious to know your outcome. Please keep us posted.

  • I just check (every wakeup) if my sampling is already finished - for now it works exactly as I wanted.

Related