Page 1 of 1

Crash at "mcpwm_soft_sync_activate()" function inside mcpwm isr capture callback

Posted: Tue Nov 12, 2024 1:01 am
by Baldhead
Hi,

I can't call this function( mcpwm_soft_sync_activate(soft_sync_source); ) within the mcpwm capture callback ?

I'm following this example:
https://github.com/espressif/esp-idf/bl ... ple_main.c

Code: Select all

static mcpwm_sync_handle_t soft_sync_source = NULL;  // init at startup code.

static IRAM_ATTR bool mcpwm_sync_signal_isr_callback(mcpwm_cap_channel_handle_t cap_chan, const mcpwm_capture_event_data_t *edata, void *user_data)
{
    if (edata->cap_edge == MCPWM_CAP_EDGE_POS)
    {
        if( gpio_ll_get_level(&GPIO, (gpio_num_t)MCPWM_SYNC_PIN) == 0 ) return pdFALSE;  // Sync signal falling edge Filter.

        mcpwm_soft_sync_activate(soft_sync_source);
    }
    
    return false;	
}
This function is causing a crash on freeRtos.

I don't want to use hardware triggering directly because the esp32-s3 input doesn't have a schmitt trigger, and this is causing false triggering on the falling edge of the signal.
For this reason i used the filter(tests the input level, to know if it is a rising edge or a falling edge) inside the interrupt.

Some sugestion ?

Thank's.

Re: Crash at "mcpwm_soft_sync_activate()" function inside mcpwm isr capture callback

Posted: Tue Nov 12, 2024 1:46 am
by Baldhead
Solved, the handle was null.

it was just initializing the capture timer last.