Malloc failing when called from firmware #15882
Unanswered
Larpncohez
asked this question in
RP2040 / Pico
Replies: 2 comments
-
In all honesty I am likely just going to order some analog microphones and wire things more directly. This is.... painful, but it would be nice to have clarification in the future |
Beta Was this translation helpful? Give feedback.
0 replies
-
You can try the Adafruit CircuitPython library for PDM microphones on the Pico. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I started by using the guide here to make the Adafruit PDM MEMS breakout function. I would have used the relevant circuitpython library but, from what I have seen, it isn't really meant to work with the pico. If I am wrong about that, it'd be immensely helpful.
GitHub page for this guide is here
After getting the library to compile and function properly, I attempted to make the library accessible through micropython, deciding to opt for rewriting the firmware after struggling with MPY files.
To do this, I used the following forum thread as guidance, replacing the mentioned core1_code with a slight variant of the code in examples/hello_pdm_microphone in the aforementioned GitHub page: forum
After several changes to CMakeLists and a weird series of file transfers, the module imports correctly, and after a lot of debugging I determined a line that seemingly causes the entire MicroPython backend to fail with Thonny being unable to recover the backend unless the pico is fully restarted.
Found on line 50 of src/pdm_microphone.c of the GitHub:
pdm_mic.raw_buffer[i] = malloc(pdm_mic.raw_buffer_size);
Is malloc just not supported when called from the firmware?
Beta Was this translation helpful? Give feedback.
All reactions