Page 1 of 1

ESP32 RMT " sync manager not supported"

Posted: Thu Oct 17, 2024 8:48 am
by horace99
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
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3. #include <unistd.h>
  4. // ESP32 RMT 1KHz three phase square wave  sync test
  5.  
  6. // on ESP32 the ESP32S3 code gives message
  7. // ESP32S3 RMT !KHz three phase sync test
  8. // setting up channel 0
  9. // E (324) rmt: rmt_new_tx_channel(247): mem_block_symbols must be even and at least 64
  10. // ESP_ERROR_CHECK failed: esp_err_t 0x102 (ESP_ERR_INVALID_ARG) at 0x400d631e
  11.  
  12.  
  13. #include "driver/rmt_tx.h"
  14.  
  15. void app_main(void)
  16. {
  17. //    while (true) {
  18.  //       printf("Hello from app_main!\n");
  19.  //       sleep(1);
  20.  //   }
  21.  printf("ESP32 RMT !KHz three phase sync test\n");
  22.   //delay(2000);
  23.   // setup Tx channels
  24.   rmt_channel_handle_t tx_channels[3] = { NULL };
  25.   gpio_num_t tx_gpio_number[3] = { GPIO_NUM_16, GPIO_NUM_17, GPIO_NUM_18 };  // pin numbers
  26.   for (int i = 0; i < 3; i++) {
  27.     printf("setting up channel %d\n", i);
  28.     rmt_tx_channel_config_t tx_chan_config = {
  29.       .gpio_num = tx_gpio_number[i],
  30.       .clk_src = RMT_CLK_SRC_DEFAULT,
  31.       .resolution_hz = 1 * 1000 * 1000,  // 1MHz clock
  32. //#if 0
  33.       .mem_block_symbols = 64,        // for ESP32
  34. //#endif
  35.  //     .mem_block_symbols = 48,    
  36.        .trans_queue_depth = 1,
  37.     };
  38.     ESP_ERROR_CHECK(rmt_new_tx_channel(&tx_chan_config, &tx_channels[i]));
  39.   }
  40.   rmt_transmit_config_t transmitConfig = {
  41.     .loop_count = -1
  42.   };
  43.   rmt_encoder_handle_t copyEncoder =NULL;
  44.   rmt_copy_encoder_config_t copyEncoderConfig = {};
  45.   assert(rmt_new_copy_encoder(&copyEncoderConfig, &copyEncoder) == ESP_OK && "Failed to Create Copy Encoder");
  46.   ESP_ERROR_CHECK(rmt_enable(tx_channels[2]));
  47.   ESP_ERROR_CHECK(rmt_enable(tx_channels[1]));
  48.   ESP_ERROR_CHECK(rmt_enable(tx_channels[0]));
  49.  
  50.   // setup sync manage for the three pulses
  51.   rmt_sync_manager_handle_t synchro = NULL;
  52.   rmt_sync_manager_config_t synchro_config = {
  53.     .tx_channel_array = tx_channels,
  54.     .array_size = sizeof(tx_channels) / sizeof(tx_channels[0]),
  55.   };
  56.   ESP_ERROR_CHECK(rmt_new_sync_manager(&synchro_config, &synchro));
  57.  
  58.   printf("Starting Transmitters\n");
  59.   // setup pulse patterns - clock is 1MHz
  60.   // two 200KHz pulses 40% duty cycle
  61.   const rmt_symbol_word_t pulsePattern1[] = {
  62.     { .duration0 = 500, .level0 = 1, .duration1 = 500, .level1 = 0 },
  63.   };
  64.   const rmt_symbol_word_t pulsePattern2[] = {
  65.     { .duration0 = 333, .level0 = 0, .duration1 = 500, .level1 = 1 },
  66.     { .duration0 = 100, .level0 = 0, .duration1 = 67, .level1 = 0 },
  67.   };
  68.     const rmt_symbol_word_t pulsePattern3[] = {
  69.     { .duration0 = 133, .level0 = 1, .duration1 = 500, .level1 = 0 },
  70.     { .duration0 = 100, .level0 = 1, .duration1 = 267, .level1 = 1 },
  71.   };
  72.  
  73.   assert(rmt_transmit(tx_channels[0], copyEncoder, &pulsePattern1, sizeof(pulsePattern1), &transmitConfig) == ESP_OK && "Failed to begin transmitting");
  74.   assert(rmt_transmit(tx_channels[1], copyEncoder, &pulsePattern2, sizeof(pulsePattern2), &transmitConfig) == ESP_OK && "Failed to begin transmitting");
  75.   assert(rmt_transmit(tx_channels[2], copyEncoder, &pulsePattern3, sizeof(pulsePattern3), &transmitConfig) == ESP_OK && "Failed to begin transmitting");
  76.   printf("Transmitters Running\n");
  77. }
