Skip to content

Commit 3f2444e

Browse files
committed
Switched to Pico supporting only the F030.
F031 boards should run F030 code and it's easier to support one chip. Uses the systick monotimer to avoid issues with STM32 timers. Reset pulse is now 250 ms long.
1 parent 34eafae commit 3f2444e

13 files changed

+145
-118
lines changed

.github/workflows/build_and_release.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,11 @@ jobs:
1919
- name: Install flip-link
2020
run: cd / && cargo install --debug flip-link
2121

22-
- name: Build neotron-bmc-pico for F030
23-
run: |
24-
cd neotron-bmc-pico
25-
cargo build --release --verbose --target=thumbv6m-none-eabi --features=stm32f030x6
26-
cd target/thumbv6m-none-eabi/release
27-
mv neotron-bmc-pico neotron-bmc-pico-f030
28-
29-
- name: Build neotron-bmc-pico for F031
30-
run: |
31-
cd neotron-bmc-pico
32-
cargo build --release --verbose --target=thumbv6m-none-eabi --features=stm32f031
33-
cd target/thumbv6m-none-eabi/release
34-
mv neotron-bmc-pico neotron-bmc-pico-f031
22+
- name: Build neotron-bmc-pico
23+
run: cd neotron-bmc-pico && DEFMT_LOG=info cargo build --release --verbose --target=thumbv6m-none-eabi
3524

3625
- name: Build neotron-bmc-nucleo
37-
run: |
38-
cd neotron-bmc-nucleo
39-
cargo build --release --verbose --target=thumbv7em-none-eabihf
26+
run: cd neotron-bmc-nucleo && DEFMT_LOG=info cargo build --release --verbose --target=thumbv7em-none-eabihf
4027

4128
- name: Get Branch Name
4229
if: github.event_name == 'push' && startswith(github.ref, 'refs/tags/')
Binary file not shown.
-909 KB
Binary file not shown.

neotron-bmc-nucleo/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This folder is for the Board Management Controller (BMC) when running on an STM3
66

77
## Hardware Interface
88

9-
The NBMC also supports running on an ST Nucleo-F401RE, for development and debugging purposes. The STM32F401RET6U MCU has:
9+
This firmware runs on an ST Nucleo-F401RE, for development and debugging purposes. The STM32F401RET6U MCU has:
1010

1111
* 32-bit Arm Cortex-M4 Core
1212
* 3.3V I/O (5V tolerant)

neotron-bmc-nucleo/src/main.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1+
//! Neotron BMC Firmware
2+
//!
3+
//! This is the firmware for the Neotron Board Management Controller (BMC). It
4+
//! controls the power, reset, UART and PS/2 ports, but running on an ST Nucleo
5+
//! instead of a real Neotron board. For more details, see the `README.md` file.
6+
//!
7+
//! # Licence
8+
//! This source code as a whole is licensed under the GPL v3. Third-party crates
9+
//! are covered by their respective licences.
10+
111
#![no_main]
212
#![no_std]
313

4-
///! Neotron BMC Firmware
5-
///!
6-
///! This is the firmware for the Neotron Board Management Controller (BMC). It controls the power, reset, UART and PS/2 ports on a Neotron mainboard.
7-
///! For more details, see the `README.md` file.
8-
///!
9-
///! # Licence
10-
///! This source code as a whole is licensed under the GPL v3. Third-party crates are covered by their respective licences.
1114
use cortex_m::interrupt::free as disable_interrupts;
1215
use heapless::spsc::{Consumer, Producer, Queue};
1316
use rtic::app;

