mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-10 04:43:33 +00:00
Merge branch 'bugfix/gpio_usb_pin_pupd' into 'master'
gpio: fix USB D+ pin cannot disable pullup Closes IDFGH-7984 See merge request espressif/esp-idf!19191
This commit is contained in:
@@ -51,6 +51,12 @@ static inline void gpio_ll_pullup_en(gpio_dev_t *hw, uint32_t gpio_num)
|
||||
*/
|
||||
static inline void gpio_ll_pullup_dis(gpio_dev_t *hw, uint32_t gpio_num)
|
||||
{
|
||||
// The pull-up value of the USB pins are controlled by the pins’ pull-up value together with USB pull-up value
|
||||
// USB DP pin is default to PU enabled
|
||||
if (gpio_num == USB_DP_GPIO_NUM) {
|
||||
SET_PERI_REG_MASK(USB_SERIAL_JTAG_CONF0_REG, USB_SERIAL_JTAG_PAD_PULL_OVERRIDE);
|
||||
CLEAR_PERI_REG_MASK(USB_SERIAL_JTAG_CONF0_REG, USB_SERIAL_JTAG_DP_PULLUP);
|
||||
}
|
||||
REG_CLR_BIT(GPIO_PIN_MUX_REG[gpio_num], FUN_PU);
|
||||
}
|
||||
|
||||
|
34
components/hal/esp32c3/include/hal/usb_phy_ll.h
Normal file
34
components/hal/esp32c3/include/hal/usb_phy_ll.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "soc/usb_serial_jtag_struct.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Configures the internal PHY for USB_Serial_JTAG
|
||||
*
|
||||
* @param hw Start address of the USB Serial_JTAG registers
|
||||
*/
|
||||
static inline void usb_phy_ll_int_jtag_enable(usb_serial_jtag_dev_t *hw)
|
||||
{
|
||||
// USB_Serial_JTAG use internal PHY
|
||||
hw->conf0.phy_sel = 0;
|
||||
// Disable software control USB D+ D- pullup pulldown (Device FS: dp_pullup = 1)
|
||||
hw->conf0.pad_pull_override = 0;
|
||||
// Enable USB D+ pullup
|
||||
hw->conf0.dp_pullup = 1;
|
||||
// Enable USB pad function
|
||||
hw->conf0.usb_pad_enable = 1;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user