Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Lopy4 FFT (spectrum analysis) micropython, adding C code?

    Scheduled Pinned Locked Moved LoPy
    lopy4fftc code
    23 Posts 5 Posters 3.2k Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      KenM @crumble
      last edited by KenM

      @crumble said in Lopy4 FFT (spectrum analysis) micropython, adding C code?:

      @KenM

      ESP32 has some nasty memory problems when using both cores. This is fixed in freeRTOS by software. pycom updated it during rc0 and rc8 2 times.
      Float has a high memory load, so this may explain the speed difference, because it has to run through these fixes on each operation. Better slow as faulty. Even better would be an implementation with a lower memory load.

      It would take less memory, be much faster and allow more applications even audio analyzing if the basic DSP library that exist could be added. (https://github.com/espressif/esp-dsp/) (the library contains an int and float version in c and assembler for ESP32)
      But I don't know how to make it available in micropython (that general link wasn't very helpful)

      If PYCOM could make a guide how to add a new micropython function that gets an array and returns an array that would be very helpful!!

      EDIT from Pycom:
      To create a micropython module is pretty straightforward. In the respository Repo:

      • Go to the mods folder in pycom-micropython-sigfox/esp32/mods and create 2 files: modfft.c and modfft.h
      • Add the modfft.c file to application.mk. Add it to APP_MODS_SRC_C
      • Create the micropython fft type like mp_module_uqueue and add it to esp32/mpconfigport.h
      • As examples you can look at moduqueue.c, moduhashlib.c, etc.
      1 Reply Last reply Reply Quote 0
      • C Offline
        Clemens
        last edited by

        @KenM could you make any progress in this area? We, (especially @andreas :-) could manage to get digital audio data from an I2S mic on a FiPy, see https://community.hiveeyes.org/t/erschliessung-von-i2s-support-und-fft-fur-micropython-auf-pycom-esp32/2331/30 but we do not like to send raw audio via radio to a server. So the plan is to analyze the audio stream on the FiPy and submit only the result from a FFT.

        What is your recommendation to go on? Still using the https://github.com/espressif/esp-dsp/ for this task what means to implement it in the PyCom firmware?

        1 Reply Last reply Reply Quote 1
        • rcolisteteR Offline
          rcolistete
          last edited by rcolistete

          About FFT, there is 'ulab' module (a micro NumPy/SciPy) for Pycom MicroPython, see the topic "Pycom firmwares with single/double precision and ulab module".

          My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

          1 Reply Last reply Reply Quote 1

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • 1
          • 2
          • 2 / 2
          • First post
            Last post

          Pycom on Twitter

          Pycom