-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
RP2: Add Audio support for Arduino Nano RP2040. #8016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RP2: Add Audio support for Arduino Nano RP2040. #8016
Conversation
* An opensource PDM to PCM library from ST. Note, a pre-computed LUT stored in flash was added to the library. The LUT saves about 500uS per conversion (tested onRP2040), and can be enabled by defining USE_LUT=1.
958170f
to
6d73b03
Compare
Hi, @dpgeorge this has been ready for a while, it's the last missing feature for Nano-RP2040. Other than the |
Can I get feedback on this @dpgeorge ? |
Sorry this took a while to get to. Let me start with a high-level review (rather than technical coding details). With a module called But as far as I can tell, this PR adds a very specific driver for the MP34DT05 MEMS microphone, with an implementation that is tightly coupled to the rp2 port because it uses PIO (as well as PR2040 DMA). Is that PIO code 100% necessary? In other words, could this driver be adapted to work on an MCU without PIO? Considering it's a driver for MP34DT05, it would be better to call it the Regarding the API for this module/class: it would be worth considering matching (as much as possible) the In summary the theme here is:
|
This isn't a specific driver for I realize it's tightly coupled to |
…evkb-board Adds MIMXRT1060-EVKB as new board.
Is there anything happening with this MR? It would be great to have PDM support for RP2040. |
No, I just don't have the bandwidth to update this, but feel free to reuse the code and/or send it in another PR if you like (please keep the licenses if you do). |
No problem. Thank you for the quick reply, and the code. I do not have capacity to work on this either at the moment. But now everyone knows that this is up for grabs to finish :) |
This PR adds the following:
openpdm
: an opensource PDM to PCM library from ST. Note: a pre-computed LUT stored in flash was added to the library. The LUT saves about 500uS per conversion (as tested on RP2040), and can be enabled by definingUSE_LUT=1
.openpdm
, PIO program, and a C-level audio module. The audio module supports a dynamically configurable queue of PCM buffers, and can detect and (optionally) abort on overflows when they occur. The API supports both a blocking mode to read buffers from the queue usingget_buffer()
, and a non-blocking mode with Python user callbacks. The module can be compile-time configured to use asynchronous events withpendsv
(if available) or synchronous events withmp_sched_schedule
for the Python callbacks.Example usage:
Recording 5 seconds 16Khz audio in blocking mode, with 128 PCM buffers, and abort on overflow enabled.