Dear Staff,
I would like to ask for your kind help, as I'm trying to monitor the spectrum frequency from an I2S mems mic with the arduino IDE serial plotter.
In first place, I have few years of experience with arduino and microcontrollers (mainly 32u4 and esp32) and I feel somewhat comfortable in editing existing libraries. However, my knowledge of programming C++ is relatively basic and makers's level, not professional, and faraway from understanding all the code.
I have:
SPH0645LM4H (code 3421)
FEATHER M0 with Wifi (code 3010)
Alternately I also have a Feather ESP32.
Option A)
I followed this tutorial but I'm smashing against the Multiple definition of DMAC_Handler. As far as I read in this forum, no way to overcome it.
https://learn.adafruit.com/adafruit-i2s ... g-and-test
-Kindly, what type of boards are compatible with my I2S mic and the spectrum analyzer of the arduino sound library?
Option B)
I installed the Audio Adafruit library fork, but the FFT sketch does not compile for Feather M0, giving the following output:
C:\Users\......\Documents\Arduino\libraries\Audio_-_Adafruit_Fork/effect_delay.h:44:35: error: division by zero in #if
44 | #define DELAY_QUEUE_SIZE (6144 / AUDIO_BLOCK_SAMPLES)
C:\Users\......\Documents\Arduino\libraries\Audio_-_Adafruit_Fork/effect_delay.h:106:5: note: in expansion of macro 'DELAY_QUEUE_SIZE'
106 | #if DELAY_QUEUE_SIZE * AUDIO_BLOCK_SAMPLES < 65535
I tried to change the instructions in the file effect_Delay.h, but other errors come up.
-Kindly, any idea of how to solve it via software?
-Is this compatible with i2s mic and Feather M0?
Option C)
The third option is the FFT Test sketch of the library Adafruit Zero FFT library, which compiles, but has no interaction with the microphone.
I look forward to your kind reply with suggestions on where to focus my effort and eventually whether you recommend further hardware (mic, board..)
Thank you in advance.
Carlo
FFT/spectrum with Feather M0 & Sph0645
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- carlocosta2009
- Posts: 8
- Joined: Tue Sep 13, 2016 10:01 am
FFT/spectrum with Feather M0 & Sph0645
- Attachments
-
- hardware available
- Inked20210510_205224_LI.jpg (845.32 KiB) Viewed 1355 times
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: FFT/spectrum with Feather M0 & Sph0645
Option A is the one you want.
Post the exact error messages you get when you try to compile that code (between CODE tags please).
Post the exact error messages you get when you try to compile that code (between CODE tags please).
- carlocosta2009
- Posts: 8
- Joined: Tue Sep 13, 2016 10:01 am
Re: FFT/spectrum with Feather M0 & Sph0645
Mike,
Thank you for your quick reply.
The sketch is the default "SpectrumSerialPlotter" of the Arduino Sound Library, latest version 0.2.1
Arduino IDE version: 1.8.13
Adafruit_ZeroDMA version: 1.08
The compiling error is the following:
Grateful in advance for your kind support.
Regards
Carlo
Thank you for your quick reply.
The sketch is the default "SpectrumSerialPlotter" of the Arduino Sound Library, latest version 0.2.1
Arduino IDE version: 1.8.13
Adafruit_ZeroDMA version: 1.08
The compiling error is the following:
Code: Select all
c:/users/carlo/appdata/local/arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: libraries\Adafruit_Zero_DMA_Library\Adafruit_ZeroDMA.cpp.o: in function `DMAC_Handler':
C:\Users\carlo\BANNED\Documents\Arduino\libraries\Adafruit_Zero_DMA_Library/Adafruit_ZeroDMA.cpp:119: multiple definition of `DMAC_Handler'; libraries\I2S\utility\DMA.cpp.o:C:\Users\carlo\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.6.7\libraries\I2S\src\utility/DMA.cpp:418: first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Errore durante la compilazione per la scheda Adafruit Feather M0.
Grateful in advance for your kind support.
Regards
Carlo
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: FFT/spectrum with Feather M0 & Sph0645
Try removing the Zero_DMA library, or putting a ‘-‘ at the beginning of the folder name to keep the Arduino IDE from loading that library when it starts up. That should eliminate the conflict.
- carlocosta2009
- Posts: 8
- Joined: Tue Sep 13, 2016 10:01 am
Re: FFT/spectrum with Feather M0 & Sph0645
Hi Mike,
I made a fresh new installation of all, and removed the library Adafruit-zeroDma.
Now the compiling error is the below:
I tried to comment out the referring code-instruction in both the Sd2Card.cpp and/or SPI.h, but this triggers further (many more) compiling errors for nested instructions.
I'm not planning to use neither SD nor SPI on this simple application.
I look forward to further kind suggestions.
Regards
Carlo
I made a fresh new installation of all, and removed the library Adafruit-zeroDma.
Now the compiling error is the below:
Code: Select all
In file included from C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:31:
C:\Users\user\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.6.8\libraries\SPI/SPI.h:24:10: fatal error: Adafruit_ZeroDMA.h: No such file or directory
24 | #include <Adafruit_ZeroDMA.h>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Adafruit Feather M0.
I tried to comment out the referring code-instruction in both the Sd2Card.cpp and/or SPI.h, but this triggers further (many more) compiling errors for nested instructions.
I'm not planning to use neither SD nor SPI on this simple application.
I look forward to further kind suggestions.
Regards
Carlo
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: FFT/spectrum with Feather M0 & Sph0645
Hmm.. do you have a library named 'I2S' in your 'libraries' folder?
- carlocosta2009
- Posts: 8
- Joined: Tue Sep 13, 2016 10:01 am
Re: FFT/spectrum with Feather M0 & Sph0645
Dear Mike,
Thank you for your kind reply.
I confirm there is the library I2S version 1.0 in the following folder:
AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.6.8\libraries\
Carlo
Thank you for your kind reply.
I confirm there is the library I2S version 1.0 in the following folder:
AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.6.8\libraries\
Carlo
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: FFT/spectrum with Feather M0 & Sph0645
Try removing that one and replacing the Zero_DMA library.
The error is telling you that the compiler sees a conflict between the two libraries. You should only need one.
The error is telling you that the compiler sees a conflict between the two libraries. You should only need one.
- carlocosta2009
- Posts: 8
- Joined: Tue Sep 13, 2016 10:01 am
Re: FFT/spectrum with Feather M0 & Sph0645
Mike,
Removing the library I2S, the terminal gives:
I also tried to remove the DMAC definition at the end of the file
AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.6.8\libraries\I2S\src\I2S.cpp
which gives no compiling error.
I'm going to load the code into the board shortly and then post the feedback.
Removing the library I2S, the terminal gives:
Code: Select all
C:\Users\user\Documents\Arduino\libraries\ArduinoSound\src\AudioInI2S.cpp:19:10: fatal error: I2S.h: No such file or directory
19 | #include <I2S.h>
| ^~~~~~~
compilation terminated.
exit status 1
Error compiling for board Adafruit Feather M0.
I also tried to remove the DMAC definition at the end of the file
AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.6.8\libraries\I2S\src\I2S.cpp
Code: Select all
#else
void DMAC_Handler() {
DMA.onService();
}
I'm going to load the code into the board shortly and then post the feedback.
- carlocosta2009
- Posts: 8
- Joined: Tue Sep 13, 2016 10:01 am
Re: FFT/spectrum with Feather M0 & Sph0645
Mike,
I confirm that the sketch compiles and uploads, but the Serial Monitor/Plotter won't output anything at the selected frequency.
It did not work commenting out this from the file AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.6.8\libraries\I2S\src\utility\DMA.cpp.
Nothing from the serial monitor or plotter.
And neither adding the following to the Adafruit_ZeroDMA.cpp into the DMAC_Handler definition
Thank you in advance for any other comment or advice you could give.
Regards
I confirm that the sketch compiles and uploads, but the Serial Monitor/Plotter won't output anything at the selected frequency.
It did not work commenting out this from the file AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.6.8\libraries\I2S\src\utility\DMA.cpp.
Code: Select all
#else
void DMAC_Handler() {
DMA.onService();
}
And neither adding the following to the Adafruit_ZeroDMA.cpp into the DMAC_Handler definition
Code: Select all
DMA.onService();
Code: Select all
DMAClass DMA;
Regards
- skuenstler
- Posts: 8
- Joined: Tue Nov 17, 2015 6:00 am
Re: FFT/spectrum with Feather M0 & Sph0645
Very same problem here - did you ever find a solution to this DMA issue with the I2S microphone on an M0 ??
Please be positive and constructive with your questions and comments.