ESP32-S3-WROOM-1 GPIO stays high for an extended period
Posted: Fri Jan 13, 2023 4:17 am
Seeing odd behavior when rapidly toggling a GPIO on the ESP32-S3-WROOM-1. There appears to be a very repeatable period where the GPIO is high for an extended period of time. The scope is configured to trigger on any pulse longer than 1uS. The code is based on the Hello World example with no changes to sdkconfig and just spins a tight loop.
Has anyone else experienced this?
Has anyone else experienced this?
- /* Hello World Example
- This example code is in the Public Domain (or CC0 licensed, at your option.)
- Unless required by applicable law or agreed to in writing, this
- software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- CONDITIONS OF ANY KIND, either express or implied.
- */
- #include <stdio.h>
- #include "sdkconfig.h"
- #include "freertos/FreeRTOS.h"
- #include "freertos/task.h"
- #include "esp_system.h"
- #include "esp_spi_flash.h"
- #include <driver/gpio.h>
- /* Private defines -----------------------------------------------------------*/
- #define CNVST_PIN 14 /* Conversion start control. */
- /* Function Definitions ------------------------------------------------------*/
- void IRAM_ATTR hw_gpio_toggle(void)
- {
- uint32_t reg_val = (1ULL << CNVST_PIN);
- do {
- REG_WRITE(GPIO_OUT_W1TS_REG, reg_val);
- REG_WRITE(GPIO_OUT_W1TC_REG, reg_val);
- } while (1);
- }
- static void hw_gpio_init(void)
- {
- gpio_config_t io_conf = {};
- uint32_t reg_val;
- /* Configure GPIO pin output level - LOW */
- reg_val = (1ULL << CNVST_PIN);
- REG_WRITE(GPIO_OUT_W1TC_REG, reg_val);
- io_conf.intr_type = GPIO_INTR_DISABLE;
- io_conf.mode = GPIO_MODE_OUTPUT;
- io_conf.pin_bit_mask = (1ULL << CNVST_PIN);
- io_conf.pull_down_en = 1;
- io_conf.pull_up_en = 0;
- ESP_ERROR_CHECK(gpio_config(&io_conf));
- }
- void app_main(void)
- {
- uint16_t recvbuf;
- printf("Hello world!\n");
- /* Print chip information */
- esp_chip_info_t chip_info;
- esp_chip_info(&chip_info);
- printf("This is %s chip with %d CPU core(s), WiFi%s%s, ",
- CONFIG_IDF_TARGET,
- chip_info.cores,
- (chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
- (chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");
- printf("silicon revision %d, ", chip_info.revision);
- printf("%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024),
- (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
- printf("Minimum free heap size: %d bytes\n", esp_get_minimum_free_heap_size());
- hw_gpio_init();
- for (;;) {
- hw_gpio_toggle();
- }
- }