Skip to content

Commit

Permalink
high speed by default for fmc, sdmmc, octospi, ulpi
Browse files Browse the repository at this point in the history
  • Loading branch information
burrbull committed Jul 1, 2023
1 parent 0bdf579 commit ecdc24b
Show file tree
Hide file tree
Showing 16 changed files with 569 additions and 730 deletions.
22 changes: 11 additions & 11 deletions examples/ethernet-nucleo-h743zi2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ extern crate cortex_m;
mod utilities;
use log::info;

use stm32h7xx_hal::ethernet::{self, TwoLanesPins, PHY};
use stm32h7xx_hal::rcc::CoreClocks;
use stm32h7xx_hal::{ethernet, ethernet::PHY};
use stm32h7xx_hal::{prelude::*, stm32, stm32::interrupt};

/// Configure SYSTICK for 1ms timebase
Expand Down Expand Up @@ -93,15 +93,15 @@ fn main() -> ! {
let mut link_led = gpiob.pb0.into_push_pull_output(); // LED1, green
link_led.set_high();

let rmii_ref_clk = gpioa.pa1.into_alternate();
let rmii_mdio = gpioa.pa2.into_alternate();
let rmii_mdc = gpioc.pc1.into_alternate();
let rmii_crs_dv = gpioa.pa7.into_alternate();
let rmii_rxd0 = gpioc.pc4.into_alternate();
let rmii_rxd1 = gpioc.pc5.into_alternate();
let rmii_tx_en = gpiog.pg11.into_alternate();
let rmii_txd0 = gpiog.pg13.into_alternate();
let rmii_txd1 = gpiob.pb13.into_alternate();
let rmii_ref_clk = gpioa.pa1;
let rmii_mdio = gpioa.pa2;
let rmii_mdc = gpioc.pc1;
let rmii_crs_dv = gpioa.pa7;
let rmii_rxd0 = gpioc.pc4;
let rmii_rxd1 = gpioc.pc5;
let rmii_tx_en = gpiog.pg11;
let rmii_txd0 = gpiog.pg13;
let rmii_txd1 = gpiob.pb13;

// Initialise ethernet...
assert_eq!(ccdr.clocks.hclk().raw(), 200_000_000); // HCLK 200MHz
Expand All @@ -115,7 +115,7 @@ fn main() -> ! {
dp.ETHERNET_MAC,
dp.ETHERNET_MTL,
dp.ETHERNET_DMA,
(
TwoLanesPins::new(
rmii_ref_clk,
rmii_mdio,
rmii_mdc,
Expand Down
26 changes: 15 additions & 11 deletions examples/ethernet-rtic-stm32h735g-dk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ use smoltcp::iface::{Config, Interface, SocketSet, SocketStorage};
use smoltcp::time::Instant;
use smoltcp::wire::{HardwareAddress, IpAddress, IpCidr};

use stm32h7xx_hal::{ethernet, rcc::CoreClocks, stm32};
use stm32h7xx_hal::{
ethernet::{self, TwoLanesPins},
rcc::CoreClocks,
stm32,
};

/// Configure SYSTICK for 1ms timebase
fn systick_init(mut syst: stm32::SYST, clocks: CoreClocks) {
Expand Down Expand Up @@ -139,15 +143,15 @@ mod app {
let mut link_led = gpioc.pc3.into_push_pull_output(); // USR LED1
link_led.set_high();

let rmii_ref_clk = gpioa.pa1.into_alternate();
let rmii_mdio = gpioa.pa2.into_alternate();
let rmii_mdc = gpioc.pc1.into_alternate();
let rmii_crs_dv = gpioa.pa7.into_alternate();
let rmii_rxd0 = gpioc.pc4.into_alternate();
let rmii_rxd1 = gpioc.pc5.into_alternate();
let rmii_tx_en = gpiob.pb11.into_alternate();
let rmii_txd0 = gpiob.pb12.into_alternate();
let rmii_txd1 = gpiob.pb13.into_alternate();
let rmii_ref_clk = gpioa.pa1;
let rmii_mdio = gpioa.pa2;
let rmii_mdc = gpioc.pc1;
let rmii_crs_dv = gpioa.pa7;
let rmii_rxd0 = gpioc.pc4;
let rmii_rxd1 = gpioc.pc5;
let rmii_tx_en = gpiob.pb11;
let rmii_txd0 = gpiob.pb12;
let rmii_txd1 = gpiob.pb13;

// Initialise ethernet...
assert_eq!(ccdr.clocks.hclk().raw(), 200_000_000); // HCLK 200MHz
Expand All @@ -161,7 +165,7 @@ mod app {
ctx.device.ETHERNET_MAC,
ctx.device.ETHERNET_MTL,
ctx.device.ETHERNET_DMA,
(
TwoLanesPins::new(
rmii_ref_clk,
rmii_mdio,
rmii_mdc,
Expand Down
26 changes: 15 additions & 11 deletions examples/ethernet-rtic-stm32h747i-disco.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ use smoltcp::iface::{Config, Interface, SocketSet, SocketStorage};
use smoltcp::time::Instant;
use smoltcp::wire::{HardwareAddress, IpAddress, IpCidr};

use stm32h7xx_hal::{ethernet, rcc::CoreClocks, stm32};
use stm32h7xx_hal::{
ethernet::{self, TwoLanesPins},
rcc::CoreClocks,
stm32,
};

/// Configure SYSTICK for 1ms timebase
fn systick_init(mut syst: stm32::SYST, clocks: CoreClocks) {
Expand Down Expand Up @@ -149,15 +153,15 @@ mod app {
let mut link_led = gpioi.pi14.into_push_pull_output(); // LED3
link_led.set_high();

let rmii_ref_clk = gpioa.pa1.into_alternate();
let rmii_mdio = gpioa.pa2.into_alternate();
let rmii_mdc = gpioc.pc1.into_alternate();
let rmii_crs_dv = gpioa.pa7.into_alternate();
let rmii_rxd0 = gpioc.pc4.into_alternate();
let rmii_rxd1 = gpioc.pc5.into_alternate();
let rmii_tx_en = gpiog.pg11.into_alternate();
let rmii_txd0 = gpiog.pg13.into_alternate();
let rmii_txd1 = gpiog.pg12.into_alternate(); // STM32H747I-DISCO
let rmii_ref_clk = gpioa.pa1;
let rmii_mdio = gpioa.pa2;
let rmii_mdc = gpioc.pc1;
let rmii_crs_dv = gpioa.pa7;
let rmii_rxd0 = gpioc.pc4;
let rmii_rxd1 = gpioc.pc5;
let rmii_tx_en = gpiog.pg11;
let rmii_txd0 = gpiog.pg13;
let rmii_txd1 = gpiog.pg12; // STM32H747I-DISCO

// Initialise ethernet...
assert_eq!(ccdr.clocks.hclk().raw(), 200_000_000); // HCLK 200MHz
Expand All @@ -171,7 +175,7 @@ mod app {
ctx.device.ETHERNET_MAC,
ctx.device.ETHERNET_MTL,
ctx.device.ETHERNET_DMA,
(
TwoLanesPins::new(
rmii_ref_clk,
rmii_mdio,
rmii_mdc,
Expand Down
22 changes: 11 additions & 11 deletions examples/ethernet-stm32h747i-disco.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod utilities;

use log::info;

use stm32h7xx_hal::{ethernet, ethernet::PHY};
use stm32h7xx_hal::ethernet::{self, TwoLanesPins, PHY};
use stm32h7xx_hal::{prelude::*, stm32, stm32::interrupt};

/// Locally administered MAC address
Expand Down Expand Up @@ -66,15 +66,15 @@ fn main() -> ! {
let mut link_led = gpioi.pi14.into_push_pull_output(); // LED3
link_led.set_high();

let rmii_ref_clk = gpioa.pa1.into_alternate();
let rmii_mdio = gpioa.pa2.into_alternate();
let rmii_mdc = gpioc.pc1.into_alternate();
let rmii_crs_dv = gpioa.pa7.into_alternate();
let rmii_rxd0 = gpioc.pc4.into_alternate();
let rmii_rxd1 = gpioc.pc5.into_alternate();
let rmii_tx_en = gpiog.pg11.into_alternate();
let rmii_txd0 = gpiog.pg13.into_alternate();
let rmii_txd1 = gpiog.pg12.into_alternate();
let rmii_ref_clk = gpioa.pa1;
let rmii_mdio = gpioa.pa2;
let rmii_mdc = gpioc.pc1;
let rmii_crs_dv = gpioa.pa7;
let rmii_rxd0 = gpioc.pc4;
let rmii_rxd1 = gpioc.pc5;
let rmii_tx_en = gpiog.pg11;
let rmii_txd0 = gpiog.pg13;
let rmii_txd1 = gpiog.pg12;

// Initialise ethernet...
assert_eq!(ccdr.clocks.hclk().raw(), 200_000_000); // HCLK 200MHz
Expand All @@ -88,7 +88,7 @@ fn main() -> ! {
dp.ETHERNET_MAC,
dp.ETHERNET_MTL,
dp.ETHERNET_DMA,
(
TwoLanesPins::new(
rmii_ref_clk,
rmii_mdio,
rmii_mdc,
Expand Down
1 change: 0 additions & 1 deletion examples/fmc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ macro_rules! fmc_pins {
(
$(
<$alt>::from($pin.into_alternate()
.speed(Speed::VeryHigh)
.internal_pull_up(true))
),*
)
Expand Down
3 changes: 1 addition & 2 deletions examples/fmc_nand_flash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use log::info;
extern crate cortex_m;

use cortex_m_rt::entry;
use stm32h7xx_hal::gpio::{alt::fmc as alt, Speed};
use stm32h7xx_hal::gpio::alt::fmc as alt;
use stm32h7xx_hal::{pac, prelude::*, rcc::rec};

use stm32_fmc::devices::s34ml08g3_4kb;
Expand All @@ -27,7 +27,6 @@ macro_rules! fmc_pins {
(
$(
<$alt>::from($pin.into_alternate()
.speed(Speed::VeryHigh)
.internal_pull_up(true))
),*
)
Expand Down
37 changes: 6 additions & 31 deletions examples/sdmmc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
mod utilities;

use cortex_m_rt::entry;
use stm32h7xx_hal::gpio::Speed;
use stm32h7xx_hal::sdmmc::{SdCard, Sdmmc};
use stm32h7xx_hal::{pac, prelude::*};

Expand Down Expand Up @@ -60,36 +59,12 @@ fn main() -> ! {
let mut delay = cp.SYST.delay(ccdr.clocks);

// SDMMC pins
let clk = gpioc
.pc12
.into_alternate()
.internal_pull_up(false)
.speed(Speed::VeryHigh);
let cmd = gpiod
.pd2
.into_alternate()
.internal_pull_up(true)
.speed(Speed::VeryHigh);
let d0 = gpioc
.pc8
.into_alternate()
.internal_pull_up(true)
.speed(Speed::VeryHigh);
let d1 = gpioc
.pc9
.into_alternate()
.internal_pull_up(true)
.speed(Speed::VeryHigh);
let d2 = gpioc
.pc10
.into_alternate()
.internal_pull_up(true)
.speed(Speed::VeryHigh);
let d3 = gpioc
.pc11
.into_alternate()
.internal_pull_up(true)
.speed(Speed::VeryHigh);
let clk = gpioc.pc12.into_alternate().internal_pull_up(false);
let cmd = gpiod.pd2.into_alternate().internal_pull_up(true);
let d0 = gpioc.pc8.into_alternate().internal_pull_up(true);
let d1 = gpioc.pc9.into_alternate().internal_pull_up(true);
let d2 = gpioc.pc10.into_alternate().internal_pull_up(true);
let d3 = gpioc.pc11.into_alternate().internal_pull_up(true);

// Create SDMMC
let mut sdmmc: Sdmmc<_, SdCard> = dp.SDMMC1.sdmmc(
Expand Down
8 changes: 4 additions & 4 deletions examples/usb_passthrough.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ fn main() -> ! {
dp.OTG1_HS_GLOBAL,
dp.OTG1_HS_DEVICE,
dp.OTG1_HS_PWRCLK,
gpiob.pb14.into_alternate(),
gpiob.pb15.into_alternate(),
gpiob.pb14,
gpiob.pb15,
ccdr.peripheral.USB1OTG,
&ccdr.clocks,
);
Expand All @@ -62,8 +62,8 @@ fn main() -> ! {
dp.OTG2_HS_GLOBAL,
dp.OTG2_HS_DEVICE,
dp.OTG2_HS_PWRCLK,
gpioa.pa11.into_alternate(),
gpioa.pa12.into_alternate(),
gpioa.pa11,
gpioa.pa12,
ccdr.peripheral.USB2OTG,
&ccdr.clocks,
);
Expand Down
24 changes: 12 additions & 12 deletions examples/usb_phy_serial_interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,18 @@ unsafe fn main() -> ! {
dp.OTG1_HS_GLOBAL,
dp.OTG1_HS_DEVICE,
dp.OTG1_HS_PWRCLK,
gpioa.pa5.into_alternate(),
gpioi.pi11.into_alternate(),
gpioh.ph4.into_alternate(),
gpioc.pc0.into_alternate(),
gpioa.pa3.into_alternate(),
gpiob.pb0.into_alternate(),
gpiob.pb1.into_alternate(),
gpiob.pb10.into_alternate(),
gpiob.pb11.into_alternate(),
gpiob.pb12.into_alternate(),
gpiob.pb13.into_alternate(),
gpiob.pb5.into_alternate(),
gpioa.pa5,
gpioi.pi11,
gpioh.ph4,
gpioc.pc0,
gpioa.pa3,
gpiob.pb0,
gpiob.pb1,
gpiob.pb10,
gpiob.pb11,
gpiob.pb12,
gpiob.pb13,
gpiob.pb5,
ccdr.peripheral.USB1OTG,
&ccdr.clocks,
);
Expand Down
4 changes: 2 additions & 2 deletions examples/usb_rtic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ mod app {
#[cfg(any(feature = "rm0433", feature = "rm0399"))]
let (pin_dm, pin_dp) = {
let gpiob = ctx.device.GPIOB.split(ccdr.peripheral.GPIOB);
(gpiob.pb14.into_alternate(), gpiob.pb15.into_alternate())
(gpiob.pb14, gpiob.pb15)
};

#[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
4 changes: 2 additions & 2 deletions examples/usb_serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ fn main() -> ! {
#[cfg(any(feature = "rm0433", feature = "rm0399"))]
let (pin_dm, pin_dp) = {
let gpiob = dp.GPIOB.split(ccdr.peripheral.GPIOB);
(gpiob.pb14.into_alternate(), gpiob.pb15.into_alternate())
(gpiob.pb14, gpiob.pb15)
};

#[cfg(any(feature = "rm0455", feature = "rm0468"))]
let (pin_dm, pin_dp) = {
let gpioa = dp.GPIOA.split(ccdr.peripheral.GPIOA);
(gpioa.pa11.into_alternate(), gpioa.pa12.into_alternate())
(gpioa.pa11, gpioa.pa12)
};

let usb = USB1::new(
Expand Down
Loading

0 comments on commit ecdc24b

Please sign in to comment.