1133|6

2941

帖子

4

TA的资源

五彩晶圆(中级)

楼主
 

ESP32C3丢失JTGA模式故障求助 [复制链接]

我的Beetle ESP32-C3开发板在烧写正常的烧写完程序后就失去了JTAG串口,导致无法使用。从新拔插开发板,可以听到提示音,但是无法识别设备,但是设备工作正常。

 

可以ping通设备

 

故障过程的控制台输出,

G:\eeworld\esp32c3\test\mqtt\tcp>idf.py -p COM11 flash
Executing action: flash
Running ninja in directory G:\eeworld\esp32c3\test\mqtt\tcp\build
Executing "ninja flash"...
[1/5] cmd.exe /C "cd /D G:\eeworld\esp32c3\test\mqtt\tcp\b...e.bin G:/eeworld/esp32c3/test/mqtt/tcp/build/mqtt_tcp.bin"
mqtt_tcp.bin binary size 0xe6bd0 bytes. Smallest app partition is 0x100000 bytes. 0x19430 bytes (10%) free.
[1/1] cmd.exe /C "cd /D G:\eeworld\esp32c3\test\mqtt\tcp\b...rld/esp32c3/test/mqtt/tcp/build/bootloader/bootloader.bin"
Bootloader binary size 0x5170 bytes. 0x2e90 bytes (36%) free.
[2/3] cmd.exe /C "cd /D C:\Espressif\frameworks\esp-idf-v5...00 mqtt_tcp.bin 0x8000 partition_table/partition-table.bin
esptool.py v4.7.0
Serial port COM11
Connecting...
Chip is ESP32-C3 (QFN32) (revision v0.3)
Features: WiFi, BLE, Embedded Flash 4MB (XMC)
Crystal is 40MHz
MAC: 84:f7:03:a7:96:38
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00005fff...
Flash will be erased from 0x00010000 to 0x000f6fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Compressed 20848 bytes to 12752...
Writing at 0x00000000... (100 %)
Wrote 20848 bytes (12752 compressed) at 0x00000000 in 0.4 seconds (effective 452.7 kbit/s)...
Hash of data verified.
Compressed 945104 bytes to 545594...
Writing at 0x00010000... (2 %)
Writing at 0x0001dda2... (5 %)
Writing at 0x00027554... (8 %)
Writing at 0x0002c3be... (11 %)
Writing at 0x0003455e... (14 %)
Writing at 0x0003c643... (17 %)
Writing at 0x00042baf... (20 %)
Writing at 0x0004a111... (23 %)
Writing at 0x00051afa... (26 %)
Writing at 0x00058bcf... (29 %)
Writing at 0x0005fd95... (32 %)
Writing at 0x000661ae... (35 %)
Writing at 0x0006cabd... (38 %)
Writing at 0x000735da... (41 %)
Writing at 0x00079b8f... (44 %)
Writing at 0x000800e3... (47 %)
Writing at 0x0008612a... (50 %)
Writing at 0x0008c203... (52 %)
Writing at 0x00092071... (55 %)
Writing at 0x000983ce... (58 %)
Writing at 0x0009e91a... (61 %)
Writing at 0x000a487f... (64 %)
Writing at 0x000ab583... (67 %)
Writing at 0x000b23e3... (70 %)
Writing at 0x000b9435... (73 %)
Writing at 0x000c0607... (76 %)
Writing at 0x000c6c67... (79 %)
Writing at 0x000ccb1d... (82 %)
Writing at 0x000d326a... (85 %)
Writing at 0x000d91d8... (88 %)
Writing at 0x000df6ab... (91 %)
Writing at 0x000e7812... (94 %)
Writing at 0x000ee3ae... (97 %)
Writing at 0x000f4aac... (100 %)
Wrote 945104 bytes (545594 compressed) at 0x00010000 in 7.5 seconds (effective 1007.1 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 103...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.1 seconds (effective 394.0 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
ool_py && C:\Espressif\tools\cmake\3.24.0\bin\cmake.exe -D IDF_PATH=C:/Espressif/frameworks/esp-idf-v5.2.1 -D SERIAL_TOOL=C:/Espressif/python_env/idf5.2_py3.11_env/Scripts/python.exe;;C:/Espressif/frameworks/esp-idf-v5.2.1/components/esptool_py/esptool/esptool.py;--chip;esp32c3 -D SERIAL_TOOL_ARGS=--before=default_reset;--after=hard_reset;write_flash;@flash_args -D WORKING_DIRECTORY=G:/eeworld/esp32c3/test/mqtt/tcp/build -P C:/Espressif/frameworks/esp-idf-v5.2.1/components/esptool_py/run_serial_tool.cmake"
Done

G:\eeworld\esp32c3\test\mqtt\tcp>idf.py -p COM11 monitor
Executing action: monitor
Running idf_monitor in directory G:\eeworld\esp32c3\test\mqtt\tcp
Executing "C:\Espressif\python_env\idf5.2_py3.11_env\Scripts\python.exe C:\Espressif\frameworks\esp-idf-v5.2.1\tools/idf_monitor.py -p COM11 -b 115200 --toolchain-prefix riscv32-esp-elf- --target esp32c3 --revision 3 --decode-panic backtrace G:\eeworld\esp32c3\test\mqtt\tcp\build\mqtt_tcp.elf --force-color -m 'C:\Espressif\python_env\idf5.2_py3.11_env\Scripts\python.exe' 'C:\Espressif\frameworks\esp-idf-v5.2.1\tools\idf.py' '-p' 'COM11'"...
--- WARNING: GDB cannot open serial ports accessed as COMx
--- Using \\.\COM11 instead...
--- esp-idf-monitor 1.4.0 on \\.\COM11 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
could not open port '\\\\.\\COM11': FileNotFoundError(2, '系统找不到指定的文件。', None, 2)
Connection to \\.\COM11 failed. Available ports:
COM1
COM3

引起故障的程序代码,GPIO_OUTPUT_0和GPIO_OUTPUT_1的配置是我加的。

menu "Example Configuration"

    config BROKER_URL
        string "Broker URL"
        default "mqtt://mqtt.eclipseprojects.io"
        help
            URL of the broker to connect to

    config BROKER_URL_FROM_STDIN
        bool
        default y if BROKER_URL = "FROM_STDIN"

    config GPIO_OUTPUT_0
        int "GPIO output pin 0"
        range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
        default 8 if IDF_TARGET_ESP32C2 || IDF_TARGET_ESP32H2
        default 18
        help
            GPIO pin number to be used as GPIO_OUTPUT_IO_0.
    
    config GPIO_OUTPUT_1
        int "GPIO output pin 1"
        range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
        default 9 if IDF_TARGET_ESP32C2 || IDF_TARGET_ESP32H2
        default 19
        help
            GPIO pin number to be used as GPIO_OUTPUT_IO_1.
        
endmenu

主程序的代码,程序中的GPIO部分是我增加的,参考代码是:MQTT->TCP例程。

/* MQTT (over TCP) 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 <stdint.h>
#include <stddef.h>
#include <string.h>
#include "esp_wifi.h"
#include "esp_system.h"
#include "nvs_flash.h"
#include "esp_event.h"
#include "esp_netif.h"
#include "protocol_examples_common.h"

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "freertos/queue.h"

#include "lwip/sockets.h"
#include "lwip/dns.h"
#include "lwip/netdb.h"

#include "esp_log.h"
#include "mqtt_client.h"

#include "driver/gpio.h"

#define GPIO_OUTPUT_IO_0    CONFIG_GPIO_OUTPUT_0
#define GPIO_OUTPUT_IO_1    CONFIG_GPIO_OUTPUT_1

#define GPIO_OUTPUT_PIN_SEL  ((1ULL<<GPIO_OUTPUT_IO_0) | (1ULL<<GPIO_OUTPUT_IO_1))

static const char *TAG = "mqtt_example";


static void log_error_if_nonzero(const char *message, int error_code)
{
    if (error_code != 0) {
        ESP_LOGE(TAG, "Last error %s: 0x%x", message, error_code);
    }
}

/*
 * [url=home.php?mod=space&uid=159083]@brief[/url] Event handler registered to receive MQTT events
 *
 *  This function is called by the MQTT client event loop.
 *
 * @param handler_args user data registered to the event.
 * @param base Event base for the handler(always MQTT Base in this example).
 * @param event_id The id for the received event.
 * @param event_data The data for the event, esp_mqtt_event_handle_t.
 */
static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data)
{
    ESP_LOGD(TAG, "Event dispatched from event loop base=%s, event_id=%" PRIi32 "", base, event_id);
    esp_mqtt_event_handle_t event = event_data;
    esp_mqtt_client_handle_t client = event->client;
    int msg_id;
    switch ((esp_mqtt_event_id_t)event_id) {
    case MQTT_EVENT_CONNECTED:
        ESP_LOGI(TAG, "MQTT_EVENT_CONNECTED");
        msg_id = esp_mqtt_client_publish(client, "/topic/qos1", "data_3", 0, 1, 0);
        ESP_LOGI(TAG, "sent publish successful, msg_id=%d", msg_id);

        msg_id = esp_mqtt_client_subscribe(client, "/topic/qos0", 0);
        ESP_LOGI(TAG, "sent subscribe successful, msg_id=%d", msg_id);

        msg_id = esp_mqtt_client_subscribe(client, "/topic/qos1", 1);
        ESP_LOGI(TAG, "sent subscribe successful, msg_id=%d", msg_id);

        msg_id = esp_mqtt_client_unsubscribe(client, "/topic/qos1");
        ESP_LOGI(TAG, "sent unsubscribe successful, msg_id=%d", msg_id);
        break;
    case MQTT_EVENT_DISCONNECTED:
        ESP_LOGI(TAG, "MQTT_EVENT_DISCONNECTED");
        break;

    case MQTT_EVENT_SUBSCRIBED:
        ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d", event->msg_id);
        msg_id = esp_mqtt_client_publish(client, "/topic/qos0", "data", 0, 0, 0);
        ESP_LOGI(TAG, "sent publish successful, msg_id=%d", msg_id);
        break;
    case MQTT_EVENT_UNSUBSCRIBED:
        ESP_LOGI(TAG, "MQTT_EVENT_UNSUBSCRIBED, msg_id=%d", event->msg_id);
        break;
    case MQTT_EVENT_PUBLISHED:
        ESP_LOGI(TAG, "MQTT_EVENT_PUBLISHED, msg_id=%d", event->msg_id);
        break;
    case MQTT_EVENT_DATA:
        ESP_LOGI(TAG, "MQTT_EVENT_DATA");
        printf("TOPIC=%.*s\r\n", event->topic_len, event->topic);
        printf("DATA=%.*s\r\n", event->data_len, event->data);
        break;
    case MQTT_EVENT_ERROR:
        ESP_LOGI(TAG, "MQTT_EVENT_ERROR");
        if (event->error_handle->error_type == MQTT_ERROR_TYPE_TCP_TRANSPORT) {
            log_error_if_nonzero("reported from esp-tls", event->error_handle->esp_tls_last_esp_err);
            log_error_if_nonzero("reported from tls stack", event->error_handle->esp_tls_stack_err);
            log_error_if_nonzero("captured as transport's socket errno",  event->error_handle->esp_transport_sock_errno);
            ESP_LOGI(TAG, "Last errno string (%s)", strerror(event->error_handle->esp_transport_sock_errno));

        }
        break;
    default:
        ESP_LOGI(TAG, "Other event id:%d", event->event_id);
        break;
    }
}

static void mqtt_app_start(void)
{
    esp_mqtt_client_config_t mqtt_cfg = {
        .broker.address.uri = CONFIG_BROKER_URL,
    };
#if CONFIG_BROKER_URL_FROM_STDIN
    char line[128];

    if (strcmp(mqtt_cfg.broker.address.uri, "FROM_STDIN") == 0) {
        int count = 0;
        printf("Please enter url of mqtt broker\n");
        while (count < 128) {
            int c = fgetc(stdin);
            if (c == '\n') {
                line[count] = '\0';
                break;
            } else if (c > 0 && c < 127) {
                line[count] = c;
                ++count;
            }
            vTaskDelay(10 / portTICK_PERIOD_MS);
        }
        mqtt_cfg.broker.address.uri = line;
        printf("Broker url: %s\n", line);
    } else {
        ESP_LOGE(TAG, "Configuration mismatch: wrong broker url");
        abort();
    }
#endif /* CONFIG_BROKER_URL_FROM_STDIN */

    esp_mqtt_client_handle_t client = esp_mqtt_client_init(&mqtt_cfg);
    /* The last argument may be used to pass data to the event handler, in this example mqtt_event_handler */
    esp_mqtt_client_register_event(client, ESP_EVENT_ANY_ID, mqtt_event_handler, NULL);
    esp_mqtt_client_start(client);
}

void app_main(void)
{

    //zero-initialize the config structure.
    gpio_config_t io_conf = {};
    //disable interrupt
    io_conf.intr_type = GPIO_INTR_DISABLE;
    //set as output mode
    io_conf.mode = GPIO_MODE_OUTPUT;
    //bit mask of the pins that you want to set,e.g.GPIO18/19
    io_conf.pin_bit_mask = GPIO_OUTPUT_PIN_SEL;
    //disable pull-down mode
    io_conf.pull_down_en = 0;
    //disable pull-up mode
    io_conf.pull_up_en = 0;
    //configure GPIO with the given settings
    gpio_config(&io_conf);


    ESP_LOGI(TAG, "[APP] Startup..");
    ESP_LOGI(TAG, "[APP] Free memory: %" PRIu32 " bytes", esp_get_free_heap_size());
    ESP_LOGI(TAG, "[APP] IDF version: %s", esp_get_idf_version());

    esp_log_level_set("*", ESP_LOG_INFO);
    esp_log_level_set("mqtt_client", ESP_LOG_VERBOSE);
    esp_log_level_set("mqtt_example", ESP_LOG_VERBOSE);
    esp_log_level_set("transport_base", ESP_LOG_VERBOSE);
    esp_log_level_set("esp-tls", ESP_LOG_VERBOSE);
    esp_log_level_set("transport", ESP_LOG_VERBOSE);
    esp_log_level_set("outbox", ESP_LOG_VERBOSE);

    ESP_ERROR_CHECK(nvs_flash_init());
    ESP_ERROR_CHECK(esp_netif_init());
    ESP_ERROR_CHECK(esp_event_loop_create_default());

    /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.
     * Read "Establishing Wi-Fi or Ethernet Connection" section in
     * examples/protocols/README.md for more information about this function.
     */
    ESP_ERROR_CHECK(example_connect());

    mqtt_app_start();
}

曾试图将rst引脚接地拔插设备。故障不能回复。

此帖出自单片机论坛

最新回复

楼上的说的对,我之前就是不小心用了JTAG口,导致功能失效,你看看你程序是不是用了GPIO4567,我当时因为程序原因,解决不了,最后是重烧的固件   详情 回复 发表于 2024-4-9 14:47
点赞 关注
 

回复
举报

2941

帖子

4

TA的资源

五彩晶圆(中级)

沙发
 

我的开发板没有RST和BOOT按钮

此帖出自单片机论坛

点评

印象中Beetle ESP32-C的BOOT和RST是引出了焊片的,可以用镊子短连。  详情 回复 发表于 2024-4-9 12:15
 
 

回复

6106

帖子

4

TA的资源

版主

板凳
 

引起JTAG失效一般是IO口冲突吧。是不是用了那几个IO?


此帖出自单片机论坛
 
 
 

回复

6106

帖子

4

TA的资源

版主

4
 

你可以先用简单代码测试


此帖出自单片机论坛
 
 
 

回复

1万

帖子

24

TA的资源

版主

5
 
bigbat 发表于 2024-4-9 10:04 我的开发板没有RST和BOOT按钮

印象中Beetle ESP32-C的BOOT和RST是引出了焊片的,可以用镊子短连。

此帖出自单片机论坛
 
 
 

回复

707

帖子

0

TA的资源

纯净的硅(高级)

6
 

楼上的说的对,我之前就是不小心用了JTAG口,导致功能失效,你看看你程序是不是用了GPIO4567,我当时因为程序原因,解决不了,最后是重烧的固件

此帖出自单片机论坛
 
 
 

回复

2941

帖子

4

TA的资源

五彩晶圆(中级)

7
 

故障已排除,将GPIO9拉低到GND,重启系统。

故障原因是配置问题,使用配置了引脚GPIO9,对于C3这个引脚是不能使用的。使用idf.py menuconfig重新配置既可以

 config GPIO_OUTPUT_0
        int "GPIO output pin 0"
        range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
        default 8 if IDF_TARGET_ESP32C2 || IDF_TARGET_ESP32H2
        default 18
        help
            GPIO pin number to be used as GPIO_OUTPUT_IO_0.
    
    config GPIO_OUTPUT_1
        int "GPIO output pin 1"
        range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
        default 9 if IDF_TARGET_ESP32C2 || IDF_TARGET_ESP32H2
        default 19
        help
            GPIO pin number to be used as GPIO_OUTPUT_IO_1.

 

 

此帖出自单片机论坛
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
推荐帖子
浅析嵌入式程序设计中的优化问题

嵌入式系统由于受功耗、成本和体积等因素的制约,嵌入式微处理器的处理能力与桌面系统处理器相比也存在较大差距,故嵌入式系统对 ...

TI科学家谈浮点DSP未来发展

自十多年前浮点数字信号处理器(DSP)诞生以来,便为实时信号处理提供了算术上更为先进的备选方案。不过,定点器件至今仍是业界的 ...

电子设计竞赛系列指导之一--控制器的选择

本帖最后由 paulhyde 于 2014-9-15 04:02 编辑 22186

各大论坛经典帖子收藏

目 录 1. 硬件工程师值多少钱. 2 2. 决定高薪的细节守则. 2 3. 公司绝不会告诉你的20大秘密(一). 4 4. 公司 ...

正弦振荡电路杂谈(一)

        正弦振荡电路杂谈(一)         文氏电桥振荡电路及其限幅   本《正弦振荡杂谈》系列帖,并非要把 ...

Kicad 3d显示的时候会出现好几个白色的圈圈,这表示什么?

各位大神好,Kicad 3d显示的时候会出现好几个白色的圈圈,这表示什么? 489288

PCB及PCB LAYOUT(干货分享)

503014 503103 503102 503101 503100 503099 503098 503097 503096 503095 503094 503093 ...

求一款三极管的替代

我的可调电源里用的这款UTC的2SD880坏了,现在买不到同型号的器件 ,如果想用其它三极管替代应该注意哪些参数? 687366 ...

TI MSPM0L1306 LaunchPad体验08:内部温度传感器出厂校准误差有200多摄氏度?

尝试用MSPM0L1306芯片内部温度传感器测量温度,并和外置的热敏电阻读数对比。 热敏电阻的温度换算,在 TI MSPM0L1306 Lau ...

读书入围名单: 2024新书《换道赛车:新能源汽车的中国道路》

感谢网友关注2024新书《换道赛车:新能源汽车的中国道路》阅读活动,以下是入围网友信息。 第二批围的网友请注意,请在20 ...

关闭
站长推荐上一条 1/8 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表