ESP32-S3 复用 JTAG 引脚 为普通引脚之后就识别不到USB口

前言

把 MTCK (GPIO39) ,接到外部设备之后,在代码里面初始化之后,就不能识别到USB口了( USB JTAG/serial debug unit)。只要不初始化这个引脚,就能够正常识别到USB口。

#define VEXT_PIN    (GPIO_NUM_39)
#define GPIO_OUTPUT_PIN_SEL (1ULL<<VEXT_PIN)
void tau_gpio_init(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);
    gpio_set_level(VEXT_PIN, 0);
}

过程

  1. 在尝试过各种方案之后,发现,错误点是在于RTC 时钟源配置错误了。目前这一款开发板是没有外部 32K 晶振的,所以在RTC时钟源哪一项选择的时候需要注意一下。
  2. RTC时钟源配置参看 ,RTC时钟配置

RTC时钟配置

idf.py menuconfig
Component config → ESP32S3-Specific → RTC clock source

这里的配置需要和具体的硬件相关联起来,比如有些开发板有外接晶振 32K ,有些就没有。有些主控是有内部 8M 晶振的, 而有些就没有内部 8M 晶振。

小结

  1. 但是这个应该不是根本原因,因为RTC时钟源配置错误,但是只要不调用复用 JTAG 引脚的函数就能正常识别到USB口,并且正常运行。
posted @ 2022-11-24 21:36  SpinJump  阅读(1254)  评论(0编辑  收藏  举报