I know from a hardware perspective things are good - because when I use a more standard piece of code to do this (RMT driver, same hardware, GPIO) things are fine. But this simple little test _should_ at least receive a pulse and trigger an interrupts - but gives me nothing at all.
Any idea on what I am missing?
#include "driver/rmt.h"
#include "soc/rmt_reg.h"
#include "esp_intr_alloc.h"
#define RMT_CHANNEL RMT_CHANNEL_2
#define RMT_GPIO_NUM GPIO_NUM_18
#define RMT_CLK_DIV 80
#define RMT_RX_FILTER_THRES 100
volatile uint16_t test=0;
void rmt_isr(void* arg) {
test++;
}
intr_handle_t rmt_intr_handle;
void app_main() {
// Configure GPIO pin for input mode
gpio_set_direction(RMT_GPIO_NUM, GPIO_MODE_INPUT);
// Configure RMT module
RMT.conf_ch[RMT_CHANNEL].conf0.div_cnt = 80; // Set clock divider for desired tick duration
RMT.conf_ch[RMT_CHANNEL].conf0.mem_size = 1;
RMT.conf_ch[RMT_CHANNEL].conf0.carrier_en = 0;
RMT.conf_ch[RMT_CHANNEL].conf0.carrier_out_lv = 1;
RMT.conf_ch[RMT_CHANNEL].conf0.mem_pd = 0;
RMT.conf_ch[RMT_CHANNEL].conf0.idle_thres = 100;
// Enable RMT channel
RMT.conf_ch[RMT_CHANNEL].conf1.rx_filter_en = 1;
RMT.conf_ch[RMT_CHANNEL].conf1.rx_filter_thres = 100;
RMT.conf_ch[RMT_CHANNEL].conf1.mem_wr_rst = 1;
RMT.conf_ch[RMT_CHANNEL].conf1.mem_owner = RMT_MEM_OWNER_RX;
RMT.conf_ch[RMT_CHANNEL].conf1.rx_en = 1;
// Enable RMT receiver
RMT.int_ena.val |= 0xffff;
// Enable RMT interrupts
esp_intr_alloc(ETS_RMT_INTR_SOURCE, ESP_INTR_FLAG_IRAM | ESP_INTR_FLAG_LEVEL1,&rmt_isr,0L,&rmt_intr_handle);
// Loop to continuously read pulse widths
while (1) {
ESP_LOGI(TAG,"%u",test);
vTaskDelay(250 / portTICK_PERIOD_MS);
}
}