LEDC (hpoint, demo issues)

bkgoodman
Posts: 45
Joined: Fri Feb 17, 2017 12:41 pm

LEDC (hpoint, demo issues)

Postby bkgoodman » Mon Nov 07, 2022 6:23 pm

I'm building and running the stock led fade example. It doesn't seem to be working correctly.

Biggest question is the two set-duty examples are supposed to set it to "0" and "test". But in both cases they do 50/50 duty cycle all the time. This is true for BOTH tests.

The other weird issue is that the fade examples go from 0 to about 50% - but never above that.

Documentation is a little unclear on what the min/maxes should be. Also - the docs don't say what "hpoint" is (though changing it didn't seem to fix).

Any advice??

bkgoodman
Posts: 45
Joined: Fri Feb 17, 2017 12:41 pm

Re: LEDC (hpoint, demo issues)

Postby bkgoodman » Mon Nov 07, 2022 7:28 pm

P.S. It seems as when I set the max duty cycle to 8192 - that made the "fade" work full scale (0% to 100% PWM).

But that actually help reveal that the following code doesn't seem to be doing anything:

Code: Select all

        printf("3. LEDC set duty = %d without fade\n", LEDC_TEST_DUTY);
        for (ch = 0; ch < LEDC_TEST_CH_NUM; ch++) {
            ESP_ERROR_CHECK_WITHOUT_ABORT(ledc_set_duty(ledc_channel[ch].speed_mode, ledc_channel[ch].channel, LEDC_TEST_DUTY));
            ESP_ERROR_CHECK_WITHOUT_ABORT(ledc_update_duty(ledc_channel[ch].speed_mode, ledc_channel[ch].channel));
        }
        vTaskDelay(5000 / portTICK_PERIOD_MS);

        printf("4. LEDC set duty = 0 without fade\n");
        for (ch = 0; ch < LEDC_TEST_CH_NUM; ch++) {
            ESP_ERROR_CHECK_WITHOUT_ABORT(ledc_set_duty(ledc_channel[ch].speed_mode, ledc_channel[ch].channel, 0));
            ESP_ERROR_CHECK_WITHOUT_ABORT(ledc_update_duty(ledc_channel[ch].speed_mode, ledc_channel[ch].channel));
        }


Who is online

Users browsing this forum: No registered users and 224 guests