HI everyone,
i have a application that randomly crashes the ledc pwm( only that, other parts seems to work just fine), but i have no idea how to figure out or do any debug on that issue. The application has wifi + ble enabled, and ledc, i2c peripherals working also. All works fine so it seemed until we noticed that the ledc that controls the brightness of the LED suddenly turns fully ON and loses control. The brightness of the LED is controlled via nRF app , which sends a value of 0-100 to control the brightness. The code is just copied from the standard ledc_example_main, configured as follows:
///LED PWM definitions
#define LEDC_LS_TIMER LEDC_TIMER_1
#define LEDC_LS_MODE LEDC_LOW_SPEED_MODE
#define LEDC_LS_CH2_GPIO (4) //// this is original 4
#define LEDC_LS_CH2_CHANNEL LEDC_CHANNEL_2
#define LEDC_TEST_DUTY (5000)
#define LEDC_TEST_FADE_TIME (1000)
#define LEDC_DELAY_BET_CHG (4000)
static ledc_timer_config_t ledc_timer = {
.duty_resolution = LEDC_TIMER_13_BIT, // resolution of PWM duty
.freq_hz = 5000, // frequency of PWM signal
.speed_mode = LEDC_LS_MODE, // timer mode
.timer_num = LEDC_LS_TIMER // timer index
};
static ledc_channel_config_t ledc_channel2 = {
.channel = LEDC_LS_CH2_CHANNEL,
.duty = 0,
.gpio_num = LEDC_LS_CH2_GPIO,
.speed_mode = LEDC_LS_MODE,
.hpoint = 0,
.timer_sel = LEDC_LS_TIMER
};
static void LED_ON(const ledc_channel_config_t *channel_config, int value ){
//ledc_channel_config_t temp= &channel_config ;
#ifdef DEBUG
printf("1. LEDC fade up to duty = %d\n", 50*(value));
#endif
ledc_set_fade_with_time(channel_config->speed_mode, channel_config->channel, 50*(value), LEDC_TEST_FADE_TIME);
ledc_fade_start(channel_config->speed_mode,channel_config->channel, LEDC_FADE_NO_WAIT);
//vTaskDelay(LEDC_TEST_FADE_TIME / portTICK_PERIOD_MS);
}
As seen above, the code is pretty basic and standard, nothing fancy. While fiddling with the brightness of the LED, we noticed that randomly it gets crashed when adjusting the value from 0-100 , but the ESP32 is still working normally ; the UART can still send messages indicating it is still running, while the i2c is still grabbing data and constantly pushing values to the UUID char at the nRF app.
Has anyone experienced such issues ? Any clues would be appreciated. thx
Note: (I tried to search the forum , but the search post function seems pretty dead, so had to post this rather simple issue hoping to find some help, thx)
LEDC issue
Jump to
- English Forum
- Explore
- News
- General Discussion
- FAQ
- Documentation
- Documentation
- Sample Code
- Discussion Forum
- Hardware
- ESP-IDF
- ESP-BOX
- ESP-ADF
- ESP-MDF
- ESP-WHO
- ESP-SkaiNet
- ESP32 Arduino
- IDEs for ESP-IDF
- ESP-AT
- ESP IoT Solution
- ESP RainMaker
- Rust
- ESP8266
- Report Bugs
- Showcase
- Chinese Forum 中文社区
- 活动区
- 乐鑫活动专区
- 讨论区
- 全国大学生物联网设计竞赛乐鑫答疑专区
- ESP-IDF 中文讨论版
- 《ESP32-C3 物联网工程开发实战》书籍讨论版
- ESP-AT 中文讨论版
- ESP-BOX 中文讨论版
- ESP IoT Solution 中文讨论版
- ESP-ADF 中文讨论版
- ESP Mesh 中文讨论版
- ESP Cloud 中文讨论版
- ESP-WHO 中文讨论版
- ESP-SkaiNet 中文讨论版
- ESP 生产支持讨论版
- 硬件问题讨论
- 项目展示
Who is online
Users browsing this forum: Baidu [Spider], Majestic-12 [Bot] and 126 guests
- All times are UTC
- Top
- Delete cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. ESP8266EX and ESP32 are some of our products.