Hi,
Can anyone please point me to / or offer and example of how to associate an ISR handler to the RMT receive element. I'm looking for when the RMT receiver has finished receiving a signal to be able to do.... when the interrupt fires.
Triggered on RMT_CHn_RX_END_INT: Triggered when the receiver has finished receiving a signal
Many thanks in advance Paul
RMT Receive ISR handler
Re: RMT Receive ISR handler
These are the basic code elements I tried but without any success
/* RMT receiver */
#define RMT_RX_ACTIVE_LEVEL 1 // Data bit is active high
#define RMT_RX_CHANNEL 0 // RMT channel for receiver
#define RMT_RX_GPIO_NUM GPIO_NUM_4 // GPIO number for receiver
#define RMT_CLK_DIV 100 // RMT counter clock divider
#define RMT_TICK_10_US (80000000/RMT_CLK_DIV/100000) // RMT counter value for 10 us.(Source clock is APB clock)
#define rmt_item32_tIMEOUT_US 60 // RMT receiver timeout value(us)
rmt_isr_handle_t xHandler = NULL;
static void IRAM_ATTR rmt_isr_handler(void* arg)
{
printf("rmt_isr_handler %d\n");
} // rmt_isr_handler
/*-----------------------------------------------------------*/
static void rmt_rx_init()
{
rmt_set_pin( (rmt_channel_t)RMT_RX_CHANNEL, RMT_MODE_RX, RMT_RX_GPIO_NUM);
rmt_set_mem_pd( (rmt_channel_t)RMT_RX_CHANNEL, 0);
rmt_set_clk_div( (rmt_channel_t)RMT_RX_CHANNEL, RMT_CLK_DIV);
rmt_set_source_clk( (rmt_channel_t)RMT_RX_CHANNEL, RMT_BASECLK_APB);
rmt_set_rx_filter( (rmt_channel_t)RMT_RX_CHANNEL, true, rmt_item32_tIMEOUT_US / 10 * (RMT_TICK_10_US));
rmt_set_rx_idle_thresh( (rmt_channel_t)RMT_RX_CHANNEL,60);
rmt_set_memory_owner( (rmt_channel_t)RMT_RX_CHANNEL, RMT_MEM_OWNER_RX);
rmt_set_rx_intr_en( (rmt_channel_t)RMT_RX_CHANNEL,true);
rmt_isr_register(rmt_isr_handler, NULL, ESP_INTR_FLAG_IRAM, &xHandler);
rmt_rx_start( (rmt_channel_t)RMT_RX_CHANNEL, true);
} // RMT_rx_init
/* ------------------------------------------------------ */
/* RMT receiver */
#define RMT_RX_ACTIVE_LEVEL 1 // Data bit is active high
#define RMT_RX_CHANNEL 0 // RMT channel for receiver
#define RMT_RX_GPIO_NUM GPIO_NUM_4 // GPIO number for receiver
#define RMT_CLK_DIV 100 // RMT counter clock divider
#define RMT_TICK_10_US (80000000/RMT_CLK_DIV/100000) // RMT counter value for 10 us.(Source clock is APB clock)
#define rmt_item32_tIMEOUT_US 60 // RMT receiver timeout value(us)
rmt_isr_handle_t xHandler = NULL;
static void IRAM_ATTR rmt_isr_handler(void* arg)
{
printf("rmt_isr_handler %d\n");
} // rmt_isr_handler
/*-----------------------------------------------------------*/
static void rmt_rx_init()
{
rmt_set_pin( (rmt_channel_t)RMT_RX_CHANNEL, RMT_MODE_RX, RMT_RX_GPIO_NUM);
rmt_set_mem_pd( (rmt_channel_t)RMT_RX_CHANNEL, 0);
rmt_set_clk_div( (rmt_channel_t)RMT_RX_CHANNEL, RMT_CLK_DIV);
rmt_set_source_clk( (rmt_channel_t)RMT_RX_CHANNEL, RMT_BASECLK_APB);
rmt_set_rx_filter( (rmt_channel_t)RMT_RX_CHANNEL, true, rmt_item32_tIMEOUT_US / 10 * (RMT_TICK_10_US));
rmt_set_rx_idle_thresh( (rmt_channel_t)RMT_RX_CHANNEL,60);
rmt_set_memory_owner( (rmt_channel_t)RMT_RX_CHANNEL, RMT_MEM_OWNER_RX);
rmt_set_rx_intr_en( (rmt_channel_t)RMT_RX_CHANNEL,true);
rmt_isr_register(rmt_isr_handler, NULL, ESP_INTR_FLAG_IRAM, &xHandler);
rmt_rx_start( (rmt_channel_t)RMT_RX_CHANNEL, true);
} // RMT_rx_init
/* ------------------------------------------------------ */
Re: RMT Receive ISR handler
Whats about calling it like this?
Code: Select all
rmt_isr_handle_t xHandler = NULL;
void IRAM_ATTR rmt_isr_handler(void* arg){
...
}
rmt_config_t config;
config.rmt_mode = RMT_MODE_RX;
config.channel = (rmt_channel_t) _channel;
config.gpio_num = (gpio_num_t)pin;
config.mem_block_num = 1; //how many memory blocks 64 x N (0-7)
config.rx_config.filter_en = true;
config.rx_config.filter_ticks_thresh = 100;
config.rx_config.idle_threshold = 9500;
config.clk_div = 80; //1MHz
ESP_ERROR_CHECK(rmt_config(&config));
rmt_set_rx_intr_en( config.channel,true);
rmt_isr_register(rmt_isr_handler, NULL, ESP_INTR_FLAG_LEVEL1, &xHandler);
//ESP_ERROR_CHECK(rmt_driver_install(config.channel, 100, 0));
rmt_rx_start(config.channel, 1);
Who is online
Users browsing this forum: akasaka_spk and 72 guests