Announcement

Collapse
No announcement yet.

Announcement

Collapse
No announcement yet.

STM to ESP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • STM to ESP

    Hi
    This is a generator program working on STM32, maybe someone know how to make it working on ESP32 ?
    Right now I have compiling error - libmaple/dma.h - this library is for ARM processor not for ESP.

    HTML Code:
    //+++++++++++++++++++++++++++++++++++++++
    #define SAMPLES 130 // frequency adjustment
    //+++++++++++++++++++++++++++++++++++++++
    #include <libmaple/dma.h>
    dma_tube_config dma_cfg, dma_cfg2;
    int flag = 0;
    int flag1 = 0;
    int out1 = PB7;
    int val1[SAMPLES];
    
    int16 shift = 0;
    
    int amp = 40;
    int cnt = 0;
    int time_track = 0;
    float stp = 6.2831 / SAMPLES;
    int ret = 17;
    
    //timer_dev *dev = PIN_MAP[out].timer_device;
    //uint8 cc_channel = PIN_MAP[out].timer_channel;
    timer_dev *dev1 = PIN_MAP[out1].timer_device;
    uint8 cc_channel1 = PIN_MAP[out1].timer_channel;
    
    void fun()
    {
      flag++;
    }
    void fun1()
    {
      flag1++;
    }
    
    void timer_conf()
    {
      /////////////
    //  timer_dma_set_base_addr(dev, TIMER_DMA_BASE_CCR2);
      timer_dma_set_burst_len(dev1, 1);
    //  timer_dma_enable_req(dev, cc_channel1);
    //  timer_set_reload(dev, 102);
    //  timer_set_prescaler(dev, 0);
      ///////////////
      timer_dma_set_base_addr(dev1, TIMER_DMA_BASE_CCR2);
      timer_dma_set_burst_len(dev1, 1);
      timer_dma_enable_req(dev1, cc_channel1);
      timer_set_reload(dev1, 102);
      timer_set_prescaler(dev1, 0);
    }
    
    void dma_conf()
    {
      dma_init(DMA1);
      /* T4C2 DMA C4 */
    //  dma_cfg.tube_dst = &(dev->regs.gen->DMAR);
      dma_cfg.tube_dst = &(dev1->regs.gen->DMAR);
      dma_cfg.tube_dst_size = DMA_SIZE_32BITS;
    //  dma_cfg.tube_src = val;
      dma_cfg.tube_src = val1;
      dma_cfg.tube_src_size = DMA_SIZE_32BITS;
      dma_cfg.tube_nr_xfers = SAMPLES;
      dma_cfg.tube_flags = DMA_CFG_SRC_INC | DMA_CFG_CIRC | DMA_CFG_CMPLT_IE;
      dma_cfg.tube_req_src = DMA_REQ_SRC_TIM4_CH1;
      dma_cfg.tube_req_src = DMA_REQ_SRC_TIM4_CH2;
      dma_cfg.target_data = 0;
    
      ret = dma_tube_cfg(DMA1, DMA_CH4, &dma_cfg);
    }
    
    void dma_start()
    {
      dma_attach_interrupt(DMA1, DMA_CH4, fun);
      dma_enable(DMA1, DMA_CH4);
      timer_resume(dev1);
      dma_enable(DMA1, DMA_CH1);
      dma_enable(DMA1, DMA_CH2);
    
    }
    
    void init_wave()
    {
      int i;
      for (i = 0; i < SAMPLES; i++)
      {
    //    val[i] = 40 + amp * sin(stp * i);
        val1[i] = 40 + amp * sin(stp * i);
        //////////////
    
      }
    }
    
    void setup()
    {
      pinMode(LED_BUILTIN, OUTPUT);
    
      int i;
      pinMode(out1, PWM);
    
      // pinMode(out1, OUTPUT);
      timer_conf();
      dma_conf();
      dma_start();
      init_wave();
    }
    
    void loop()
    
    {
    
    
    }​

  • #2
    Arduino IDE version. "Lite" version.
    (The ESP32 does not support DMA PWM directly from the Arduino IDE)


    Code:
    #define SAMPLES 130
    #define PWM_PIN 25  // GPIO pin za PWM izlaz
    
    int val1[SAMPLES];
    int amp = 40;
    float stp = 6.2831 / SAMPLES;
    
    hw_timer_t *timer = NULL;
    volatile int sample_index = 0;
    
    void IRAM_ATTR onTimer() {
      // Postavi PWM duty ciklus iz sinusnog niza
      ledcWrite(0, val1[sample_index]);
      sample_index = (sample_index + 1) % SAMPLES;
    }
    
    void init_wave() {
      for (int i = 0; i < SAMPLES; i++) {
        val1[i] = 40 + amp * sin(stp * i);  // PWM duty vrednosti (0–80)
      }
    }
    
    void setup() {
      init_wave();
    
      // PWM podešavanje: kanal 0, frekvencija 20kHz, 8-bit rezolucija
      ledcSetup(0, 20000, 8);
      ledcAttachPin(PWM_PIN, 0);
    
      // Tajmer: 80 MHz / 80 = 1 MHz (1 µs tick), prekid na 50 µs → 20 kHz / 130 ≈ 154 Hz signal
      timer = timerBegin(0, 80, true); // timer 0, preskaler 80, count up
      timerAttachInterrupt(timer, &onTimer, true);
      timerAlarmWrite(timer, 50, true);  // 50 µs perioda
      timerAlarmEnable(timer);
    }
    
    void loop() {
      // You can poke your  nose here...  or do something with LCD... anything...
    }
    ​​

    Comment


    • #3
      Mo' better blues...

      main/sin_pwm_dma.c


      Code:
      #include "freertos/FreeRTOS.h"
      #include "freertos/task.h"
      #include "driver/ledc.h"
      #include "esp_timer.h"
      #include "math.h"
      
      #define SAMPLES     130
      #define PWM_PIN     25
      #define TIMER_US    50          // 50 µs → 20 kHz update rate
      #define PWM_RES     8           // 8-bit resolution (0–255)
      #define PWM_FREQ    20000       // Base PWM frequency
      
      static uint32_t sin_table[SAMPLES];
      static volatile int sample_index = 0;
      
      void IRAM_ATTR timer_callback(void* arg) {
          ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, sin_table[sample_index]);
          ledc_update_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0);
          sample_index = (sample_index + 1) % SAMPLES;
      }
      
      void init_sin_table() {
          float step = 2 * M_PI / SAMPLES;
          for (int i = 0; i < SAMPLES; i++) {
              // Duty values centered around 40 with amplitude of 40 → range: 0–80
              sin_table[i] = 40 + 40 * sinf(step * i);
          }
      }
      
      void app_main(void)
      {
          init_sin_table();
      
          // Configure LEDC (PWM) timer
          ledc_timer_config_t ledc_timer = {
              .duty_resolution = PWM_RES,
              .freq_hz = PWM_FREQ,
              .speed_mode = LEDC_HIGH_SPEED_MODE,
              .timer_num = LEDC_TIMER_0,
              .clk_cfg = LEDC_AUTO_CLK
          };
          ledc_timer_config(&ledc_timer);
      
          // Configure LEDC channel (PWM output)
          ledc_channel_config_t ledc_channel = {
              .channel    = LEDC_CHANNEL_0,
              .duty       = 0,
              .gpio_num   = PWM_PIN,
              .speed_mode = LEDC_HIGH_SPEED_MODE,
              .hpoint     = 0,
              .timer_sel  = LEDC_TIMER_0
          };
          ledc_channel_config(&ledc_channel);
      
          // Create and start high-resolution periodic timer
          const esp_timer_create_args_t periodic_timer_args = {
              .callback = &timer_callback,
              .name = "sin_pwm_timer"
          };
          esp_timer_handle_t periodic_timer;
          esp_timer_create(&periodic_timer_args, &periodic_timer);
          esp_timer_start_periodic(periodic_timer, TIMER_US);  // every 50 µs
      }
      ​
      main/CMakeLists.txt:
      idf_component_register(SRCS "sin_pwm_dma.c" INCLUDE_DIRS "")​



      your_project/
      ├── main/
      │ └── sin_pwm_dma.c
      ├── CMakeLists.txt
      ├── sdkconfig
      └── ...


      P.S.
      In ESP-IDF there is no direct DMA to PWM — instead a timer interrupt + DMA buffer is used as a workaround.

      Comment


      • #4
        Post #3 , compiling error
        HTML Code:
        eo:10:17: error: invalid conversion from 'int' to 'ledc_timer_bit_t' [-fpermissive]
           10 | #define PWM_RES 8          // 8-bit resolution (0–255)
              |                 ^
              |                 |
              |                 int
        C:\Users\Galinka\Documents\Arduino\geo\geo.ino:36:28: note: in expansion of macro 'PWM_RES'
           36 |         .duty_resolution = PWM_RES,
              |                            ^~~~~~~
        geo:41:5: error: designator order for field 'ledc_timer_config_t::speed_mode' does not match declaration order in 'ledc_timer_config_t'
           41 |     };
              |     ^
        geo:52:5: error: designator order for field 'ledc_channel_config_t::gpio_num' does not match declaration order in 'ledc_channel_config_t'
           52 |     };
              |     ^
        C:\Users\Galinka\Documents\Arduino\geo\geo.ino: At global scope:
        geo:64:1: error: '​' does not name a type
           64 | ​
              |  
        exit status 1
        invalid conversion from 'int' to 'ledc_timer_bit_t' [-fpermissive]
        ​

        Comment


        • #5
          Post #2 , compiling error

          HTML Code:
          geo:27:3: error: 'ledcSetup' was not declared in this scope
             27 |   ledcSetup(0, 20000, 8);
                |   ^~~~~~~~~
          geo:28:3: error: 'ledcAttachPin' was not declared in this scope; did you mean 'ledcAttach'?
             28 |   ledcAttachPin(PWM_PIN, 0);
                |   ^~~~~~~~~~~~~
                |   ledcAttach
          geo:31:21: error: too many arguments to function 'hw_timer_t* timerBegin(uint32_t)'
             31 |   timer = timerBegin(0, 80, true); // timer 0, preskaler 80, count up
                |           ~~~~~~~~~~^~~~~~~~~~~~~
          In file included from C:\Users\Galinka\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.3\cores\esp32/esp32-hal.h:98,
                           from C:\Users\Galinka\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.3\cores\esp32/Arduino.h:45,
                           from C:\Users\Galinka\AppData\Local\Temp\arduino_build_126458\sketch\geo.ino.cpp:1:
          C:\Users\Galinka\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.3\cores\esp32/esp32-hal-timer.h:35:13: note: declared here
             35 | hw_timer_t *timerBegin(uint32_t frequency);
                |             ^~~~~~~~~~
          geo:32:23: error: too many arguments to function 'void timerAttachInterrupt(hw_timer_t*, void (*)())'
             32 |   timerAttachInterrupt(timer, &onTimer, true);
                |   ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
          C:\Users\Galinka\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.3\cores\esp32/esp32-hal-timer.h:50:6: note: declared here
             50 | void timerAttachInterrupt(hw_timer_t *timer, void (*userFunc)(void));
                |      ^~~~~~~~~~~~~~~~~~~~
          geo:33:3: error: 'timerAlarmWrite' was not declared in this scope; did you mean 'timerWrite'?
             33 |   timerAlarmWrite(timer, 50, true);  // 50 µs perioda
                |   ^~~~~~~~~~~~~~~
                |   timerWrite
          geo:34:3: error: 'timerAlarmEnable' was not declared in this scope; did you mean 'timerAlarm'?
             34 |   timerAlarmEnable(timer);
                |   ^~~~~~~~~~~~~~~~
                |   timerAlarm
          C:\Users\Galinka\Documents\Arduino\geo\geo.ino: At global scope:
          geo:40:1: error: '​​' does not name a type
             40 | ​​
                |  
          exit status 1
          'ledcSetup' was not declared in this scope
          Invalid library found in C:\Users\Galinka\Documents\Arduino\libraries\ST7565-LCD-master: no headers files (.h) found in C:\Users\Galinka\Documents\Arduino\libraries\ST7565-LCD-master
          ​

          Comment


          • #6
            Ok you picked "lite" approach, let's workaround it.
            Select "ESP32 Dev Module" from the menu Tools → Board.
            Include the <math.h> library if sin() does not work:

            #include <math.h>​

            Code:
            #define SAMPLES 130
            #define PWM_PIN 25
            
            int val1[SAMPLES];
            int amp = 40;
            float stp = 6.2831 / SAMPLES;
            
            hw_timer_t *timer = NULL;
            volatile int sample_index = 0;
            
            void IRAM_ATTR onTimer() {
              ledcWrite(0, val1[sample_index]);
              sample_index = (sample_index + 1) % SAMPLES;
            }
            
            void init_wave() {
              for (int i = 0; i < SAMPLES; i++) {
                val1[i] = 40 + amp * sin(stp * i); // duty: 0–80 (8-bit)
              }
            }
            
            void setup() {
              init_wave();
            
              // PWM setup (kanal 0, 20kHz, 8-bit)
              ledcSetup(0, 20000, 8);
              ledcAttachPin(PWM_PIN, 0);
            
              // Timer interrupt svakih 50 µs
              timer = timerBegin(0, 80, true);                 // 1 MHz (80 MHz / 80)
              timerAttachInterrupt(timer, onTimer);            // bez 3. parametra
              timerAlarmWrite(timer, 50, true);                // 50 µs perioda
              timerAlarmEnable(timer);
            }
            
            void loop() {
              // ništa ne radi — sve u interruptu
            }

            Comment


            • #7
              This error:
              Invalid library found in C:\Users\Galinka\Documents\Arduino\libraries\ST756 5-LCD-master: no headers files (.h)
              it's not related to PWM — it's a poorly installed library.

              Comment


              • #8
                google - ledcSetup - people have problem with it, so I have to use something else,but I don't know what

                Comment


                • #9
                  I have this program, two sine wave channels, I need to add 2 more square wave channels

                  HTML Code:
                  #include "driver/i2s.h"
                  
                  #define SAMPLE_RATE 400000
                  //#define WAVEFORM_SAMPLES 256            //3kHz
                  //#define WAVEFORM_SAMPLES 100            // 8kHz
                  #define WAVEFORM_SAMPLES 50               //16 kHz
                  
                  uint8_t stereo_buffer[WAVEFORM_SAMPLES * 2];
                  uint8_t wave_data1[WAVEFORM_SAMPLES];
                  uint8_t wave_data2[WAVEFORM_SAMPLES];
                  ///////////////////
                  //const float amp = 127.5; // Half of the max value (255/2)
                  const float amp = 60;
                  const float stp = 0.1;  // Step size for the sine wave
                  float i = 0;
                  ///////////////////
                  void generateWaveforms() {
                    for (int i = 0; i < WAVEFORM_SAMPLES; i++) {
                     // wave_data1[i] = (uint8_t)((255 * i) / WAVEFORM_SAMPLES);
                      //wave_data2[i] = (uint8_t)(127.5 * (1 + sin(2 * 3.14159 * i / WAVEFORM_SAMPLES)));
                       wave_data1[i] = (uint8_t)(amp + amp * sin(stp * i));
                          wave_data2[i] = (uint8_t)(amp + amp * sin(stp * i));
                     // int dutyCycle = (int)(amp + amp * sin(stp * i)); // Calculate the duty cycle
                    }
                    for (int i = 0; i < WAVEFORM_SAMPLES; i++) {
                      stereo_buffer[i * 2] = wave_data1[i];      // DAC1
                      stereo_buffer[i * 2 + 1] = wave_data2[i];  // DAC2
                    }
                  }
                  
                  void setup() {
                    Serial.begin(115200);
                    generateWaveforms();
                  
                    i2s_config_t i2s_config = {
                      .mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN),
                      .sample_rate = SAMPLE_RATE,
                      .bits_per_sample = I2S_BITS_PER_SAMPLE_8BIT,
                      .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
                      .communication_format = I2S_COMM_FORMAT_I2S_MSB,
                      .intr_alloc_flags = 0,
                      .dma_buf_count = 8,
                      .dma_buf_len = WAVEFORM_SAMPLES * 2,
                      .use_apll = false,
                    };
                  
                    i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL);
                    i2s_set_pin(I2S_NUM_0, NULL);
                    i2s_set_dac_mode(I2S_DAC_CHANNEL_BOTH_EN);
                    i2s_set_sample_rates(I2S_NUM_0, i2s_config.sample_rate);
                  }
                  
                  void loop() {
                    size_t bytes_written;
                    i2s_write(I2S_NUM_0, stereo_buffer, sizeof(stereo_buffer), &bytes_written, portMAX_DELAY);
                  }​

                  Comment


                  • #10
                    Sometimes ESP32 Arduino core versions have bugs or partial support.
                    Some older or custom board cores don't implement full ledc API.
                    Conflicts with libraries or misconfigured board selection.
                    ESP32 Arduino core includes a compatibility analogWrite() function since recent versions.
                    This wraps ledc PWM under the hood, but simpler to call.
                    It’s easier and less error-prone for basic PWM.
                    You might need a recent ESP32 Arduino core (1.0.6 or newer) for analogWrite().


                    Code:
                    #define PWM_PIN 25
                    #define SAMPLES 130
                    
                    int val1[SAMPLES];
                    int amp = 40;
                    float stp = 6.2831 / SAMPLES;
                    volatile int sample_index = 0;
                    
                    hw_timer_t *timer = NULL;
                    
                    void IRAM_ATTR onTimer() {
                      analogWrite(PWM_PIN, val1[sample_index]);
                      sample_index = (sample_index + 1) % SAMPLES;
                    }
                    
                    void init_wave() {
                      for (int i = 0; i < SAMPLES; i++) {
                        val1[i] = 40 + amp * sin(stp * i);  // values 0-80
                      }
                    }
                    
                    void setup() {
                      pinMode(PWM_PIN, OUTPUT);
                      init_wave();
                    
                      timer = timerBegin(0, 80, true);       // 1 MHz
                      timerAttachInterrupt(timer, onTimer);
                      timerAlarmWrite(timer, 50, true);      // 50 us
                      timerAlarmEnable(timer);
                    }
                    
                    void loop() {
                      // nothing here, PWM updated in ISR, poke your nose again
                    }
                    
                    ​

                    Comment


                    • #11
                      Maybe this can be used ?
                      HTML Code:
                      #include <driver/ledc.h>
                      
                      void setup() {
                          
                          ledc_timer_config_t timerConfig = {
                              .speed_mode = LEDC_LOW_SPEED_MODE,
                              .duty_resolution = LEDC_TIMER_10_BIT,
                              .timer_num = LEDC_TIMER_0,
                              .freq_hz = 9975,
                              .clk_cfg = LEDC_AUTO_CLK
                          };
                          ledc_timer_config(&timerConfig);
                      
                          
                          ledc_channel_config_t channelConfig1 = {
                              .gpio_num = 12,
                              .speed_mode = LEDC_LOW_SPEED_MODE,
                              .channel = LEDC_CHANNEL_0,
                              .timer_sel = LEDC_TIMER_0,
                              .duty = 512,
                              .hpoint = 0
                          };
                          ledc_channel_config(&channelConfig1);
                      
                        
                          ledc_channel_config_t channelConfig2 = {
                              .gpio_num = 14,
                              .speed_mode = LEDC_LOW_SPEED_MODE,
                              .channel = LEDC_CHANNEL_1,
                              .timer_sel = LEDC_TIMER_0,
                              .duty = 512,
                              .hpoint = 0 // 0 deg
                          };
                          ledc_channel_config(&channelConfig2);
                          
                      
                       
                      }
                      void loop() {}​

                      Comment


                      • #12
                        Originally posted by pito View Post
                        I have this program, two sine wave channels, I need to add 2 more square wave channels

                        HTML Code:
                        #include "driver/i2s.h"
                        
                        #define SAMPLE_RATE 400000
                        //#define WAVEFORM_SAMPLES 256 //3kHz
                        //#define WAVEFORM_SAMPLES 100 // 8kHz
                        #define WAVEFORM_SAMPLES 50 //16 kHz
                        
                        uint8_t stereo_buffer[WAVEFORM_SAMPLES * 2];
                        uint8_t wave_data1[WAVEFORM_SAMPLES];
                        uint8_t wave_data2[WAVEFORM_SAMPLES];
                        ///////////////////
                        //const float amp = 127.5; // Half of the max value (255/2)
                        const float amp = 60;
                        const float stp = 0.1; // Step size for the sine wave
                        float i = 0;
                        ///////////////////
                        void generateWaveforms() {
                        for (int i = 0; i < WAVEFORM_SAMPLES; i++) {
                        // wave_data1[i] = (uint8_t)((255 * i) / WAVEFORM_SAMPLES);
                        //wave_data2[i] = (uint8_t)(127.5 * (1 + sin(2 * 3.14159 * i / WAVEFORM_SAMPLES)));
                        wave_data1[i] = (uint8_t)(amp + amp * sin(stp * i));
                        wave_data2[i] = (uint8_t)(amp + amp * sin(stp * i));
                        // int dutyCycle = (int)(amp + amp * sin(stp * i)); // Calculate the duty cycle
                        }
                        for (int i = 0; i < WAVEFORM_SAMPLES; i++) {
                        stereo_buffer[i * 2] = wave_data1[i]; // DAC1
                        stereo_buffer[i * 2 + 1] = wave_data2[i]; // DAC2
                        }
                        }
                        
                        void setup() {
                        Serial.begin(115200);
                        generateWaveforms();
                        
                        i2s_config_t i2s_config = {
                        .mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN),
                        .sample_rate = SAMPLE_RATE,
                        .bits_per_sample = I2S_BITS_PER_SAMPLE_8BIT,
                        .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
                        .communication_format = I2S_COMM_FORMAT_I2S_MSB,
                        .intr_alloc_flags = 0,
                        .dma_buf_count = 8,
                        .dma_buf_len = WAVEFORM_SAMPLES * 2,
                        .use_apll = false,
                        };
                        
                        i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL);
                        i2s_set_pin(I2S_NUM_0, NULL);
                        i2s_set_dac_mode(I2S_DAC_CHANNEL_BOTH_EN);
                        i2s_set_sample_rates(I2S_NUM_0, i2s_config.sample_rate);
                        }
                        
                        void loop() {
                        size_t bytes_written;
                        i2s_write(I2S_NUM_0, stereo_buffer, sizeof(stereo_buffer), &bytes_written, portMAX_DELAY);
                        }​
                        The built-in ESP32 DAC supports only 2 channels (DAC1 on GPIO25 and DAC2 on GPIO26).
                        Your current code outputs two channels (left and right) to those two DACs.
                        If you want to output 4 separate waveforms simultaneously from the ESP32 built-in DAC, hardware limitations apply — only 2 DAC channels available.

                        Comment


                        • #13
                          Is there a special reason for I2S?

                          Comment


                          • #14
                            post #10 error
                            HTML Code:
                            C:\Users\Galinka\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.3\cores\esp32/esp32-hal-timer.h:35:13: note: declared here
                               35 | hw_timer_t *timerBegin(uint32_t frequency);
                                  |             ^~~~~~~~~~
                            geo:28:3: error: 'timerAlarmWrite' was not declared in this scope; did you mean 'timerWrite'?
                               28 |   timerAlarmWrite(timer, 50, true);      // 50 us
                                  |   ^~~~~~~~~~~~~~~
                                  |   timerWrite
                            geo:29:3: error: 'timerAlarmEnable' was not declared in this scope; did you mean 'timerAlarm'?
                               29 |   timerAlarmEnable(timer);
                                  |   ^~~~~~~~~~~~~~~~
                                  |   timerAlarm
                            C:\Users\Galinka\Documents\Arduino\geo\geo.ino: At global scope:
                            geo:36:1: error: '​' does not name a type
                               36 | ​
                                  |  
                            exit status 1
                            too many arguments to function 'hw_timer_t* timerBegin(uint32_t)'​

                            Comment


                            • #15
                              Originally posted by ivconic View Post

                              The built-in ESP32 DAC supports only 2 channels (DAC1 on GPIO25 and DAC2 on GPIO26).
                              Your current code outputs two channels (left and right) to those two DACs.
                              If you want to output 4 separate waveforms simultaneously from the ESP32 built-in DAC, hardware limitations apply — only 2 DAC channels available.
                              2 sin and 2 suare, square do not need DAC.

                              Comment

                              Working...
                              X