Is there a working FFT code for the nRF52?

Did search, but was not able to find FFT code example for the XIAO 52840 BLE. Looking for Arduino IDE primarily. I am aware of the Nordic SDK FPU_FFT example. I am looking for a code that does not require a year of learning a new IDE to compile. I found the ArduinoFFT library too slow and wonky. And could not find a suitable Arduino CMSIS DSP FFT (arm.math) code that worked.

  • should have an ADC that can process signals minimum upto 30Khz, but preferably 100 khz (so an ADC with a 200-250kHz sampling rate)

You can take a look at the arm_math.h library.

Thanks, I did, but the Arduino IDE ADC codes do not seem to be fast enough when using it with the XIAO 52840 in mbed mode. And did not see an Adafruit FFT version for the nRF5x.

HI there,
SO allot has changed since your last post here,

The Nordic Nrf_SDK certainly does not take a year to learn LOL, Hilarious… :star_struck: I watched the tutorial and their Youtube videos, maybe spent about 3 hours and was compiling and flashing the demo code sketches AOK with total success, a day or two later I purchased the dev kit and I got the Jlink as a Bonus included for Debugging. I was able to build the demo’s and flash them to the Xiao, (see demo posts) It’s a great piece of kit and very easy to get around IDE, Way better than ANYTHING else. If your familiar with PLIO it works right in.
If you don’t want to do the work then just try “Chat GPT” sounds like that’s in your league maybe. However do be aware it isn’t “perfect” and you have to ask the right questions and provide some code to start with if your looking for a custom job. I usually upload the Device tree and my code stub I’m working on and it seems to work well that way.

HTH
GL :slight_smile: PJ :v:

BTW, The Nordic FFT example compiles and works well, it does matter which SDK release you have loaded. YMMV, the ARM math.h is the main workhorse.

#include <zephyr.h>
#include <device.h>
#include <devicetree.h>
#include <arm_math.h>
#include <arm_const_structs.h>

:+1: the dev academy courses are free and very, very good. If you don’t like “SLOW” or “WONKY” Start learning , your never to old.

1 Like

Thanks for the reply. Yes, I built the Nordic FFT already using Segger IDE along with the UART and SAADC examples. Had to use Segger Studio Arm 5.42a because most of their examples are 4 years old or older and Segger since changed to v8, merged two hardware IDEs into one, along with Nordic SDK changed as well so their latest SDKs are not backwards compatible.

Using the old Segger version 5.42a, I compiled the Nordic FFT example for a PCA10059 dongle fine. I had to change memory allocation in Segger IDE from PCA10056 to PCA10059, because its smaller and requires different memory addresses and Nordic did not have the example for the PCA10059 dongle.

But then realized that I cannot interface with it, because as of a few years now they moved to using their idiotic NRF-LOG, NRF_LOG_RAW print statements and the putty serial that was advised by Nordic did not work at all. My python is quite lacking.

And the Nordic CONFIG.h file has 4000 lines which I had to review/change at every example, since each example required a different enabling. And their libraries were also scattered around each example. Finally I noticed that they have a template project that has all the libraries included.

Then I bought a PCA10056 52840 DK and tried to merge the UART, FFT, and SAADC examples. But there is no auto-merge feature (at least not without a workaround in Segger) so must “add existing project” to current project and then by hand transfer the codes in the proper places, etc.

During testing a preliminary merged code with my J-Link Edu Mini and NRF Desktop Connect → Programmer the SDK board got bricked where even with Segger’s various tools were not able to repair. I opened a ticket with Nordic Dev Zone and waiting since all their usual fixes did not work.

I did ChatGPT also and tried the various codes, ArduinoFFT and arm-math versions, but the ones I found are too slow and wonky. I also transferred the Nordic FFT into Arduino into arm.math and compiled ok finally, but could not get the any results to Serial out, because I was not able to figure out how to translate the NRF_LOG forms into a Arduino IDE language. I also do not trust that the Arduino IDE takes advantage of the native Nordic codes to make the nRF52’s ADC run at max 200Khz and FFT at 4096 samples that can read/process a 10us burst sine wave.

I have a working FFT code in Arduino IDE using Teensy 4, but that’s an overkill at 600Mhz CPU and also eats 100mA. That’s why my original board was the XIAO 52840 and still want to use it.

Until my Nordic 52840 SDK is not working, I am stuck with the Nordic 52840 dongle, if I want to use the Nordic FFT example.

What I would appreciate help with is:

1. an example of the Nordic FFT that has UART added to it, or some other way to read AIN0 (A0) and feed that into the Nordic FFT example.

OR

2. Assist with “translating” the Nordic NRF_LOG into Arduino IDE print so I can do a Serial.print of the FFT results.

1 Like