Page 1 of 1

Switching to v4.3, some errors related to gpio

Posted: Fri May 07, 2021 12:39 pm
by mrdebug
Hi, trying to compile my project with idf v4.3 I obtain these strange error:

Code: Select all

adc1_config_width(ADC_WIDTH_BIT_12);
error: 'ADC_WIDTH_BIT_12' was not declared in this scope
and

Code: Select all

new PWMOut(GPIO_NUM_25);
error: 'GPIO_NUM_25' was not declared in this scope
and

Code: Select all

new Serial(UART_NUM_2, GPIO_NUM_17, GPIO_NUM_16, 115200);
error: 'UART_NUM_2' was not declared in this scope
Have you got any suggesion for me?

Re: Switching to v4.3, some errors related to gpio

Posted: Fri May 07, 2021 4:01 pm
by RichPiano
Have you included the necessary files? adc_types.h and gpio_types.h should be included somehow, maybe indirectly.

Re: Switching to v4.3, some errors related to gpio

Posted: Mon May 10, 2021 5:39 am
by mrdebug
Sure, the row before is

Code: Select all

new DigitalInOut(GPIO_NUM_2, GPIO_MODE_OUTPUT);
and the project could be compiled without any problem with idf version a9854f7085871a0ea4e2bb6fbb54e9626fcf84a1, 2020/03/06

Re: Switching to v4.3, some errors related to gpio

Posted: Mon May 10, 2021 8:44 am
by RichPiano
That doesn't include anything though. Can you post your full code?

Re: Switching to v4.3, some errors related to gpio

Posted: Tue May 11, 2021 1:09 pm
by mrdebug
The following lines of code can be compiled with esp-idf v4.2 but not with esp-idf master or esp-idf v4.3

Code: Select all

#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "esp_log.h"
#include "led_strip.h"
#include "sdkconfig.h"
#include "driver/adc.h"
#include "driver/gpio.h"
#include "driver/uart.h"

void app_main(void)
{

    gpio_set_direction(GPIO_NUM_45, GPIO_MODE_OUTPUT);
    gpio_set_direction(GPIO_NUM_25, GPIO_MODE_OUTPUT);

	uart_config_t Config;
	uart_param_config(UART_NUM_1, &Config);
    uart_param_config(UART_NUM_2, &Config);

    adc1_config_width(ADC_WIDTH_BIT_13);
    adc1_config_width(ADC_WIDTH_BIT_12);

    while (1) {
        vTaskDelay(CONFIG_BLINK_PERIOD / portTICK_PERIOD_MS);
    }
}

Code: Select all

'GPIO_NUM_25' undeclared (first use in this function); did you mean 'GPIO_NUM_45'?
UART_NUM_2' undeclared (first use in this function); did you mean 'UART_NUM_0'?

Re: Switching to v4.3, some errors related to gpio

Posted: Tue May 11, 2021 5:20 pm
by WiFive
Seems like your target is set to esp32s2

Re: Switching to v4.3, some errors related to gpio

Posted: Wed May 12, 2021 7:46 am
by mrdebug
Changing the sdkconfig file

Code: Select all

CONFIG_IDF_CMAKE=y
CONFIG_IDF_TARGET_ARCH_XTENSA=y
CONFIG_IDF_TARGET="esp32"
CONFIG_IDF_TARGET_ESP32=y
CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000
now it is working.