[SOLVED] MCPWM Capture: Cannot set 'intr_priority'.
Posted: Mon May 13, 2024 7:28 pm
Hello,
I am having an issue when setting the interrupt priority of a capture channel.
When I compile this function, I get the error: 'mcpwm_capture_channel_config_t' has no member named 'intr_priority'.
This member is documented in the esp-idf docs and I have double checked that it is defined in my esp-idf build in mcpwm_cap.h:
The code works properly with the default value if I remove the line 'xCaptureChannelConfig.intr_priority = 0;'. I have also tried defining it in the configuration block (eg. '.intr_priority = 0,').
Thank you for any help you can provide.
I am having an issue when setting the interrupt priority of a capture channel.
When I compile this function, I get the error: 'mcpwm_capture_channel_config_t' has no member named 'intr_priority'.
Code: Select all
void vCreateCaptureChannels(mcpwm_cap_channel_handle_t xCaptureChannels[], mcpwm_cap_timer_handle_t xCaptureTimer) {
ESP_LOGI(TAG, "Create Hall sensor capture channels");
mcpwm_capture_channel_config_t xCaptureChannelConfig = {
.prescale = 1,
.flags.pull_up = false,
.flags.neg_edge = true,
.flags.pos_edge = true,
};
xCaptureChannelConfig.intr_priority = 0;
const int cap_chan_gpios[3] = {DIN_HALL_1, DIN_HALL_2, DIN_HALL_3};
for (int i = 0; i < 3; i++) {
xCaptureChannelConfig.gpio_num = cap_chan_gpios[i];
ESP_ERROR_CHECK(mcpwm_new_capture_channel(xCaptureTimer, &xCaptureChannelConfig, &xCaptureChannels[i]));
}
}
Code: Select all
typedef struct {
int gpio_num; /*!< GPIO used capturing input signal */
int intr_priority; /*!< MCPWM capture interrupt priority,
if set to 0, the driver will try to allocate an interrupt with a relative low priority (1,2,3) */
uint32_t prescale; /*!< Prescale of input signal, effective frequency = cap_input_clk/prescale */
struct {
uint32_t pos_edge: 1; /*!< Whether to capture on positive edge */
uint32_t neg_edge: 1; /*!< Whether to capture on negative edge */
uint32_t pull_up: 1; /*!< Whether to pull up internally */
uint32_t pull_down: 1; /*!< Whether to pull down internally */
uint32_t invert_cap_signal: 1; /*!< Invert the input capture signal */
uint32_t io_loop_back: 1; /*!< For debug/test, the signal output from the GPIO will be fed to the input path as well */
uint32_t keep_io_conf_at_exit: 1; /*!< For debug/test, whether to keep the GPIO configuration when capture channel is deleted.
By default, driver will reset the GPIO pin at exit. */
} flags; /*!< Extra configuration flags for capture channel */
} mcpwm_capture_channel_config_t;
Thank you for any help you can provide.