Can a XIAO be configured for I2S?

After skimming through the SAMD21 datasheet I saw that the chip can support 1 I2S interface. My understanding is that the SERCOM are somewhat flexible. Can they be modified in code to get one I2S or is it completely disabled in this board?

The ATSAMD21G18 Support Inter-IC Sound (I2S) interface, from my search it also routed XIOA Board, I don’t about software support, but since XIAO have the debug port, we might can enable that.

I2S Pin list from the ATSAMD21G18 Datasheet

XIAO Schematic marked the I2S Pins.

Thank you for that information. I have been thinking about this and as you point out there is a debug port. So I wonder if the pin definitions are selected in the software kit from manufacturer and that is initialized in the bootloader. I know that if you use STM32 software to create firmware you can manipulate what interfaces to include in the design, for example do you want 2 SPI interfaces then you can deactivate other interfaces like lets say if the UART conflicts with a second SPI then you deactivate it. I have to admit I don’t have any particular need for a I2S on the XIAO but thank you again for looking into it, whoknows maybe I’ll have a real need for it later.

1 Like

I would really like to use an I2S MEMS microphone with the XIAO, does anyone know if it’s possible? I don’t fully understand the posts above…

I know the chip is capable, and it looks like the I2S Pins highlighted in the XIAO schematic are connected to some GPIO, but I’m not sure if there is additional configuration needed. Any help or pointers appreciated, as there is not much information out there yet it seems.

@BrianMoseley Does this meet your requirements?

Thank you @Baozhu. I will investigate that now to see if I can make use of some of those functions.

My aim is to monitor sound pressure levels and analyse pitch using FFT, rather than record audio. Size is very important, that’s why I am interested in using the XIAO over larger boards. I currently do this with an analog input, but would much rather switch to I2S.

As always, the best starting point is example sketches, but both the Seeeduino XIAO > I2S ones return this error

\AppData\Local\Arduino15\packages\Seeeduino\hardware\samd\1.7.9\libraries\I2S\src/I2S.h:111:2: error: #error “I2S is not supported on your board!”

The I2S.h library only seems to support arduino boards, so I don’t know if there’s another that does. I will do more investigating…

@BrianMoseley If you don’t mind switching hardware, I think this one suits you better.

Thanks @Baozhu, for performance and functionality, you are absolutely correct! That looks brilliant, but unfortunately my project is miniature, so the XIAO is the board I will have to use. I already have it all up and running with analog audio, I would just rather switch to digital I2S, if possible.

I have done as much research as I can and I now have I2S enabled, pins allocated correctly and the example sketch in Arduino IDE running fine, but get nothing back from the mic. I have amended variant.h, tried changing SERCOM and the I2S library, but am way out of my depth now.

I think it probably needs someone cleverer than me to make a new I2S library that works with this board. Unless, of course, it is not possible with this hardware…

Any updates on this?

@JoDu I never did get it to work. I ended up making my own mini custom board based around the ESP-WROOM-32 module. That way I could make use of the ESP32 I2S library. It works well, but the XIAO would have been much cheaper and simpler!

Thanks for the reply - looks like I’m marching down a similar path that you were. I’ll check out that module. Take care!

Do you mind sharing your schematics and how you got it to work? I just started messing with Arduino and It would be nice to have something to reference.

@james_ma Sure. If you’ve just started messing with Arduino, then you’ll probably be better working with existing microphone breakouts, such as the SPH0645LM4H, along with a suitable Arduino or ESP-32 development board (I couldn’t get this to work with the XIAO). I made sure my code worked on those first. However, if you wanted to make your own custom board too, then these are the schematics for my current version.

For size reasons, I am currently using the smaller TTGO Micro32 module, but I would generally recommend the more commonly available ESP-WROOM-32 instead (same pins). There’s USB input for power and data, a USB serial to UART chip for programming, dual transistors for putting the ESP into flashing mode and the MEMS microphone module.

Thanks for the info. I like the size of the xiao but I don’t have the time to try to reprogram the boot loader … I might try the esp32. How do you think the tiny pico would work?

Yes, the ESP pico is just a smaller version with the same functionality as far as I can tell, so you should be fine.