From ae7bd7b92121d37d673577e8c5c3e6e1aab3378a Mon Sep 17 00:00:00 2001 From: Andreas Tsouchlos Date: Sat, 4 Oct 2025 20:05:49 +0200 Subject: [PATCH] Fix configs: Make software compatible with nRF52810 again --- .cargo/config.toml | 6 +++--- Cargo.lock | 2 +- Cargo.toml | 4 ++-- memory.x | 4 ++-- src/bin/temp_rh_measurement.rs | 10 +++++----- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 066e628..8b77eac 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,11 +1,11 @@ [target.'cfg(all(target_arch = "arm", target_os = "none"))'] # replace nRF82810_xxAA with your chip as listed in `probe-rs chip list` -runner = "probe-rs run --chip nRF52832_xxAA" +runner = "probe-rs run --chip nRF52810_xxAA" [alias] rr = "run --release" -f = "flash --chip nRF52832_xxAA --reset-halt" -fr = "flash --chip nRF52832_xxAA --release --reset-halt" +f = "flash --chip nRF52810_xxAA --reset-halt" +fr = "flash --chip nRF52810_xxAA --release --reset-halt" [build] target = "thumbv7em-none-eabi" diff --git a/Cargo.lock b/Cargo.lock index 5e108ed..f56e827 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -734,7 +734,7 @@ dependencies = [ "heapless", "nrf-softdevice-macro", "nrf-softdevice-s112", - "nrf52832-pac", + "nrf52810-pac", "num_enum", ] diff --git a/Cargo.toml b/Cargo.toml index cdbae3b..88df281 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ defmt = "0.3.8" defmt-rtt = "0.4.1" embassy-executor = { version = "0.6.1", features = ["task-arena-size-8192", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } embassy-futures = "0.1.1" -embassy-nrf = { version = "0.2.0", features = ["defmt", "nrf52832", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } +embassy-nrf = { version = "0.2.0", features = ["defmt", "nrf52810", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } embassy-sync = { version = "0.6.0", features = ["defmt"] } embassy-time = { version = "0.3.2", features = ["defmt", "defmt-timestamp-uptime"] } embedded-storage = "0.3.1" @@ -19,7 +19,7 @@ embedded-storage-async = "0.4.1" fixed = "1.28.0" futures = { version = "0.3.31", default-features = false } heapless = "0.8.0" -nrf-softdevice = { version = "0.1.0", features = ["defmt", "ble-peripheral", "ble-gatt-server", "critical-section-impl", "nrf52832", "s112"] } +nrf-softdevice = { version = "0.1.0", features = ["defmt", "ble-peripheral", "ble-gatt-server", "critical-section-impl", "nrf52810", "s112"] } nrf-softdevice-s112 = "0.1.2" panic-probe = { version = "0.3.2", features = ["print-defmt"] } static_cell = "2.1.0" diff --git a/memory.x b/memory.x index 771c982..a6cf45b 100644 --- a/memory.x +++ b/memory.x @@ -2,6 +2,6 @@ MEMORY { /* NOTE 1 K = 1 KiB = 1024 bytes */ /* These values correspond to the NRF52832 with SoftDevice S112 v7.x */ - FLASH : ORIGIN = 0x00000000 + 100K, LENGTH = 512K - 100K - RAM : ORIGIN = 0x20000000 + 0x24b8, LENGTH = 64K - 0x24b8 + FLASH : ORIGIN = 0x00000000 + 100K, LENGTH = 192K - 100K + RAM : ORIGIN = 0x20000000 + 0x24b8, LENGTH = 24K - 0x24b8 } diff --git a/src/bin/temp_rh_measurement.rs b/src/bin/temp_rh_measurement.rs index 6cd5190..47ca019 100644 --- a/src/bin/temp_rh_measurement.rs +++ b/src/bin/temp_rh_measurement.rs @@ -5,7 +5,7 @@ use static_cell::StaticCell; use core::mem; use embassy_nrf::interrupt::{self, InterruptExt}; -use embassy_nrf::peripherals::TWISPI0; +use embassy_nrf::peripherals::TWI0; use embassy_time::Timer; use nrf_softdevice::ble::advertisement_builder::{ Flag, LegacyAdvertisementBuilder, LegacyAdvertisementPayload, ServiceList, ServiceUuid16, @@ -115,10 +115,10 @@ impl GenericTempHumiditySensor { } bind_interrupts!(struct Irqs { - SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 => twim::InterruptHandler; + TWIM0_TWIS0_TWI0 => twim::InterruptHandler; }); -type TempHumiditySensor = GenericTempHumiditySensor; +type TempHumiditySensor = GenericTempHumiditySensor; #[embassy_executor::task] async fn measurement_task(mut sensor: TempHumiditySensor, server: &'static Server) { @@ -148,7 +148,7 @@ static SERVER: StaticCell = StaticCell::new(); async fn main(spawner: Spawner) { // Set up peripherals - interrupt::SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0.set_priority(interrupt::Priority::P2); + interrupt::TWIM0_TWIS0_TWI0.set_priority(interrupt::Priority::P2); let mut embassy_config = embassy_nrf::config::Config::default(); embassy_config.gpiote_interrupt_priority = interrupt::Priority::P2; @@ -156,7 +156,7 @@ async fn main(spawner: Spawner) { let p = embassy_nrf::init(embassy_config); let config = twim::Config::default(); - let twi = twim::Twim::new(p.TWISPI0, Irqs, p.P0_14, p.P0_13, config); + let twi = twim::Twim::new(p.TWI0, Irqs, p.P0_14, p.P0_13, config); let sensor = TempHumiditySensor::new(0x44, twi); let mut led = Output::new(p.P0_20, Level::Low, OutputDrive::Standard);