Skip to content

Commit 042c9b4

Browse files
datdenkiknietJohannes Draaijer
authored andcommitted
Fixup docs, rename setup_clocks to setup_peripherals
1 parent b56252e commit 042c9b4

File tree

8 files changed

+25
-26
lines changed

8 files changed

+25
-26
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Use feature-flag `smoltcp-phy`
8888

8989
## Examples
9090

91-
The examples should run and compile on any MCU that has an 802.3 compatible PHY connected to the default RMII pins.
91+
The examples should run and compile on any MCU that has an 802.3 compatible PHY capable of generating the required 50 MHz clock signal connected to the default RMII pins.
9292

9393
The examples use `defmt` and `defmt_rtt` for logging, and `panic_probe` over `defmt_rtt` for printing panic backtraces.
9494

@@ -97,11 +97,11 @@ To run or build them, the following steps should be taken:
9797
1. Determine the correct compilation target for the MCU that you're using. For `stm32f107`, it is `thumbv7m-none-eabi`. For all others, it is `thumbv7em-none-eabihf`.
9898
2. Determine the MCU feature necessary for running on your MCU, e.g. `stm32f745`.
9999
3. Determine the Additional required features (see section below) necessary to build the example.
100-
4. Follow the rest of the instructions in the "Building examples" or "Running examples" subsections.
100+
4. Follow the rest of the instructions in the ["Building examples"](#building-examples) or ["Running examples"](#running-examples) subsections.
101101

102102
### Additional required features
103-
Besides the feature selecting the correct MCU to be used when building and/or running an example, the following
104-
additional features are required:
103+
104+
Besides the feature selecting the correct MCU to be used when building and/or running an example, the following additional features are required:
105105

106106
| Example | Additional required features |
107107
| ------------- | ---------------------------------------------------- |
@@ -111,6 +111,9 @@ additional features are required:
111111
| `pktgen` | `defmt` |
112112
| `rtic-echo` | `rtic-echo-example` |
113113

114+
#### 144-pin nucleo boards
115+
116+
For `stm32` 144-pin nucleo boards that contain an MCU supported by this crate the `example-nucleo-pins` feature should be activated. This causes the examples to use PG11 as TX_EN and PG13 as TXD0, instead of PB11 and PB12, which is the configuration used on these boards.
114117

115118
### Building examples
116119
Run the following command:
@@ -121,12 +124,11 @@ cargo build --release --example <example> --features <MCU feature>,<additional r
121124
For example, if we wish to build the `arp-smoltcp` example for an `stm32f429`, we should run the following command:
122125

123126
```bash
124-
cargo build --release --example arp-smoltcp --features stm32f429,smoltcp-phy,smoltcp/socket-tcp,smoltcp/socket-icmp --target thumbv7em-none-eabihf
127+
cargo build --release --example arp-smoltcp --features stm32f429,smoltcp-phy,smoltcp/socket-tcp --target thumbv7em-none-eabihf
125128
```
126129

127130
### Running examples
128-
Install `probe-run` (`cargo install probe-run --version '~0.3'`), and ensure that `probe-run` can
129-
attach to your MCU.
131+
Install `probe-run` with `cargo install probe-run --version '~0.3'`
130132

131133
Find the correct value for `PROBE_RUN_CHIP` for your MCU from the list provided by `probe-run --list-chips`.
132134

@@ -143,8 +145,6 @@ For example, if we wish to run the `rtic-echo` example on an `STM32F107RCT6`, we
143145
DEFMT_LOG=info PROBE_RUN_CHIP=STM32F107RC cargo run --release --example rtic-echo --features stm32f107,rtic-echo-example --target thumbv7m-none-eabi
144146
```
145147

146-
### Pins
147-
148-
For the `stm32-nucleo-f746zg` board, the `example-nucleo-pins` feature can be activated.
148+
### Other pin configurations
149149

150-
If the usage of different pins is required, the types and `setup_pins` function in `examples/common.rs` should be edited. If the pin configuration is for a `nucleo` board, a PR with the changes would be appreciated.
150+
If the usage of different pins is required, the types and `setup_pins` function in `examples/common.rs` should be edited. If the pin configuration is for a `nucleo` board or other commonly used board, a PR with the changes is most welcome.

examples/arp-smoltcp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! For build and run instructions, see [`README.md`](../README.md#examples)
1+
//! For build and run instructions, see README.md
22
//!
33
//! With Wireshark, you can see the ARP packets, which should look like this:
44
//! No. Time Source Destination Protocol Length Info
@@ -38,7 +38,7 @@ fn main() -> ! {
3838
let p = Peripherals::take().unwrap();
3939
let mut cp = CorePeripherals::take().unwrap();
4040

41-
let (clocks, gpio, ethernet) = common::setup_clocks(p);
41+
let (clocks, gpio, ethernet) = common::setup_peripherals(p);
4242

4343
setup_systick(&mut cp.SYST);
4444

examples/arp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! For build and run instructions, see [`README.md`](../README.md#examples)
1+
//! For build and run instructions, see README.md
22
//!
33
//! With Wireshark, you can see the ARP packets, which should look like this:
44
//! No. Time Source Destination Protocol Length Info
@@ -35,7 +35,7 @@ fn main() -> ! {
3535
let p = Peripherals::take().unwrap();
3636
let mut cp = CorePeripherals::take().unwrap();
3737

38-
let (clocks, gpio, ethernet) = common::setup_clocks(p);
38+
let (clocks, gpio, ethernet) = common::setup_peripherals(p);
3939

4040
setup_systick(&mut cp.SYST);
4141

examples/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub struct EthernetPeripherals {
2525
///
2626
/// This configures HCLK to be at least 25 MHz, which is the minimum required
2727
/// for ethernet operation to be valid.
28-
pub fn setup_clocks(p: stm32_eth::stm32::Peripherals) -> (Clocks, Gpio, EthernetPeripherals) {
28+
pub fn setup_peripherals(p: stm32_eth::stm32::Peripherals) -> (Clocks, Gpio, EthernetPeripherals) {
2929
let ethernet = EthernetPeripherals {
3030
dma: p.ETHERNET_DMA,
3131
mac: p.ETHERNET_MAC,

examples/ip.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![no_std]
22
#![no_main]
33

4-
//! For build and run instructions, see [`README.md`](../README.md#examples)
4+
//! For build and run instructions, see README.md
55
//!
66
//! This example starts a TCP listening server that should transmit `Hello` to
77
//! any connecting client, and then close the connection.
@@ -35,7 +35,7 @@ fn main() -> ! {
3535
let p = Peripherals::take().unwrap();
3636
let mut cp = CorePeripherals::take().unwrap();
3737

38-
let (clocks, gpio, ethernet) = common::setup_clocks(p);
38+
let (clocks, gpio, ethernet) = common::setup_peripherals(p);
3939

4040
setup_systick(&mut cp.SYST);
4141

examples/pktgen.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
//! An example that generates some empty ethernet packets.
1+
//! For build and run instructions, see README.md
22
//!
3-
//! For build and run instructions, see [`README.md`](../README.md#examples)
4-
3+
//! An example that generates some empty ethernet packets.
54
#![no_std]
65
#![no_main]
76

@@ -36,7 +35,7 @@ fn main() -> ! {
3635
let p = Peripherals::take().unwrap();
3736
let mut cp = CorePeripherals::take().unwrap();
3837

39-
let (clocks, gpio, ethernet) = common::setup_clocks(p);
38+
let (clocks, gpio, ethernet) = common::setup_peripherals(p);
4039

4140
setup_systick(&mut cp.SYST);
4241

examples/rtic-echo.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#![no_std]
22
#![no_main]
33

4+
//! For build and run instructions, see README.md
5+
//!
46
//! A simple TCP echo server using RTIC.
57
//!
68
//! Starts a TCP echo server on port `1337` at `ADDRESS`. `ADDRESS` is `10.0.0.1/24` by default.
7-
//!
8-
//! For build and run instructions, see [`README.md`](../README.md#examples)
99
1010
use defmt_rtt as _;
1111
use panic_probe as _;
@@ -69,7 +69,7 @@ mod app {
6969
let rx_ring = cx.local.rx_ring;
7070
let tx_ring = cx.local.tx_ring;
7171

72-
let (clocks, gpio, ethernet) = crate::common::setup_clocks(p);
72+
let (clocks, gpio, ethernet) = crate::common::setup_peripherals(p);
7373
let mono = Systick::new(core.SYST, clocks.hclk().raw());
7474

7575
defmt::info!("Setting up pins");

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const MTU: usize = 1522;
9090
/// This method does not initialise the external PHY. Interacting with a PHY
9191
/// can be done by using the struct returned from [`EthernetMAC::mii`].
9292
///
93-
/// /// # Note
93+
/// # Note
9494
/// - Make sure that the buffers reside in a memory region that is
9595
/// accessible by the peripheral. Core-Coupled Memory (CCM) is
9696
/// usually not accessible.

0 commit comments

Comments
 (0)