Skip to content

Commit 0715694

Browse files
samples: drivers: i2s: echo: add MAX32655 support
- reduced block length from 100ms to 40ms to compile for low ram - add compile time conditional option to slave mode - add overlay file for max32655fthr Signed-off-by: Anuj Pathak <anuj@croxel.com>
1 parent b387018 commit 0715694

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
i2s_rxtx: &i2s0 {
2+
status = "okay";
3+
};
4+
5+
&i2c1 {
6+
max9867: max9867@18 {
7+
compatible = "adi,max9867";
8+
reg = <0x18>;
9+
};
10+
};

samples/drivers/i2s/echo/src/main.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
#define SAMPLE_BIT_WIDTH 16
2525
#define BYTES_PER_SAMPLE sizeof(int16_t)
2626
#define NUMBER_OF_CHANNELS 2
27-
/* Such block length provides an echo with the delay of 100 ms. */
28-
#define SAMPLES_PER_BLOCK ((SAMPLE_FREQUENCY / 10) * NUMBER_OF_CHANNELS)
27+
/* Such block length provides an echo with the delay of 40 ms. */
28+
#define SAMPLES_PER_BLOCK ((SAMPLE_FREQUENCY / 25) * NUMBER_OF_CHANNELS)
2929
#define INITIAL_BLOCKS 2
3030
#define TIMEOUT 1000
3131

@@ -281,7 +281,15 @@ int main(void)
281281
config.word_size = SAMPLE_BIT_WIDTH;
282282
config.channels = NUMBER_OF_CHANNELS;
283283
config.format = I2S_FMT_DATA_FORMAT_I2S;
284+
/*
285+
* On MAX32655FTHR, MAX9867 MCLK is connected to external 12.2880 crystal
286+
* thus using slave mode
287+
*/
288+
#if CONFIG_BOARD_MAX32655FTHR_MAX32655_M4
289+
config.options = I2S_OPT_BIT_CLK_SLAVE | I2S_OPT_FRAME_CLK_SLAVE;
290+
#else
284291
config.options = I2S_OPT_BIT_CLK_MASTER | I2S_OPT_FRAME_CLK_MASTER;
292+
#endif
285293
config.frame_clk_freq = SAMPLE_FREQUENCY;
286294
config.mem_slab = &mem_slab;
287295
config.block_size = BLOCK_SIZE;

0 commit comments

Comments
 (0)