i2s compatibility

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
User avatar
Mike Teachman
Posts: 92
Joined: Mon Jun 13, 2016 3:19 pm
Location: Victoria, BC, Canada

Re: i2s compatibility

Post by Mike Teachman » Wed Feb 13, 2019 4:41 pm

Dogostyle wrote:
Fri Feb 08, 2019 4:58 pm
I have some questions though, why you decimate or prune your samples before saving into the SD?. And, how can I achieve full resolution (18bits) from the mic (https://cdn-shop.adafruit.com/product-f ... asheet.PDF)?
There is now a better way to save full resolution mic samples to external SD Card or the internal filesystem (credit to @MikeShi42 on github for this implementation). Please take a look at the new example#5 in the I2S usage guide. Compared to my previous post, this example uses 1/2 the DMA memory and does not require a prune() function.

The I2S guide also has a new example#4 describing how to use an I2S Microphone based on the INMP441 device (again, credit to @MikeShi42 on github for developing this example). The INMP441 I2S Mic is likely a better choice than the Adafruit I2S Mic which is based on the SPH0645LM4H device. Unfortunately, the SPH0645LM4H device was designed with non-standard I2S timing and appears to have some limitations when used with the ESP32 micro (and possibly other microcontrollers that support an I2S interface). I'll make a detailed post outlining these limitations in the near future.

Serjaru
Posts: 1
Joined: Mon Oct 21, 2019 8:40 pm

Re: i2s compatibility

Post by Serjaru » Mon Oct 21, 2019 8:44 pm

I can not understand if there is a fimrware.bim for esp32 with i2s support or not? everyone writes, even there are examples, but in reality I can’t find. I downloaded it from https://github.com/miketeachman/micropython and build, but "NameError: name 'os' isn't defined"

Where i can download ready firmware.bin with i2s????????

User avatar
jimmo
Posts: 1769
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: i2s compatibility

Post by jimmo » Mon Oct 21, 2019 11:25 pm

There isn't a pre-built firmware available for this. Hopefully it gets merged into master at quite soon and it'll just become part of the main firmware. You can follow the progress here: https://github.com/micropython/micropython/pull/4471

Anyway, when you built it yourself, where did the error come from? When you deployed the firmware or when you were building. Btw, you linked to the repo, but were you building the esp32-i2s branch? i.e. https://github.com/miketeachman/micropy ... /esp32-i2s

User avatar
Mike Teachman
Posts: 92
Joined: Mon Jun 13, 2016 3:19 pm
Location: Victoria, BC, Canada

Re: i2s compatibility

Post by Mike Teachman » Tue Oct 22, 2019 3:57 pm

Here is a binary to try out, in a Google Drive folder:
https://drive.google.com/open?id=1AlhGX ... nvgz57CibY

This firmware supports I2S using this commit PR https://github.com/miketeachman/micropy ... 10868dfa71 and includes the lastest Micropython commits as of Oct 22 2019.

I tested with one of the I2S examples using a Lolin D32 Pro module.
https://github.com/miketeachman/micropy ... -32bits.py

water
Posts: 35
Joined: Sun Sep 24, 2017 9:16 am

Re: i2s compatibility

Post by water » Wed Nov 13, 2019 8:36 am

Hi, I want to convert analog audio (Line in) via I2S, likes http://www.ti.com/lit/ds/symlink/pcm1808.pdf, please give some suggest.
Thanks.

User avatar
Mike Teachman
Posts: 92
Joined: Mon Jun 13, 2016 3:19 pm
Location: Victoria, BC, Canada

Re: i2s compatibility

Post by Mike Teachman » Thu Nov 14, 2019 2:47 pm

You might want to check out the ADC Data Collection feature in the Loboris port of the ESP32.
https://github.com/loboris/MicroPython_ ... o/wiki/adc

This feature uses an I2S peripheral to read an ADC and collect samples in the background using DMA.

This capability is not yet implemented in the mainline of MicroPython

mihazi
Posts: 2
Joined: Sun Jan 26, 2020 2:09 pm

Re: i2s compatibility

Post by mihazi » Sun Jan 26, 2020 2:18 pm

hello!
In this page
https://github.com/micropython/micropyt ... -i2s-class
described methods for streams (i2s.stream_out(stream))
Can i use it in your examples with MAX98357A, or this class is different?

User avatar
Mike Teachman
Posts: 92
Joined: Mon Jun 13, 2016 3:19 pm
Location: Victoria, BC, Canada

Re: i2s compatibility

Post by Mike Teachman » Sun Jan 26, 2020 3:49 pm

Hi,
This I2S class does not yet exist on any hardware platform. The page you listed is a proposal for a MicroPython I2S API. About a year ago I implemented the simplex, buffer-oriented part of this proposal, for the ESP32 platform. The stream part was started by @blmorris for the Pyboard in 2015 but still needs a bit work to complete.

In about a week I'm going to start work on the stream part of the proposal, with ambitions to implement a consistent I2S API across the ESP32 and Pyboard platforms. And, also to bring the I2S buffer-oriented capabilities to the Pyboard. If all goes well and our maintainers approve we should get I2S into the official build. Keep a lookout for an upcoming post on this topic. I'll be looking for help to get this done!

mihazi
Posts: 2
Joined: Sun Jan 26, 2020 2:09 pm

Re: i2s compatibility

Post by mihazi » Tue Jan 28, 2020 7:39 pm

got it! thank you! We are looking forward :D

janchri
Posts: 2
Joined: Thu Jan 30, 2020 1:13 am

Re: i2s compatibility

Post by janchri » Thu Jan 30, 2020 1:19 am

Hi,
I really like that I2S support for esp32 and other board is implemented in uPy! Super cool! I was wondering if your implementation can be used to work with one of Espressif Audio Boards like LyraT Series or the ESP32-A1S from AI-Thinker.

So far I am forced to used the ESP-IDF and ESP-ADF Framework, and I must admit, I hate it quite much. From your perspective, do you think it is possible to use your implementation and communicate over I2C and I2S with the audio codec chip on such a board?

Post Reply