Skip to content

Commit 47a6eaa

Browse files
committed
nrf: i2sout: Assign SWIDTH
The sample width register was never set, so all samples were played as though they were 16 bit. After this change, 8-bit samples no longer produce audio on the MAX 98357A BOB, because only 16-, 24-, and 32-bit samples are supported by the hardware. This will be addressed by a future change to pad samples to 16 bits; see #2323 and the 98357A datasheet page 6.
1 parent 8f4bab2 commit 47a6eaa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ports/nrf/common-hal/audiobusio/I2SOut.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self,
246246
self->single_buffer = single_buffer;
247247
self->samples_signed = samples_signed;
248248

249+
250+
NRF_I2S->CONFIG.SWIDTH = self->bytes_per_sample == 1
251+
? I2S_CONFIG_SWIDTH_SWIDTH_8Bit
252+
: I2S_CONFIG_SWIDTH_SWIDTH_16Bit;
249253
choose_i2s_clocking(self, sample_rate);
250254
/* Allocate buffers based on a maximum duration
251255
* This duration was chosen empirically based on what would

0 commit comments

Comments
 (0)