espressif / esp-dsp

DSP library for ESP-IDF
Apache License 2.0
465 stars 87 forks source link

Request: Is it possible to use ESP-DSP in Arduino for ESP32? #11

Closed ohnoitsalobo closed 2 years ago

ohnoitsalobo commented 4 years ago

My questions: 1) is it possible to use ESP-DSP in Arduino code, similar to other ESP-IDF code? 2) if yes, can you make a basic example I could follow?

Hello, I have made a working spectrum analyzer using ArduinoFFT (link) which is obviously not optimized for ESP32. Similar to this man's work. In my case I use it to drive an LED strip.

I generally do not use ESP-IDF as it is very confusing for me, however I am aware that some ESP-IDF functions are still accessible in the arduinoespressif32 framework. Is this possible with ESP-DSP?

I am actually attempting to use it right now, but as I am not a professional programmer my progress is very slow. A lot of compiler errors and definition errors etc. It will probably take me a week to do (badly) what you can do (properly) in an hour. So my request is: can you make an example using ESP-DSP FFT in Arduino? Similar to this ArduinoFFT example, reading values from an analog pin and running FFT on them.

Context: the ESP32 dev boards I bought are defective, locked at 160MHz from the factory. If the ESP-DSP code offers a performance boost that would be great. I use arduinoespressif32 framework in PlatformIO compiler, if that makes a difference.

rtufino commented 4 years ago

Hi. Can you solve this?

ohnoitsalobo commented 4 years ago

I wasn't able to get it to work. Hoping someone smarter than me weighs in eventually.

hamuro80 commented 3 years ago

I can use esp dsp under esp-isd with arduino as a component, but can't use it under arduino ide. I think someone should port the esp-dsp component to arduino library, any clue how to start?

standarddeviant commented 3 years ago

Is a PlatformIO project configured to use the Arduino framework a suitable solution? Their build flags system is flexible which helps. I think I've done this before and I'll post an example if I can confirm that I have it working.

standarddeviant commented 3 years ago

It's clunky, but have a look at this example that uses the biquad assembly function: https://github.com/standarddeviant/Demo_ESP32_PlatformIO_Arduino_ESPDSP

That repo builds for me. I moved source files in to lib/esp-dsp-pio/src and header files to lib/esp-dsp-pio/include.

Some of the FFT source/header files have issues with how they define some const arrays. You should be able to use ESP-DSP's FFT functions, but it will probably require some minor modifications of the FFT functions. I'll add to that repo and try to add the FFT functions.

michikite commented 3 years ago

you can use platformIO and build with both esp-idf and Arduino. The component is placed in a 'components' folder. Just tried that with dotprod example and it works fine.

Example settings:

platformio.ini

[env]
platform = espressif32
framework = 
    arduino
    espidf
monitor_speed = 115200
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#idf-release/v4.0

CMakeLists.txt

cmake_minimum_required(VERSION 3.16.0)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
list(APPEND EXTRA_COMPONENT_DIRS esp-dsp)
project(espidf-arduino-example)
me-no-dev commented 3 years ago

it's coming in Arduino 2.0.0

kylongmu commented 3 years ago

it's coming in Arduino 2.0.0

Where can see the message with Arduino 2.0 ?

igrr commented 2 years ago

esp-dsp has been added to arduino-esp32, so I'm going to close the issue.