I2S on NUCLEO-4F01RE

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
tstokes
Posts: 3
Joined: Fri Oct 01, 2021 1:07 pm

I2S on NUCLEO-4F01RE

Post by tstokes » Fri Oct 01, 2021 1:55 pm

I've just built and flashed v1.17 to my NUCLEO in the hope of gaining I2S support but I've now realised it's not supported in this release.

Is there some physical limitation preventing this or just a case of it not yet having been implemented?

Is there any feeling for the work involved to get this running? (I work on embedded C but I'm new to micropython)

Thanks

Toby

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Current status of I2S

Post by pythoncoder » Sat Oct 02, 2021 8:52 am

I don't know about that particular board but I2S is still under development. This pull request is necessary for reliable playback. If you plan to use uasyncio, this pull request is also needed to avoid allocation problems.

That said, the maintainers do seem very committed to implementing I2S and, with those PR's, I have achieved reliable CD quality playback on a Pyboard D. However you do need a data source with adequate bandwidth. I have doubts that CD quality is currently achievable on a platform without an inbuilt SD card. But I believe Mike Teachman (I2S guru) is working on a solution to this.
Peter Hinch
Index to my micropython libraries.

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

Re: I2S on NUCLEO-4F01RE

Post by Mike Teachman » Wed Oct 06, 2021 4:35 am

tstokes wrote:
Fri Oct 01, 2021 1:55 pm
I've just built and flashed v1.17 to my NUCLEO in the hope of gaining I2S support but I've now realised it's not supported in this release.
I2S on the STM32 port was released for the boards that I could physically test with: pyboard v1.1 and pyboard D

I2S might work on your NUCLEO board by enabling the feature in ports/stm32/boards/<your board>/mpconfigboard.h and then compiling. Take a look at ports/stm32/boards/PYBV11/mpconfigboard.h

There are 2 macros that are used to enable the feature on a F4 processor

Code: Select all

#define MICROPY_HW_ENABLE_I2S       (1)
and

Code: Select all

// I2S buses
#define MICROPY_HW_I2S2             (1)
I added these 2 lines to

Code: Select all

 boards/NUCLEO_F401RE/mpconfigboard.h
and the code compiled and linked without error.

It might just work?

tstokes
Posts: 3
Joined: Fri Oct 01, 2021 1:07 pm

Re: I2S on NUCLEO-4F01RE

Post by tstokes » Fri Dec 17, 2021 12:39 pm

I can confirm that this does indeed work once configured into the build. Thank you for the clear instructions (and your GH examples which were very useful for verification).

I'd like to open a pull request for this. Are there any specific behaviours that need to be tested before I do?

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

Re: I2S on NUCLEO-4F01RE

Post by Mike Teachman » Sat Dec 18, 2021 1:04 am

Hey, that's great news.

For testing, it would be good to try I2S with both a DAC (Tx mode) and a microphone (Rx mode), but seeing it work on one of these should be adequate.

Post Reply