The code was based on a post that was based on Kolban's ESP32 book and is copied below.
When I attempt to run the code, the processor continually resets.
Code: Select all
#include <stdio.h>
#include "driver/rmt.h"
#include "freertos/freeRTOS.h"
#include "freertos/task.h"
rmt_config_t config;
rmt_item32_t items[1];
#define RMT_GPIO GPIO_NUM_18
static void rmt_tx_init(void)
{
config.rmt_mode = RMT_MODE_TX;
config.channel = RMT_CHANNEL_0;
config.gpio_num = RMT_GPIO;
config.mem_block_num = 1;
config.tx_config.loop_en = 0;
config.tx_config.carrier_en = 0;
config.tx_config.idle_output_en = 1;
config.tx_config.idle_level = RMT_IDLE_LEVEL_LOW;
config.tx_config.carrier_level = RMT_CARRIER_LEVEL_HIGH;
config.clk_div = 80; // 80MHx / 80 = 1MHz 0r 1uS per count
rmt_config(rmt_config(&config));
rmt_driver_install(config.channel, 0, 0); // rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size, int rmt_intr_num)
items[0].duration0 = 977;
items[0].level0 = 1;
items[0].duration1 = 977;
items[0].level1 = 0;
items[1].duration0 = 0;
items[1].level0 = 1;
items[1].duration1 = 0;
items[1].level1 = 0;
}
void do_test(void)
{
rmt_write_items(config.channel, items, 2,true);
}
void app_main(void)
{
rmt_tx_init();
while(1)
{
do_test();
vTaskDelay(1000/portTICK_PERIOD_MS);
}
}