Has anybody been able to get I2S working with the nrf52* XIAO?
Some issues:
- only pins 4,5,6 seems to work consistently
- audio output is terrible compared to similar setups
I am using a sparkfun I2S module.
Has anybody been able to get I2S working with the nrf52* XIAO?
Some issues:
I am using a sparkfun I2S module.
Hmm, I was wondering that also , so I clicked your link and then compared it to the “rich interfaces” stated in the Xiao Nrf52840 Sense ?? I’m not seeing it?
you have code or a schematic your using??
IFAIK…
I love me some Flacc audio files.
“The SparkFun I2S Audio Breakout board uses the MAX98357A digital to analog converter (DAC), which converts I2S (not be confused with I2C) audio to an analog signal to drive speakers. The I2S Audio Breakout converts the digital audio signals using the I2S standard to an analog signal and amplifies the signal using a class D amplifier which can deliver up to 3.2W of power into a 4Ω load. The board can be configured to output only the left channel audio, right channel, or both.”
HTH
GL :-p
edit: I see this in the Xiao esp32c3 but I believe it to be a misprint…
Seeed Studio XIAO ESP32C3 has rich interfaces.
There are 11 digital I/O that can be used as PWM pins and 4 analog inputs that can be used as ADC pins . It supports four serial communication interfaces such as UART, I2C, SPI and I2S . This wiki will be helpful to learn about these interfaces and implement them in your next projects! . ^^^^^^ nope.
On the nrf52840 I2S is supported in hardware. Or at least it should be, I haven’t been able to play an audio yet successfully.
It works but it sounds really poor.
Yes , I see where the peripheral is capable,
Why do you mentions pin 0-4 as the only ones usable?
Where in the schematics is that constraint expressed?
Not sure now , I’ll try and locate it but I know the NRf52 example shows pins 0-4.
Also if you use the I2C interface and Serial port , That’s all that is left. I know it says any Gpio pin with-in the 22 mux-io’s but seed only brings out a handful , also
if it sounds bad I may be configured for Phillips TDM instead of PDM or PCM.
HTH
GL
Map IO pins using the PINSEL registers
// MCK routed to pin 0
NRF_I2S->PSEL.MCK = (0 << I2S_PSEL_MCK_PIN_Pos) |
(I2S_PSEL_MCK_CONNECT_Connected <<
I2S_PSEL_MCK_CONNECT_Pos);
// SCK routed to pin 1
NRF_I2S->PSEL.SCK = (1 << I2S_PSEL_SCK_PIN_Pos) |
(I2S_PSEL_SCK_CONNECT_Connected <<
I2S_PSEL_SCK_CONNECT_Pos);
// LRCK routed to pin 2
NRF_I2S->PSEL.LRCK = (2 << I2S_PSEL_LRCK_PIN_Pos) |
(I2S_PSEL_LRCK_CONNECT_Connected <<
I2S_PSEL_LRCK_CONNECT_Pos);
// SDOUT routed to pin 3
NRF_I2S->PSEL.SDOUT = (3 << I2S_PSEL_SDOUT_PIN_Pos) |
(I2S_PSEL_SDOUT_CONNECT_Connected <<
I2S_PSEL_SDOUT_CONNECT_Pos);
// SDIN routed on pin 4
NRF_I2S->PSEL.SDIN = (4 << I2S_PSEL_SDIN_PIN_Pos) |
(I2S_PSEL_SDIN_CONNECT_Connected <<
I2S_PSEL_SDIN_CONNECT_Pos);
Old post too, can-a-xiao-be-configured-for-i2s
HTH
GL
Thank you.
I found the solution.
The PIN numbers used in NRF_I2S->PSEL registers are not the Arduino Logical pins.
So if you want to use pin 7, 8, 9 for example, you have to translate into P1.12, P1.13, P1.14 (see picture below)
Which means translates to register values of: 32+12, 32+13, 32+14.
If I didn’t get any audio instead of degraded output, I would have caught this faster.
Awesome… It’s should sound great in the end.
Great topic too.
GL
Put some code to do MP3 decoding and I2S playing here:
With inspiration of the code of @aovestdipaperino and some other snippets and infos I found, I managed to get proper audio output over I2S on the nrf52840. Thanks to everybody who posted info here!
For now the most important question I hoped to tackle is if this also works on the non-mbed enabled core. @aovestdipaperino confirmed that he wrote the library for the mbed core, and the other code snippets likewise. Has anybody tried I2S on the non-mbed core? Are there obvious reasons this could/couldn’t work? I have no idea in how to go about this, so I appreciate any hint! I saw something about an I2S.h arduino library, would that be a place to start?