esp32c3 errors ledc

maggymtac
Posts: 30
Joined: Wed Aug 04, 2021 7:47 am

esp32c3 errors ledc

Postby maggymtac » Thu Feb 17, 2022 10:55 am

Hello,

I get theses traces:

Code: Select all

22:04:15.537 -> ESP-ROM:esp32c3-api1-20210207
22:04:15.537 -> Build:Feb  7 2021
22:04:15.537 -> rst:0x1 (POWERON),boot:0xe (SPI_FAST_FLASH_BOOT)
22:04:15.570 -> SPIWP:0xee
22:04:15.570 -> mode:DIO, clock div:1
22:04:15.570 -> load:0x3fcd6100,len:0x420
22:04:15.570 -> load:0x403ce000,len:0x90c
22:04:15.570 -> load:0x403d0000,len:0x236c
22:04:15.570 -> entry 0x403ce000
22:04:15.770 -> setup---begin
22:04:15.770 -> This chip has 1 cores
22:04:21.248 -> E (5769) ledc: ledc_get_duty(501): LEDC is not initialized
22:04:21.414 -> E (5911) ledc: ledc_set_duty(481): LEDC is not initialized
22:04:21.414 -> E (5911) ledc: ledc_update_duty(409): LEDC is not initialized
22:04:21.414 -> E (5911) ledc: ledc_get_duty(501): LEDC is not initialized
22:04:21.547 -> E (6058) ledc: ledc_set_duty(481): LEDC is not initialized
22:04:21.547 -> E (6058) ledc: ledc_update_duty(409): LEDC is not initialized
22:04:21.547 -> E (6058) ledc: ledc_get_duty(501): LEDC is not initialized
22:04:21.679 -> E (6205) ledc: ledc_set_duty(481): LEDC is not initialized
22:04:21.679 -> E (6205) ledc: ledc_update_duty(409): LEDC is not initialized
22:04:21.713 -> E (6205) ledc: ledc_get_duty(501): LEDC is not initialized
22:04:21.846 -> E (6352) ledc: ledc_set_duty(481): LEDC is not initialized
22:04:21.846 -> E (6352) ledc: ledc_update_duty(409): LEDC is not initialized
22:04:21.846 -> E (6352) ledc: ledc_get_duty(501): LEDC is not initialized
22:04:21.912 -> E (6428) ledc: ledc_set_duty(481): LEDC is not initialized
22:04:21.912 -> E (6428) ledc: ledc_update_duty(409): LEDC is not initialized
22:04:21.912 -> E (6428) ledc: ledc_get_duty(501): LEDC is not initialized
22:04:22.144 -> E (6646) ledc: ledc_set_duty(481): LEDC is not initialized
22:04:22.144 -> E (6646) ledc: ledc_update_duty(409): LEDC is not initialized
22:04:22.144 -> E (6646) ledc: ledc_get_duty(501): LEDC is not initialized
22:04:22.410 -> E (6936) ledc: ledc_set_duty(481): LEDC is not initialized
22:04:22.443 -> E (6936) ledc: ledc_update_duty(409): LEDC is not initialized
22:04:22.443 -> E (6936) ledc: ledc_get_duty(501): LEDC is not initialized
22:04:22.576 -> E (7083) ledc: ledc_set_duty(481): LEDC is not initialized
22:04:22.576 -> E (7083) ledc: ledc_update_duty(409): LEDC is not initialized

Code: Select all

uint8_t buzzerPin=1;
pinMode(buzzerPin, OUTPUT);
delay(500);
for (int thisNote = 0; thisNote < notes * 2; thisNote = thisNote + 2) {

    // calculates the duration of each note
    divider = melody[thisNote + 1];
    if (divider > 0) {
      // regular note, just proceed
      noteDuration = (wholenote) / divider;
    } else if (divider < 0) {
      // dotted notes are represented with negative durations!!
      noteDuration = (wholenote) / abs(divider);
      noteDuration *= 1.5; // increases the duration in half for dotted notes
    }

    // we only play the note for 90% of the duration, leaving 10% as a pause
    tone(buzzerPin, melody[thisNote], noteDuration*0.9, BUZZER_CHANNEL);

    // Wait for the specief duration before playing the next note.
    delay(noteDuration);
    
    // stop the waveform generation before the next note.
    noTone(buzzerPin,BUZZER_CHANNEL);
  } 

I don't why, before my buzzer works, now i get theses traces and buzzer not works. I don't change my code.

Have you an idea?

Thank you.

ESP_Sprite
Posts: 9729
Joined: Thu Nov 26, 2015 4:08 am

Re: esp32c3 errors ledc

Postby ESP_Sprite » Fri Feb 18, 2022 1:22 am

Moving to Arduino as it's likely related to that.

Wilfredo
Posts: 1
Joined: Thu Nov 18, 2021 10:19 pm

Re: esp32c3 errors ledc

Postby Wilfredo » Thu Aug 04, 2022 2:15 am

The solución is to put, the led set up before we use, it is into the loop of the task for RTOS.

Who is online

Users browsing this forum: No registered users and 72 guests