Switching to v4.3, some errors related to gpio

mrdebug
Posts: 43
Joined: Sat Jul 27, 2019 8:26 am

Switching to v4.3, some errors related to gpio

Postby mrdebug » Fri May 07, 2021 12:39 pm

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?

RichPiano
Posts: 123
Joined: Mon May 18, 2020 2:51 pm

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

Postby RichPiano » Fri May 07, 2021 4:01 pm

Have you included the necessary files? adc_types.h and gpio_types.h should be included somehow, maybe indirectly.

mrdebug
Posts: 43
Joined: Sat Jul 27, 2019 8:26 am

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

Postby mrdebug » Mon May 10, 2021 5:39 am

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

RichPiano
Posts: 123
Joined: Mon May 18, 2020 2:51 pm

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

Postby RichPiano » Mon May 10, 2021 8:44 am

That doesn't include anything though. Can you post your full code?

mrdebug
Posts: 43
Joined: Sat Jul 27, 2019 8:26 am

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

Postby mrdebug » Tue May 11, 2021 1:09 pm

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'?

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

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

Postby WiFive » Tue May 11, 2021 5:20 pm

Seems like your target is set to esp32s2

mrdebug
Posts: 43
Joined: Sat Jul 27, 2019 8:26 am

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

Postby mrdebug » Wed May 12, 2021 7:46 am

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.

Who is online

Users browsing this forum: No registered users and 89 guests