Output mode for GPIO pins 12, 13, 14, 15 not working?

boilerbots
Posts: 2
Joined: Thu Aug 10, 2017 7:22 am

Output mode for GPIO pins 12, 13, 14, 15 not working?

Postby boilerbots » Thu Aug 10, 2017 7:34 am

I have configured 13 pins on my device to be GPIO_MODE_OUTPUT. I set the pull-up mode to FLOATING. I set the drive capability to MAX.

When I write to the set and clear registers or the data register all pins toggle except for pins 12-14.

I have tried every combination of modes and pull-ups and nothing makes this work. I used the special RTC functions to deregister these pins.

If I change the pull mode to up or down then the physical pin will change states. I even tried a brand new ESP-WROOM32 module because I thought perhaps there is a chance my first one could be defective.

I assume other people have tried all GPIO pins and they do work. My program is so simple, could the RTOS be doing something?

Here is an example of the program I am running to debug this:

Code: Select all

void app_main(void)
{
  nvs_flash_init();
  int xx;
  for (xx = 0; xx < GPIO_PIN_COUNT; xx++)
  {
    if (GPIO_IS_VALID_OUTPUT_GPIO(xx) && (xx < 6 || xx > 11))
    {
      gpio_set_direction(xx, GPIO_MODE_OUTPUT);  //Latch
    }
  }
  while(1)
  {   
      GPIO.out_w1ts = 0xFFFFFFFF;
      vTaskDelay(50 / portTICK_PERIOD_MS);
      GPIO.out_w1tc = 0xFFFFFFFF;
      vTaskDelay(50 / portTICK_PERIOD_MS);
    }
  }
}

ESP_igrr
Posts: 712
Joined: Tue Dec 01, 2015 8:37 am

Re: Output mode for GPIO pins 12, 13, 14, 15 not working?

Postby ESP_igrr » Thu Aug 10, 2017 1:38 pm

At reset, these pins are configured for JTAG function. You need to change function back to GPIO in the IO MUX to make the pins work as GPIOs. If you use GPIO driver (include "driver/gpio.h", not "rom/gpio.h"), it will configure the pin as GPIO for you, once you call gpio_config to configure the pin.

boilerbots
Posts: 2
Joined: Thu Aug 10, 2017 7:22 am

Re: Output mode for GPIO pins 12, 13, 14, 15 not working?

Postby boilerbots » Fri Aug 11, 2017 5:17 am

Looks like the missing function call is this macro, put into my configuration loop:

Code: Select all

      PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[xx], PIN_FUNC_GPIO);


That puts the pins back into GPIO mode, or I can call gpio_config() and configure everything in one call.

Now I know the problem I tried to find this in the user manual and it is not obvious. In the on-line API document there is no mention, just that GPIO 6-11 are typically used for flash. The esp-wroom-32 datasheet only mention that these pins can be JTAG pins, and the ESP32 core board schematic also isn't helpful. The ESP32 tehcnical reference manual page 46 and 47 says that the "reset" state for each pin is an input pin but it also does not make it clear or obvious that these pins default to JTAG. I guess one could assume that this would be required for JTAG to even work but again it certainly isn't made obvious to where someone searching for this problem could find it in the document.When I look at Table 17, knowing what I now know, I would then imply that the pins default to the function in the "Function 1" column of the table after reset but maybe that isn't true for all the pins.

Anyway thanks for your help, I was stuck on this simple problem, glad I went to bed instead of pulling more hair out.

Who is online

Users browsing this forum: No registered users and 2 guests