[Thing Plus ESP32 WROOM U.FL] Not Responding to Input Signal Connected to GPIO33

I am actually using the registers directly using C and the ESP-IDF build system as opposed to the Arduino setup. Currently I have 5 momentary buttons connected directly to the GPIO with 10k ohm pull-down resistors.

The pushbuttons are connected as follows:

button0 (Red) GPIO32

button1 (Yellow) GPIO33

button2 (Green) GPIO12

button3 (Blue) GPIO13

button4 (Black) GPIO36

I am also using the Digilent Analog Discovery 2 with Waveforms application to verify my signals for the buttons. Each button has been verified to produce the correct signal based on pushing a button and releasing it. When I retrieve the data output from the GPIO_IN_REG and GPIO_IN1_REG as appropriate, I noticed that all button inputs except the yellow one had been processed. I know that the button color is immaterial, but it just seemed like it might be easier to identify them for this discussion. Just to verify that the jumper wires were connected properly, I momentarily tested the circuit using the internal pull-down resistors and removing the external pull-down resistors.

All IO_MUX registers for the 5 GPIO pins have been configured to use GPIO function and have been set with input enabled.

I made sure to clear bits 17 and 18 of the RTCIO_XTAL_32K_PAD_REG register which correspond to the XTAL_P and XTAL_N respectively to route the pads to the IO_MUX instead of the RTC according to the technical reference manual linked below:

https://www.espressif.com/sites/default … ual_en.pdf

I seem to be at a loss as I am unable to find what is preventing the signal connected to the GPIO33 pin from reaching the GPIO_IN1_REG. I assumed that routing the XTAL_P and XTAL_N signals to the IO_MUX would have been enough. Does the community have a suggestion of what to try?

I will also try checking with the ESP32.com forum as soon as I receive the activation email.

According to one of the moderators on the ESP32.com forum a potential hardware error is suspect… if there is no software solution available via either forum, is there a way I could get an RMA replacement for this?

Could you provide the link to the ESP32 post you are referring to?

I can’t think of a solution for you at this exact moment and maybe digging into it further might shed some light on what the issue might be on a hardware level.

https://esp32.com/viewtopic.php?f=13&t=21525

TS-John:
Could you provide the link to the ESP32 post you are referring to?

I can’t think of a solution for you at this exact moment and maybe digging into it further might shed some light on what the issue might be on a hardware level.

I included the link above in the previous response.

Yeah, I have been banging my head over this… for the post on their forum I used the built-in ESP-IDF libraries and I got the same results by the way. Currently awaiting approval from my latest response… Approvals for posts on that forum seem to go rather slow unfortunately.

Actually upon further investigation there was a cold solder joint on the pin that allowed the pin to slide and not make contact with the board like it should.

The test code for output was:

#include "driver/gpio.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/timers.h"
#include "freertos/queue.h"
#include "esp_log.h"
#include <sys/time.h>
#define PIN_TO_TEST GPIO_NUM_33

static uint8_t pinState = 0x0;

void toggle_pin(TimerHandle_t pxTimer)
{
  pinState = pinState ^ 0x1;

  gpio_set_level(PIN_TO_TEST,pinState);
}
void app_main(void)
{
gpio_set_intr_type(PIN_TO_TEST,GPIO_INTR_DISABLE);  //interrupts not needed here
  gpio_set_direction(PIN_TO_TEST,GPIO_MODE_OUTPUT);  //make sure this is an output
  gpio_set_pull_mode(PIN_TO_TEST,GPIO_FLOATING);     //no need for pull up or pull down resistors for this
  gpio_wakeup_disable(PIN_TO_TEST);  //no need to have wakeup
  gpio_set_drive_capability(PIN_TO_TEST,GPIO_DRIVE_CAP_0);  //do not need a strong drive current for this test
  gpio_iomux_in(PIN_TO_TEST,SIG_GPIO_OUT_IDX); //force to be an output
  gpio_iomux_out(PIN_TO_TEST,2,false);  //use standard gpio and keep output enabled
}

for input it was:

#include "driver/gpio.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/timers.h"
#include "freertos/queue.h"
#include "esp_log.h"
#include <sys/time.h>

#define PIN_TO_TEST GPIO_NUM_33
static QueueHandle_t gpio_evt_queue = NULL;
static uint8_t pulseCount = 0;



static void IRAM_ATTR gpio_isr_handler(void* arg)
{
  static TickType_t tick[2] = {0,0};  //initialize all tick counts to 0
  TickType_t ticks;                   //used for storing elapsed ticks
   
  tick[1] = xTaskGetTickCount(); //current tick count
  ticks = tick[1] - tick[0];  //ticks elapsed
  xQueueSendFromISR(gpio_evt_queue, (void*)&ticks, NULL); //send the elapsed ticks to the measurement task
  tick[0] = tick[1];  //store current tick count into last tick count
}

static void gpio_task_measure(void* arg)
{
  TickType_t elapsedTicks;  //the elapsed ticks recovered from the interrupt service routine
  uint32_t millisecondsElapsed;  //milliseconds elapsed between interrupts
  
  for(;;) {  //repeat indefinitely
    if(xQueueReceive(gpio_evt_queue, &elapsedTicks, portMAX_DELAY)) {  //if there is any data in the event queue retrieve it
      millisecondsElapsed = elapsedTicks * portTICK_RATE_MS;  //multiply the elapsed ticks by the number of milliseconds per tick
      printf("GPIO[%d] intr, count: %d, ms elapsed: %d\n", PIN_TO_TEST, ++pulseCount,millisecondsElapsed);  //output count of rising edges and milliseconds in between
    }
  }
}

void app_main(void)
{
    gpio_evt_queue = xQueueCreate(10, sizeof(uint32_t));
    //start gpio task
    xTaskCreate(gpio_task_measure, "gpio_task_measure", 2048, NULL, 10, NULL);
ESP_LOGI("Test","Input Test -- Use Pattern Generator");
  gpio_intr_enable(PIN_TO_TEST);  //enable interrupts for pin
  gpio_set_direction(PIN_TO_TEST,GPIO_MODE_INPUT); //make sure this is an input
  gpio_set_pull_mode(PIN_TO_TEST,GPIO_PULLUP_ONLY);  //use pull up resistor
  gpio_set_intr_type(PIN_TO_TEST,GPIO_INTR_POSEDGE); //interrupt on rising edge

//install gpio isr service
    gpio_install_isr_service(ESP_INTR_FLAG_EDGE|ESP_INTR_FLAG_IRAM|ESP_INTR_FLAG_LOWMED);
gpio_isr_handler_add(PIN_TO_TEST, gpio_isr_handler, (void*) PIN_TO_TEST);  
}

to test the output use the oscilloscope or logic analyzer of the Analog Discovery 2 and read the pin. For a sanity check I tested each pin for output.

to test the input use the pattern generator of the Analog Discovery 2 to generate a clock signal. For a sanity check I also tested each pin for input.