Skip to content

Commit

Permalink
usb: On rm0455/rm0468 parts, pins PA11/PA12 can be in analog mode
Browse files Browse the repository at this point in the history
See pinouts in part datasheets. To use these pins for USB, it's not necessary to
switch them to an alternate function: the USB D-/D+ pins are functional when the
GPIO state is analog. Tested on a STM32H7A3ZIT6
  • Loading branch information
richardeoin committed Oct 22, 2023
1 parent 9c596cd commit 6114a5d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## [Unreleased]

* usb: On RM0455 and RM0468 parts, PA11/PA12 do not have an alternate function
(AF) for USB

## [v0.15.0] 2023-10-09

* Remove unused `bitflags` dependency
Expand Down
2 changes: 1 addition & 1 deletion examples/usb_rtic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ mod app {
#[cfg(any(feature = "rm0455", feature = "rm0468"))]
let (pin_dm, pin_dp) = {
let gpioa = ctx.device.GPIOA.split(ccdr.peripheral.GPIOA);
(gpioa.pa11.into_alternate(), gpioa.pa12.into_alternate())
(gpioa.pa11, gpioa.pa12)
};

let led = ctx.device.GPIOE.split(ccdr.peripheral.GPIOE).pe1;
Expand Down
6 changes: 3 additions & 3 deletions src/usb_hs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use crate::rcc;
use crate::stm32;

use crate::gpio::{self, Alternate, Speed};
use crate::gpio::{self, Alternate, Analog, Speed};

use crate::time::Hertz;

Expand Down Expand Up @@ -50,8 +50,8 @@ impl USB1 {
usb_global: stm32::OTG1_HS_GLOBAL,
usb_device: stm32::OTG1_HS_DEVICE,
usb_pwrclk: stm32::OTG1_HS_PWRCLK,
_pin_dm: gpio::PA11<Alternate<10>>,
_pin_dp: gpio::PA12<Alternate<10>>,
_pin_dm: gpio::PA11<Analog>,
_pin_dp: gpio::PA12<Analog>,
prec: rcc::rec::Usb1Otg,
clocks: &rcc::CoreClocks,
) -> Self {
Expand Down

0 comments on commit 6114a5d

Please sign in to comment.