Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2 Board Support, Health Manager, Radio Receive, and Cleanup #71

Merged
merged 28 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7f30972
Start Sensor V2 support
NoahSprenger Oct 11, 2023
696ce59
Add simple example
NoahSprenger Nov 6, 2023
78fac46
WIP
NoahSprenger Nov 18, 2023
baed048
Deviate cleanup
NoahSprenger Dec 21, 2023
01ed2e6
Cleanup
NoahSprenger Dec 22, 2023
6f29d01
Start Health Manager
NoahSprenger Dec 22, 2023
7244289
WIP: Health Manager
NoahSprenger Dec 27, 2023
9f4491a
Move link flags to respective build.rs files
NoahSprenger Dec 27, 2023
c696d46
Add placeholder files and WIP: HealthManager
NoahSprenger Jan 5, 2024
fd06fdf
Fix board ID and component ID issues with sensor messages
NoahSprenger Jan 11, 2024
7d87773
implement better solution to board ID and component ID
NoahSprenger Jan 11, 2024
6317c37
sync before checkout
NoahSprenger Jan 15, 2024
eb85b28
WIP: Communication board health manager
NoahSprenger Jan 15, 2024
dddaafb
Implement health monitor trait for communication board. Rework health…
NoahSprenger Jan 16, 2024
dc506b8
Temp fix top build settings
NoahSprenger Jan 18, 2024
e862d6b
Cleanup
NoahSprenger Sep 11, 2023
b02e7db
make fields of log struct public
eilayk Jan 16, 2024
8dca001
Add simple example
NoahSprenger Nov 6, 2023
dfd5d81
WIP
NoahSprenger Nov 18, 2023
734473f
Deviate cleanup
NoahSprenger Dec 21, 2023
0d6dbb8
Cleanup
NoahSprenger Dec 22, 2023
eef39df
Merge branch 'master' into sensor_v2
NoahSprenger Jan 18, 2024
a471137
Cleanup
NoahSprenger Jan 20, 2024
4c91bf2
Update atsamd path
NoahSprenger Jan 22, 2024
ffd18e4
Fix lld error: Remove atsamdhal from common-arm.
NoahSprenger Jan 23, 2024
81dce7a
Cargo fmt
NoahSprenger Jan 23, 2024
56f15c9
Implement Radio Receiving
NoahSprenger Jan 23, 2024
3d36c6f
Replace Vec for HistoryBuffer and cleanup
NoahSprenger Jan 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 110 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ default-members = [
"examples/*"
]

[workspace.dependencies.stm32h7xx-hal]
git = "https://github.com/stm32-rs/stm32h7xx-hal"
features = ["sdmmc-fatfs", "can", "defmt", "stm32h735"]

[workspace.dependencies.atsamd-hal]
git = "https://github.com/atsamd-rs/atsamd"
features = ["same51j", "same51j-rt", "dma", "can"]
Expand Down
2 changes: 1 addition & 1 deletion boards/sensor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ messages = { path = "../../libraries/messages" }
sbg-rs = {path = "../../libraries/sbg-rs"}
embedded-sdmmc = "0.3.0" # port to v5
typenum = "1.16.0"
embedded-alloc = "0.5.0"
embedded-alloc = "0.5.0"
24 changes: 24 additions & 0 deletions boards/sensor_v2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "sensor_v2"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
fugit = "0.3.5"
embedded-hal = { version = "0.2.6", features = ["unproven"] }
embedded-dma = "0.2.0"
panic-halt = "0.2.0"
cortex-m = { workspace = true }
cortex-m-rt = "^0.7.0"
cortex-m-rtic = "1.1.3"
#common-arm = {path = "../../libraries/common-arm"}
NoahSprenger marked this conversation as resolved.
Show resolved Hide resolved
stm32h7xx-hal = { workspace = true }
void = { version = "1.0.2", default-features = false }
cast = { version = "0.3.0", default-features = false }
nb = "1.0.0"
paste = "1.0.1"
bare-metal = "1.0.0"
sdio-host = { version = "0.9", optional = true }
embedded-storage = "0.3"
60 changes: 60 additions & 0 deletions boards/sensor_v2/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#![no_std]
#![no_main]

use stm32h7xx_hal::gpio::gpioc::{PC13, PC3};
use stm32h7xx_hal::gpio::{Edge, ExtiPin, Input};
use stm32h7xx_hal::gpio::{Output, PushPull};
use stm32h7xx_hal::prelude::*;

use panic_halt as _;

