ESP32 RMT " sync manager not supported"
Posted: Thu Oct 17, 2024 8:48 am
following on from post "ESP32S3 RMT "no free tx channels" opening third channel" https://esp32.com/viewtopic.php?f=13&t=42301 where a solution was found attempting to run code on an ESP32 with esp-idf-v5.3.1
terminal displays
is the sync manager not supported on the ESP32?
- #include <stdio.h>
- #include <stdbool.h>
- #include <unistd.h>
- // ESP32 RMT 1KHz three phase square wave sync test
- // on ESP32 the ESP32S3 code gives message
- // ESP32S3 RMT !KHz three phase sync test
- // setting up channel 0
- // E (324) rmt: rmt_new_tx_channel(247): mem_block_symbols must be even and at least 64
- // ESP_ERROR_CHECK failed: esp_err_t 0x102 (ESP_ERR_INVALID_ARG) at 0x400d631e
- #include "driver/rmt_tx.h"
- void app_main(void)
- {
- // while (true) {
- // printf("Hello from app_main!\n");
- // sleep(1);
- // }
- printf("ESP32 RMT !KHz three phase sync test\n");
- //delay(2000);
- // setup Tx channels
- rmt_channel_handle_t tx_channels[3] = { NULL };
- gpio_num_t tx_gpio_number[3] = { GPIO_NUM_16, GPIO_NUM_17, GPIO_NUM_18 }; // pin numbers
- for (int i = 0; i < 3; i++) {
- printf("setting up channel %d\n", i);
- rmt_tx_channel_config_t tx_chan_config = {
- .gpio_num = tx_gpio_number[i],
- .clk_src = RMT_CLK_SRC_DEFAULT,
- .resolution_hz = 1 * 1000 * 1000, // 1MHz clock
- //#if 0
- .mem_block_symbols = 64, // for ESP32
- //#endif
- // .mem_block_symbols = 48,
- .trans_queue_depth = 1,
- };
- ESP_ERROR_CHECK(rmt_new_tx_channel(&tx_chan_config, &tx_channels[i]));
- }
- rmt_transmit_config_t transmitConfig = {
- .loop_count = -1
- };
- rmt_encoder_handle_t copyEncoder =NULL;
- rmt_copy_encoder_config_t copyEncoderConfig = {};
- assert(rmt_new_copy_encoder(©EncoderConfig, ©Encoder) == ESP_OK && "Failed to Create Copy Encoder");
- ESP_ERROR_CHECK(rmt_enable(tx_channels[2]));
- ESP_ERROR_CHECK(rmt_enable(tx_channels[1]));
- ESP_ERROR_CHECK(rmt_enable(tx_channels[0]));
- // setup sync manage for the three pulses
- rmt_sync_manager_handle_t synchro = NULL;
- rmt_sync_manager_config_t synchro_config = {
- .tx_channel_array = tx_channels,
- .array_size = sizeof(tx_channels) / sizeof(tx_channels[0]),
- };
- ESP_ERROR_CHECK(rmt_new_sync_manager(&synchro_config, &synchro));
- printf("Starting Transmitters\n");
- // setup pulse patterns - clock is 1MHz
- // two 200KHz pulses 40% duty cycle
- const rmt_symbol_word_t pulsePattern1[] = {
- { .duration0 = 500, .level0 = 1, .duration1 = 500, .level1 = 0 },
- };
- const rmt_symbol_word_t pulsePattern2[] = {
- { .duration0 = 333, .level0 = 0, .duration1 = 500, .level1 = 1 },
- { .duration0 = 100, .level0 = 0, .duration1 = 67, .level1 = 0 },
- };
- const rmt_symbol_word_t pulsePattern3[] = {
- { .duration0 = 133, .level0 = 1, .duration1 = 500, .level1 = 0 },
- { .duration0 = 100, .level0 = 1, .duration1 = 267, .level1 = 1 },
- };
- assert(rmt_transmit(tx_channels[0], copyEncoder, &pulsePattern1, sizeof(pulsePattern1), &transmitConfig) == ESP_OK && "Failed to begin transmitting");
- assert(rmt_transmit(tx_channels[1], copyEncoder, &pulsePattern2, sizeof(pulsePattern2), &transmitConfig) == ESP_OK && "Failed to begin transmitting");
- assert(rmt_transmit(tx_channels[2], copyEncoder, &pulsePattern3, sizeof(pulsePattern3), &transmitConfig) == ESP_OK && "Failed to begin transmitting");
- printf("Transmitters Running\n");
- }
- ESP32 RMT !KHz three phase sync test
- setting up channel 0
- I (324) gpio: GPIO[16]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
- setting up channel 1
- I (334) gpio: GPIO[17]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
- setting up channel 2
- I (344) gpio: GPIO[18]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
- E (354) rmt: rmt_new_sync_manager(400): sync manager not supported
- ESP_ERROR_CHECK failed: esp_err_t 0x106 (ESP_ERR_NOT_SUPPORTED) at 0x400d63b3
- file: "./main/main.c" line 56
- func: app_main
- expression: rmt_new_sync_manager(&synchro_config, &synchro)
- abort() was called at PC 0x40085dbf on core 0