From 0e18f24896a92cd2283646f13e7cb4585ffdce03 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Wed, 5 Nov 2025 00:32:32 -0800 Subject: [PATCH] nrf/i2s: allow master mode without MCK pin Outputting the generated master clock is optional as per Nordic docs: "The MCK signal can be routed to an output pin (specified in PSEL.MCK) to supply external I2S devices that require the MCK to be supplied from the outside." [1] Some I2S DACs, such as MAX98357A, don't require a master clock input so it can be left disconnected. nRF Connect SDK supports this. [1] https://docs.nordicsemi.com/bundle/ps_nrf52833/page/i2s.html [2] https://www.analog.com/media/en/technical-documentation/data-sheets/max98357a-max98357b.pdf --- embassy-nrf/CHANGELOG.md | 1 + embassy-nrf/src/i2s.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/embassy-nrf/CHANGELOG.md b/embassy-nrf/CHANGELOG.md index 72ecb116a1..70bbb33ea0 100644 --- a/embassy-nrf/CHANGELOG.md +++ b/embassy-nrf/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - bugfix: Do not write to UICR from non-secure code on nrf53 - bugfix: Add delay to uart init anomaly fix - changed: `BufferedUarte::read_ready` now uses the same definition for 'empty' so following read calls will not block when true is returned +- changed: allow configuring I2S in master mode without master clock output pin ## 0.8.0 - 2025-09-30 diff --git a/embassy-nrf/src/i2s.rs b/embassy-nrf/src/i2s.rs index 9cce9f1e86..f33f4b9c33 100644 --- a/embassy-nrf/src/i2s.rs +++ b/embassy-nrf/src/i2s.rs @@ -422,7 +422,7 @@ impl<'d> I2S<'d> { pub fn new_master( _i2s: Peri<'d, T>, _irq: impl interrupt::typelevel::Binding> + 'd, - mck: Peri<'d, impl GpioPin>, + mck: Option>, sck: Peri<'d, impl GpioPin>, lrck: Peri<'d, impl GpioPin>, master_clock: MasterClock, @@ -434,7 +434,7 @@ impl<'d> I2S<'d> { Self { r: T::regs(), state: T::state(), - mck: Some(mck.into()), + mck: mck.map(|mck| mck.into()), sck: sck.into(), lrck: lrck.into(), sdin: None,