#[rtic::app(device = stm32h7xx_hal::stm32, peripherals = true)]
mod app {
use super::*;

#[shared]
struct SharedResources {}
#[local]
struct LocalResources {
button: PC13<Input>,
led: PC3<Output<PushPull>>,
}

#[init]
fn init(
mut ctx: init::Context,
) -> (SharedResources, LocalResources, init::Monotonics) {
let pwr = ctx.device.PWR.constrain();
// We could use smps, but the board is not designed for it
// let pwrcfg = example_power!(pwr).freeze();
let pwrcfg = pwr.freeze();

// RCC
let rcc = ctx.device.RCC.constrain();
let ccdr = rcc.sys_ck(100.MHz()).freeze(pwrcfg, &ctx.device.SYSCFG);

// GPIO
let gpioc = ctx.device.GPIOC.split(ccdr.peripheral.GPIOC);

// Button
let mut button = gpioc.pc13.into_floating_input();
button.make_interrupt_source(&mut ctx.device.SYSCFG);
button.trigger_on_edge(&mut ctx.device.EXTI, Edge::Rising);
button.enable_interrupt(&mut ctx.device.EXTI);

(
SharedResources {},
LocalResources {
button,
led: gpioc.pc3.into_push_pull_output(),
},
init::Monotonics(),
)
}

#[task(binds = EXTI15_10, local = [button, led])]
fn button_click(ctx: button_click::Context) {
ctx.local.button.clear_interrupt_pending_bit();
ctx.local.led.toggle();
}
}
4 changes: 2 additions & 2 deletions libraries/common-arm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ edition = "2021"
[dependencies]
cortex-m = { workspace = true }
postcard = { version = "1.0.2", features = ["use-defmt"] }
atsamd-hal = {workspace = true}
defmt = "0.3.2"
defmt-rtt = "0.4.0"
heapless = "0.7.16"
derive_more = "0.99.17"
atsamd-hal = { workspace = true }
cortex-m-rt = "^0.7.0"
embedded-sdmmc = "0.3.0"
embedded-hal = "0.2.7"
mcan = "0.3"
nb = "1.1.0"
messages = { path = "../messages" }
messages = { path = "../messages" }
3 changes: 1 addition & 2 deletions libraries/common-arm/src/sd_manager.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use core::{marker::PhantomData, fmt::Debug};
use defmt::{info, warn};
use atsamd_hal::gpio::{Output, Pin, PushPull, PB14};
use embedded_sdmmc as sd;
use embedded_hal as hal;
use cortex_m;
Expand Down Expand Up @@ -142,4 +141,4 @@ unsafe impl<SPI, CS> Send for SdManager<SPI, CS>
where
SPI: hal::spi::FullDuplex<u8>, <SPI as FullDuplex<u8>>::Error: Debug,
CS: hal::digital::v2::OutputPin,
{}
{}
63 changes: 63 additions & 0 deletions memory.x
NoahSprenger marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
MEMORY
{
/* FLASH and RAM are mandatory memory regions */

/* STM32H742xI/743xI/753xI */
/* STM32H745xI/747xI/755xI/757xI */
/* STM32H7A3xI/7B3xI */
FLASH : ORIGIN = 0x08000000, LENGTH = 2M

/* STM32H742xG/743xG */
/* STM32H745xG/STM32H747xG */
/* STM32H7A3xG */
/* FLASH : ORIGIN = 0x08000000, LENGTH = 512K */
/* FLASH1 : ORIGIN = 0x08100000, LENGTH = 512K */

/* STM32H750xB */
/* STM32H7B0 */
/* FLASH : ORIGIN = 0x08000000, LENGTH = 128K */

/* DTCM */
RAM : ORIGIN = 0x20000000, LENGTH = 128K

/* AXISRAM */
AXISRAM : ORIGIN = 0x24000000, LENGTH = 512K

/* SRAM */
SRAM1 : ORIGIN = 0x30000000, LENGTH = 128K
SRAM2 : ORIGIN = 0x30020000, LENGTH = 128K
SRAM3 : ORIGIN = 0x30040000, LENGTH = 32K
SRAM4 : ORIGIN = 0x38000000, LENGTH = 64K

/* Backup SRAM */
BSRAM : ORIGIN = 0x38800000, LENGTH = 4K

/* Instruction TCM */
ITCM : ORIGIN = 0x00000000, LENGTH = 64K
}

/* The location of the stack can be overridden using the
`_stack_start` symbol. Place the stack at the end of RAM */
_stack_start = ORIGIN(RAM) + LENGTH(RAM);

/* The location of the .text section can be overridden using the
`_stext` symbol. By default it will place after .vector_table */
/* _stext = ORIGIN(FLASH) + 0x40c; */

/* These sections are used for some of the examples */
SECTIONS {
.axisram (NOLOAD) : ALIGN(8) {
*(.axisram .axisram.*);
. = ALIGN(8);
} > AXISRAM
/* The SRAM1 and SRAM2 section are commonly used as the stack and heap for the
CM4 core in dualcore versions and should thus not be used in examples*/
.sram3 (NOLOAD) : ALIGN(4) {
*(.sram3 .sram3.*);
. = ALIGN(4);
} > SRAM3
.sram4 (NOLOAD) : ALIGN(4) {
*(.sram4 .sram4.*);
. = ALIGN(4);
} > SRAM4
};