terminal displays
  1. ESP32 RMT !KHz three phase sync test
  2. setting up channel 0
  3. I (324) gpio: GPIO[16]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
  4. setting up channel 1
  5. I (334) gpio: GPIO[17]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
  6. setting up channel 2
  7. I (344) gpio: GPIO[18]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
  8. E (354) rmt: rmt_new_sync_manager(400): sync manager not supported
  9. ESP_ERROR_CHECK failed: esp_err_t 0x106 (ESP_ERR_NOT_SUPPORTED) at 0x400d63b3
  10. file: "./main/main.c" line 56
  11. func: app_main
  12. expression: rmt_new_sync_manager(&synchro_config, &synchro)
  13.  
  14. abort() was called at PC 0x40085dbf on core 0
is the sync manager not supported on the ESP32?

Re: ESP32 RMT " sync manager not supported"

Posted: Thu Oct 17, 2024 10:57 am
by nopnop2002
>is the sync manager not supported on the ESP32?

Yes.

ESP32 does not support sync manager.

Code: Select all

$ grep -rn "#define SOC_RMT_SUPPORT_TX_SYNCHRO" esp-idf/components/soc/*
esp32c3/include/soc/soc_caps.h:248:#define SOC_RMT_SUPPORT_TX_SYNCHRO            1  /*!< Support coordinate a group of TX channels to start simultaneously */
esp32c5/mp/include/soc/soc_caps.h:314:#define SOC_RMT_SUPPORT_TX_SYNCHRO            1  /*!< Support coordinate a group of TX channels to start simultaneously */
esp32c5/beta3/include/soc/soc_caps.h:319:#define SOC_RMT_SUPPORT_TX_SYNCHRO            1  /*!< Support coordinate a group of TX channels to start simultaneously */
esp32c6/include/soc/soc_caps.h:316:#define SOC_RMT_SUPPORT_TX_SYNCHRO            1  /*!< Support coordinate a group of TX channels to start simultaneously */
esp32c61/include/soc/soc_caps.h:311:#define SOC_RMT_SUPPORT_TX_SYNCHRO            1  /*!< Support coordinate a group of TX channels to start simultaneously */
esp32h2/include/soc/soc_caps.h:310:#define SOC_RMT_SUPPORT_TX_SYNCHRO            1  /*!< Support coordinate a group of TX channels to start simultaneously */
esp32p4/include/soc/soc_caps.h:380:#define SOC_RMT_SUPPORT_TX_SYNCHRO            1  /*!< Support coordinate a group of TX channels to start simultaneously */
esp32s2/include/soc/soc_caps.h:264:#define SOC_RMT_SUPPORT_TX_SYNCHRO            1  /*!< Support coordinate a group of TX channels to start simultaneously */
esp32s3/include/soc/soc_caps.h:275:#define SOC_RMT_SUPPORT_TX_SYNCHRO            1  /*!< Support coordinate a group of TX channels to start simultaneously

Re: ESP32 RMT " sync manager not supported"

Posted: Thu Oct 17, 2024 11:48 am
by horace99
Thanks for confirming that the ESP32 does not support sync manager.

thought it worth checking in case it was something in my code