Large delay between k_signal_raise and k_poll invocation

Hi,

I'm using an nrfx_timer event with k_poll_signal_raise to trigger a thread to perform an operation.

I've noticed around 900ms delay between when the signal is raised and the k_poll runs in the thread.

This is observed using a logic analyzer with logging level error.

I cannot explain where this delay is coming from. I used systemview tracing and also used the user tracer with my own traveller to find out what is running during this time and it only shows system idle task running.

I'm out of ideas and wanted to see if you've encountered anything similar? Here's the code snippet of what I'm trying to do:

/*
* get power eading thread handler
*/
void get_power_reading_hdl(void *p1, void *p2, void *p3) {
    int signaled, result;

    while (k_poll(power_evt, 1, K_FOREVER)==0) {

nrf_gpio_pin_clear(TAT_TOGET_PWR);
        k_poll_signal_check(&get_power_sig, &signaled, &result);
        if (signaled == 0) {
            LOG_ERR("ERROR false signal");
            return;
        }
        k_poll_signal_reset(&get_power_sig);
        power_evt[0].state = K_POLL_STATE_NOT_READY;

        while ((tat_data.t_hash > 1) && (((1<<tat_data.t_hash) & tat_data.target_address) == 0)) {
            tat_data.t_hash--;
                continue;
        }
        if (tat_data.t_hash > 1) {
            LOG_DBG("Get power reading for %x", 1<<tat_data.t_hash);
            get_power_reading(1<<tat_data.t_hash);
nrf_gpio_pin_set(GET_PWR_GAP);
            tat_data.t_hash--;
        }
        if (tat_data.t_hash>1){
            k_timer_stop(&power_reading_timeout);
            atomic_set(&in_tat_loop, 0);                        
        }
    }
}

/* 
* This is a timer handle that runs when power reading collection has been done
*/
void get_power_reading_daemon(int id) {
    /* Send the first get_power_reading command */
    k_poll_signal_raise(&get_power_sig, 0);
    reach_put_timer(tat_data.get_pwr_reading_tmr);
}

The signal is initialized at system startup.

Thanks in advance for any clue that might help,

Guy

Related