Fix UsbDm and UsbDp for Gpio19 and Gpio20 (#1764)

GPIO pins 19 and 20 had USB D- and D+ swapped. This change fixes which pin is which USB data line according to the pin descriptions in the ESP32-S2 and ESP32-S3 data sheets (sections 2.2 and 2.3.2 respectively). Since these GpioPins are only used by Usb for lifetime tracking, and UsbDp and UsbDm are always used as a pair, this change is only semantic and doesn't affect functionality.
This commit is contained in:
Grant Moyer 2024-07-08 09:37:57 -04:00 committed by GitHub
parent 253b013c2a
commit dfe628c53d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7 additions and 6 deletions

View File

@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix `sleep_light` for ESP32-C6 (#1720)
- ROM Functions: Fix address of `ets_update_cpu_frequency_rom` (#1722)
- Fix `regi2c_*` functions for `esp32h2` (#1737)
- EESP32-S2 / ESP32-S3: Fix UsbDm and UsbDp for Gpio19 and Gpio20
### Changed

View File

@ -555,5 +555,5 @@ impl InterruptStatusRegisterAccess for InterruptStatusRegisterAccessBank1 {
}
// implement marker traits on USB pins
impl crate::otg_fs::UsbDp for Gpio19 {}
impl crate::otg_fs::UsbDm for Gpio20 {}
impl crate::otg_fs::UsbDm for Gpio19 {}
impl crate::otg_fs::UsbDp for Gpio20 {}

View File

@ -489,5 +489,5 @@ impl InterruptStatusRegisterAccess for InterruptStatusRegisterAccessBank1 {
}
// implement marker traits on USB pins
impl crate::otg_fs::UsbDp for Gpio19 {}
impl crate::otg_fs::UsbDm for Gpio20 {}
impl crate::otg_fs::UsbDm for Gpio19 {}
impl crate::otg_fs::UsbDp for Gpio20 {}

View File

@ -39,7 +39,7 @@ async fn main(_spawner: Spawner) -> () {
esp_hal_embassy::init(&clocks, TimerGroup::new_async(peripherals.TIMG0, &clocks));
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
let usb = Usb::new(peripherals.USB0, io.pins.gpio19, io.pins.gpio20);
let usb = Usb::new(peripherals.USB0, io.pins.gpio20, io.pins.gpio19);
// Create the driver, from the HAL.
let mut ep_out_buffer = [0u8; 1024];

View File

@ -27,7 +27,7 @@ fn main() -> ! {
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
let usb = Usb::new(peripherals.USB0, io.pins.gpio19, io.pins.gpio20);
let usb = Usb::new(peripherals.USB0, io.pins.gpio20, io.pins.gpio19);
let usb_bus = UsbBus::new(usb, unsafe { &mut *addr_of_mut!(EP_MEMORY) });
let mut serial = SerialPort::new(&usb_bus);