ESP32 WROVER GPIO39,35,34配置问题

aureoleday
Posts: 22
Joined: Wed Dec 19, 2018 2:10 am

ESP32 WROVER GPIO39,35,34配置问题

Postby aureoleday » Thu Aug 29, 2019 8:53 am

将GPIO34,35,39初始化为数字输入,并且上拉,开机过程中串口打印如下信息:

I (319) gpio: GPIO[26]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (328) gpio: GPIO[27]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (338) gpio: GPIO[18]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
I (347) gpio: GPIO[19]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
I (356) gpio: GPIO[34]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
I (365) gpio: GPIO[35]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
I (375) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2

但是测量34,35,39引脚仍然为低电平,同样配置的18,19却是正常的高电平。请问这是哪里的问题?是因为39,35,34这些引脚不能配置为上拉么?

初始化代码如下:

10 #define PB_FREQ_D 39
11 #define PB_FREQ_U 34
12 #define PB_OUT_EN 35
13 #define PB_VOL_D 19
14 #define PB_VOL_U 18

20 #define GPIO_INPUT_PIN_SEL ((1ULL<<PB_FREQ_D) | (1ULL<<PB_FREQ_U) | (1ULL<<PB_OUT_EN) | (1ULL<<PB_VOL_D) | (1ULL<<PB_VOL_U))


103 void pb_init(void)
104 {
105 gpio_config_t io_conf;
106 //disable interrupt
107 io_conf.intr_type = GPIO_PIN_INTR_NEGEDGE;
108 //set as input mode
109 io_conf.mode = GPIO_MODE_INPUT;
110 //bit mask of the pins that you want to set,e.g.
111 io_conf.pin_bit_mask = GPIO_INPUT_PIN_SEL;
112 io_conf.pull_down_en = 0;
113 //enable pull-up mode
114 io_conf.pull_up_en = 1;
115 //configure GPIO with the given settings
116 gpio_config(&io_conf);
117
118 gpio_evt_queue = xQueueCreate(10, sizeof(uint32_t));
119
120 //install gpio isr service
121 gpio_install_isr_service(ESP_INTR_FLAG_DEFAULT);
122 //hook isr handler for specific gpio pin
123 gpio_isr_handler_add(PB_FREQ_D, gpio_isr_handler, (void*) PB_FREQ_D);
124 gpio_isr_handler_add(PB_FREQ_U, gpio_isr_handler, (void*) PB_FREQ_U);
125 gpio_isr_handler_add(PB_OUT_EN, gpio_isr_handler, (void*) PB_OUT_EN);
126 gpio_isr_handler_add(PB_VOL_D, gpio_isr_handler, (void*) PB_VOL_D);
127 gpio_isr_handler_add(PB_VOL_U, gpio_isr_handler, (void*) PB_VOL_U);
128 pb_inst.freq_index = 0;
129 pb_inst.volum_index = 0;
130 pb_inst.out_en = 0;
131 }

ESP_houwenxiang
Posts: 118
Joined: Tue Jun 26, 2018 3:09 am

Re: ESP32 WROVER GPIO39,35,34配置问题

Postby ESP_houwenxiang » Fri Oct 18, 2019 11:57 am

Hi,

IO34~IO39 只能作为输入引脚并且没有内部上拉功能. 所以需要外接上拉电阻.

谢谢 !!
wookooho

Who is online

Users browsing this forum: No registered users and 40 guests