Wrong predictions using Seeed XIAO BLE Sense (nRF52840)

Hi
I’m making a Voice Recognition project using Seeed XIAO BLE Sense (nRF52840). I’ve used Data Forwarding to get the audio data to Edge Impulse and it works just fine when i do the live classification.
When i use the Example present on the Arduino Library (nano_ble33_sense_microphone) it gets the results all wrong.
I’ve tried changing the PDM frequency and a bunch of other values or changing the board on the Board Manager and nothing worked.
Recently i noticed that i was using the Seeed nRF52 mbed-enabled Boards when i should be using Seeed nRF52 Boards but when i try to upload code it gives me this error:

Arduino: 1.8.19 (Windows 10), Board:“Seeed XIAO nRF52840 Sense, S140 7.3.0, Level 2 (Full Debug)”
c:/users/bmber/appdata/local/arduino15/packages/seeeduino/tools/arm-none-eabi-gcc/9-2019q4/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: sketch\objs.a(nano_ble33_sense_microphone.ino.cpp.o): in function `std::vector<unsigned long, std::allocator >::_M_range_check(unsigned int) const’:

c:\users\bmber\appdata\local\arduino15\packages\seeeduino\tools\arm-none-eabi-gcc\9-2019q4\arm-none-eabi\include\c++\9.2.1\bits/stl_vector.h:1070: undefined reference to `std::__throw_out_of_range_fmt(char const*, …)’

collect2.exe: error: ld returned 1 exit status

exit status 1

I used this code to data forward if it helps in any way:

#include <PDM.h>
short sampleBuffer[2048];
volatile int samplesRead = 0;

void setup() {
Serial.begin(115200);
while (!Serial);

PDM.onReceive(onPDMdata);
PDM.setBufferSize(2048);

if (!PDM.begin(1, 16000)) {
Serial.println(“Failed to start PDM!”);
while (1);
}
}

void loop() {
if (samplesRead) {

for (int i = 0; i < samplesRead; i++) {
  Serial.println(sampleBuffer[i]);
}
samplesRead = 0;

}
}

void onPDMdata() {
int bytesAvailable = PDM.available();
PDM.read(sampleBuffer, bytesAvailable);
samplesRead = bytesAvailable / 2;
}

Anyone got this problem too?

Hello @batataspam,

Can you try the static buffer example and let me know if it works?
Note that the Seeed Xiao BLE Sense is not officially supported so you might need to implement a few things yourself.

The static example should work, let me know if that’s not the case as I don’t have that board.

Best,

Louis