Skip to content

Commit a0e92cd

Browse files
authored
Merge pull request #4778 from everdrone/stm32_sai_frame_length
allow setting stm32 SAI frame_length to 256
2 parents 4352679 + 548fe48 commit a0e92cd

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

embassy-stm32/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased - ReleaseDate
99

10+
- fix: Allow setting SAI peripheral `frame_length` to `256`
1011
- fix: flash erase on dual-bank STM32Gxxx
1112
- feat: Add support for STM32N657X0
1213
- feat: timer: Add 32-bit timer support to SimplePwm waveform_up method following waveform pattern ([#4717](https://github.com/embassy-rs/embassy/pull/4717))

embassy-stm32/src/sai/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ pub struct Config {
391391
pub frame_sync_polarity: FrameSyncPolarity,
392392
pub frame_sync_active_level_length: word::U7,
393393
pub frame_sync_definition: FrameSyncDefinition,
394-
pub frame_length: u8,
394+
pub frame_length: u16,
395395
pub clock_strobe: ClockStrobe,
396396
pub output_drive: OutputDrive,
397397
pub master_clock_divider: Option<MasterClockDivider>,
@@ -696,7 +696,7 @@ impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> {
696696
w.set_fspol(config.frame_sync_polarity.fspol());
697697
w.set_fsdef(config.frame_sync_definition.fsdef());
698698
w.set_fsall(config.frame_sync_active_level_length.0 as u8 - 1);
699-
w.set_frl(config.frame_length - 1);
699+
w.set_frl((config.frame_length - 1).try_into().unwrap());
700700
});
701701

702702
ch.slotr().modify(|w| {

examples/stm32h723/src/bin/spdifrx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ fn new_sai_transmitter<'d>(
167167
sai_config.slot_count = hal::sai::word::U4(CHANNEL_COUNT as u8);
168168
sai_config.slot_enable = 0xFFFF; // All slots
169169
sai_config.data_size = sai::DataSize::Data32;
170-
sai_config.frame_length = (CHANNEL_COUNT * 32) as u8;
170+
sai_config.frame_length = (CHANNEL_COUNT * 32) as u16;
171171
sai_config.master_clock_divider = None;
172172

173173
let (sub_block_tx, _) = hal::sai::split_subblocks(sai);

0 commit comments

Comments
 (0)