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
Who is online
Users browsing this forum: No registered users and 135 guests