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

nrf5340: add internal capacitor config #3939

Merged
merged 1 commit into from
Mar 2, 2025

Conversation

0e4ef622
Copy link
Contributor

@0e4ef622 0e4ef622 commented Mar 2, 2025

config for the optional internal capacitors for the HFXO/LFXO on the nrf5340

@Dirbaio Dirbaio added this pull request to the merge queue Mar 2, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 2, 2025
@Dirbaio Dirbaio added this pull request to the merge queue Mar 2, 2025
Merged via the queue into embassy-rs:main with commit 7650948 Mar 2, 2025
7 checks passed
@alexbohm
Copy link

alexbohm commented Mar 2, 2025

Thanks! You just beat me by hours to asking about this since a BC40C module I was trying didn't have external capacitors.

I tested this with a custom board using that module and this code modified from the blinky.rs example. Seems to be happily blinking away!

#![no_std]
#![no_main]

use embassy_executor::Spawner;
use embassy_nrf::config::{HfclkSource, HfxoCapacitance, InternalCapacitors, LfclkSource, LfxoCapacitance};
use embassy_nrf::gpio::{Level, Output, OutputDrive};
use embassy_time::Timer;
use {defmt_rtt as _, panic_probe as _};

#[embassy_executor::main]
async fn main(_spawner: Spawner) {
    let mut config: embassy_nrf::config::Config = Default::default();

    config.hfclk_source = HfclkSource::ExternalXtal;
    config.lfclk_source = LfclkSource::ExternalXtal;

    config.internal_capacitors = InternalCapacitors {
        hfxo: Some(HfxoCapacitance::_15_5pF),
        lfxo: Some(LfxoCapacitance::_7pF),
    };

    let p = embassy_nrf::init(config);
    let mut led = Output::new(p.P1_11, Level::Low, OutputDrive::Standard);

    loop {
        led.set_high();
        Timer::after_millis(300).await;
        led.set_low();
        Timer::after_millis(300).await;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants