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 30, 2023
1 parent 9c596cd commit 3914785
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## [Unreleased]

* Bugfix, usb: On RM0455 and RM0468 parts, PA11/PA12 do not have an alternate function
(AF) for USB. Use `into_analog()` when passing pins to `USB1/2::new` on these parts [#464]

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

* Remove unused `bitflags` dependency
Expand Down Expand Up @@ -385,3 +388,4 @@
[#451]: https://github.com/stm32-rs/stm32h7xx-hal/pull/451
[#453]: https://github.com/stm32-rs/stm32h7xx-hal/pull/453
[#456]: https://github.com/stm32-rs/stm32h7xx-hal/pull/456
[#464]: https://github.com/stm32-rs/stm32h7xx-hal/pull/464
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};

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (stable, stm32h743)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (stable, stm32h743)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (stable, stm32h743v)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (stable, stm32h743v)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / ci (stm32h743v, log-semihost)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / ci (stm32h743v, log-semihost)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (stable, stm32h747cm7)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (stable, stm32h747cm7)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (stable, stm32h753v)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (stable, stm32h753v)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / ci (stm32h743v, log-rtt)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / ci (stm32h743v, log-rtt)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / ci (stm32h743v, log-itm)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / ci (stm32h743v, log-itm)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (stable, stm32h753)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (stable, stm32h753)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (1.65.0, stm32h743)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (1.65.0, stm32h743)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (1.65.0, stm32h743v)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (1.65.0, stm32h743v)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (1.65.0, stm32h753v)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (1.65.0, stm32h753v)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (1.65.0, stm32h753)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (1.65.0, stm32h753)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (1.65.0, stm32h747cm7)

unused import: `Analog`

Check warning on line 21 in src/usb_hs.rs

View workflow job for this annotation

GitHub Actions / check (1.65.0, stm32h747cm7)

unused import: `Analog`

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 3914785

Please sign in to comment.