neotron-bmc-pico/.cargo/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
2-
runner = "probe-run --chip STM32F031K6Tx"
2+
runner = "probe-run --chip STM32F030K6Tx"
33
rustflags = [
44
"-C", "linker=flip-link",
55
"-C", "link-arg=-Tlink.x",

neotron-bmc-pico/Cargo.toml

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ edition = "2018"
55
version = "0.3.0"
66

77
[dependencies]
8-
defmt = "0.3"
98
cortex-m = { version = "0.7.5", features = ["inline-asm"] }
10-
defmt-rtt = "0.3"
119
cortex-m-rtic = "1.0"
12-
panic-probe = { version = "0.3.0", features = ["print-defmt"] }
13-
stm32f0xx-hal = { version = "0.18", features = ["rt"] }
1410
debouncr = "0.2"
11+
defmt = "0.3"
12+
defmt-rtt = "0.3"
1513
heapless= "0.7"
16-
systick-monotonic = "1.0.0"
14+
panic-probe = { version = "0.3", features = ["print-defmt"] }
15+
stm32f0xx-hal = { version = "0.17", features = ["stm32f030x6", "rt"] }
16+
systick-monotonic = "1.0"
1717

1818
[features]
1919
# set logging levels here
@@ -36,44 +36,36 @@ defmt-error = []
3636
[profile.dev]
3737
codegen-units = 1
3838
debug = 2
39-
debug-assertions = true # <-
39+
debug-assertions = true
4040
incremental = false
41-
opt-level = 3 # <-
42-
overflow-checks = true # <-
41+
opt-level = 3
42+
overflow-checks = true
4343

4444
# cargo test
4545
[profile.test]
4646
codegen-units = 1
4747
debug = 2
48-
debug-assertions = true # <-
48+
debug-assertions = true
4949
incremental = false
50-
opt-level = 3 # <-
51-
overflow-checks = true # <-
50+
opt-level = 3
51+
overflow-checks = true
5252

5353
# cargo build/run --release
5454
[profile.release]
5555
codegen-units = 1
5656
debug = 2
57-
debug-assertions = false # <-
57+
debug-assertions = false
5858
incremental = false
5959
lto = 'fat'
60-
opt-level = 3 # <-
61-
overflow-checks = false # <-
60+
opt-level = 3
61+
overflow-checks = false
6262

6363
# cargo test --release
6464
[profile.bench]
6565
codegen-units = 1
6666
debug = 2
67-
debug-assertions = false # <-
67+
debug-assertions = false
6868
incremental = false
6969
lto = 'fat'
70-
opt-level = 3 # <-
71-
overflow-checks = false # <-
72-
73-
# uncomment this to switch from the crates.io version of defmt to its git version
74-
# check app-template's README for instructions
75-
# [patch.crates-io]
76-
# defmt = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
77-
# defmt-rtt = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
78-
# defmt-test = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
79-
# panic-probe = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
70+
opt-level = 3
71+
overflow-checks = false

neotron-bmc-pico/README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22

33
## Introduction
44

5-
This folder is for the Board Management Controller (BMC) on a [Neotron Pico](https://github.com/neotron-compute/neotron-pico).
5+
This firmware is designed to run on an ST Micro STM32F0 (STM32F030K6T6) microcontroller as fitted to the Neotron Pico.
66

7-
## Hardware Interface
8-
9-
The NBMC firmware is designed to run on an ST Micro STM32F0 (STM32F031K6T6 or STM32F030K6T6) microcontroller
7+
The MCU has:
108

119
* 32-bit Arm Cortex-M0+ Core
12-
* 3.3V I/O (5V tolerant)
10+
* 3.3V I/O (mostly 5V tolerant)
1311
* 32 KiB Flash
1412
* 4 KiB SRAM
15-
* LQFP-32 package (0.8mm pitch, 7mm x 7mm)
13+
* LQFP-32 package (0.8mm pitch)
1614

1715

1816
| Pin | Name | Signal | Function |
@@ -27,8 +25,8 @@ The NBMC firmware is designed to run on an ST Micro STM32F0 (STM32F031K6T6 or ST
2725
| 11 | PA5 | SPI1_SCK | SPI Clock Input |
2826
| 12 | PA6 | SPI1_CIPO | SPI Data Output |
2927
| 13 | PA7 | SPI1_COPI | SPI Data Input |
30-
| 14 | PB0 | LED0 | Output for Power LED |
31-
| 15 | PB1 | LED1 | Output for Status LED |
28+
| 14 | PB0 | LED | Output for Power LED |
29+
| 15 | PB1 | BUZZER | PWM Output for Buzzer |
3230
| 18 | PA8 | IRQ_nHOST | Interrupt Output to the Host (active low) |
3331
| 19 | PA9 | USART1_TX | UART Transmit Output |
3432
| 20 | PA10 | USART1_RX | UART Receive Input |
@@ -45,8 +43,9 @@ The NBMC firmware is designed to run on an ST Micro STM32F0 (STM32F031K6T6 or ST
4543

4644
Note that in the above table, the UART signals are wired as _Data Terminal Equipment (DTE)_ (i.e. like a PC, not like a Modem). Connect the NMBC *UART Transmit Output* pin to the *Input* pin of something like an FTDI TTL-232R-3V3 cable.
4745

48-
This hardware design should also be pin-compatible with the following SoCs (although this firmware may need changes):
46+
This design should also be pin-compatible with the following SoCs (although this firmware may need changes):
4947

48+
* STM32F031K6Tx
5049
* STM32F042K4Tx
5150
* STM32F042K6Tx
5251
* STM32L071KBTx
@@ -59,7 +58,7 @@ Note that not all STM32 pins are 5V-tolerant, and the PS/2 protocol is a 5V open
5958

6059
## Build Requirements
6160

62-
1. rustup and Rust
61+
1. `rustup` and Rust
6362
- see https://www.rust-lang.org
6463
2. The `thumbv6m-none-eabi` target
6564
- run `rustup target add thumbv6m-none-eabi`
@@ -71,17 +70,17 @@ Note that not all STM32 pins are 5V-tolerant, and the PS/2 protocol is a 5V open
7170
Then to build and flash for an STM32F031K6T6, connect a probe supported by probe-rs (such as a SEGGER J-Link, or an ST-Link) and run:
7271

7372
```
74-
$ cargo run --release --features stm32f031
73+
$ DEFMT_LOG=info cargo run --release
7574
```
7675

77-
For an STM32F030K6T6, run:
76+
You should see logging messages from the board on your terminal. To increase the logging level, try:
7877

78+
Then to build and flash, connect a probe supported by probe-rs (such as a SEGGER J-Link, or an ST-Link) and run:
7979

8080
```
81-
$ cargo run --release --features stm32f030x6
81+
$ DEFMT_LOG=debug cargo run --release
8282
```
8383

8484
## Licence
8585

8686
This source code as a whole is licensed under the GPL v3. Third-party crates are covered by their respective licences.
87-

0 commit comments

Comments
 (0)