What's wrong in my cod?
#include <stdio.h>
#include <stdint.h>
#define LEDC_HSTIMER0_CONF_REG 0x3FF59140
#define LEDC_HSCH0_HPOINT_REG 0x3FF59004
#define LEDC_HSCH0_DUTY_REG 0x3FF59008
#define LEDC_HSCH0_CONF0_REG 0x3FF59000
#define GPIO_FUNC18_OUT_SEL_CFG_REG 0x3FF44578
#define GPIO_ENABLE_REG 0x3FF44020
#define IO_MUX_GPIO18_REG 0x3FF49070
#define GPIO_PIN18_REG 0x3FF440D0
void app_main(void)
{
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///LEDC_CHN0///
volatile uint32_t* ledc_hstimer0_cnfg_reg = (volatile uint32_t*) LEDC_HSTIMER0_CONF_REG;
volatile uint32_t* ledc_hsch0_hpiont_reg = (volatile uint32_t*) LEDC_HSCH0_HPOINT_REG;
volatile uint32_t* ledc_hsch0_duty_reg = (volatile uint32_t*) LEDC_HSCH0_DUTY_REG;
volatile uint32_t* ledc_hsch0_conf0_reg = (volatile uint32_t*) LEDC_HSCH0_CONF0_REG;
*ledc_hstimer0_cnfg_reg |= (1 << 25); // APB_CLK SET
*ledc_hstimer0_cnfg_reg |= (0 << 24); // LEDC_HSTIMER0 RESET
*ledc_hstimer0_cnfg_reg |= (77 << 5); // DIVISION NUM_HSTIMER0
*ledc_hstimer0_cnfg_reg |= (10 << 0); // HSTIMER0 DUTY RESET
*ledc_hsch0_hpiont_reg |= (10 << 0); // LEDC HIGH POINT ON
//*ledc_hsch0_duty_reg |= (512 << 0); // LEDC DUTY VALUE
*ledc_hsch0_conf0_reg |= (1 << 2); // OUTPUT ENABLE CONTROL BIT
*ledc_hsch0_conf0_reg |= (0 << 0); // TIMER CHOOSE
*ledc_hsch0_conf0_reg |= (0 << 1); // TIMER CHOOSE
///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// GPIO_MATRIX GPIO_MUX ///
volatile uint32_t* gpio_func18_out_sel_cfg_reg = (volatile uint32_t*) GPIO_FUNC18_OUT_SEL_CFG_REG;
volatile uint32_t* gpio_enable_reg = (volatile uint32_t*) GPIO_ENABLE_REG;
volatile uint32_t* io_mux_gpio18_reg = (volatile uint32_t*) IO_MUX_GPIO18_REG;
volatile uint32_t* gpio_pin18_reg = (volatile uint32_t*) GPIO_PIN18_REG;
*gpio_func18_out_sel_cfg_reg |= (1 << 10);
*gpio_func18_out_sel_cfg_reg |= (71 << 0);
*gpio_enable_reg |= (1 << 18);
*io_mux_gpio18_reg |= (2 << 12);
*gpio_pin18_reg |= (1 << 2);
while(1) {
*ledc_hsch0_duty_reg |= (512 << 0); // LEDC DUTY VALUE
}
}
ESP-WROOM-32 LEDC_GPIO18 ESP32-D0WDQ6
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: No registered users and 36 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.