DSP FIR filter component coefficients

For general Flowcode discussion that does not belong in the other sections.
stefan.erni
Valued Contributor
Posts: 997
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 190 times
Been thanked: 217 times

Re: DSP FIR filter component coefficients

Post by stefan.erni »

Hi Ben, Hi canary_wharfe

Thats look great!

To get the coefficients in Matlab looks easy.
https://www.mathworks.com/help/audio/re ... oeffs.html
just copy the coefficients A and B from here
Filter_Coef__Matlab_2021-01-05_17-36-05.png
Filter_Coef__Matlab_2021-01-05_17-36-05.png (7.89 KiB) Viewed 9587 times


And insert it in the flowcode component simple with copy/paste

[1,-3.99952432395,6.48507756685,-5.943973625,3.934505578198845,-2.015250091,0.592300881508,-0.070800793989557,0.017664812652882]

Just remove [ ]

Ok soon I will test it in the hardware.
Filter_Coef_2021-01-05_17-36-05.png
Filter_Coef_2021-01-05_17-36-05.png (39.27 KiB) Viewed 9587 times
regards

Stefan

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 686 times

Re: DSP FIR filter component coefficients

Post by BenR »

Thanks Stefan,

Fingers crossed :)

Should alwo work in simulation using the Data recorder window to see the waveforms. :D

canary_wharfe
Posts: 86
Joined: Thu Dec 10, 2020 3:54 pm
Has thanked: 6 times
Been thanked: 11 times

Re: DSP FIR filter component coefficients

Post by canary_wharfe »

Ben just wanted to say a BIG thank you for the way you jumped in and created this. Absolutely amazing!!!
I will test ASAP and let you know (currently attempting to update something on my PC and get it functional and then I can get back to Flowcode)
:-)

Oscar_T
Posts: 89
Joined: Wed Dec 02, 2020 10:06 am
Location: Italy
Has thanked: 37 times
Been thanked: 10 times

Re: DSP FIR filter component coefficients

Post by Oscar_T »

Hello everybody!

a nice discussion, I'd be curious to try the new implementations using an esp32 module.

By the way BenR, have you got to see if it is possible to implement the two i2s ports of the esp32 module?

Coupled with the dsp module, some interesting things could come out.

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 686 times

Re: DSP FIR filter component coefficients

Post by BenR »

Hello Oscar,

I2S is on my list and I've looked at the code again today. Hopefully I can roll this one out for you fairly quickly. Would you want input or output or both? I think the example I found only deals with outputs.

Oscar_T
Posts: 89
Joined: Wed Dec 02, 2020 10:06 am
Location: Italy
Has thanked: 37 times
Been thanked: 10 times

Re: DSP FIR filter component coefficients

Post by Oscar_T »

Hi BenR

I appreciate that it's on your list!

Ideally I would like to be able to use both ports to make a full duplex configuration (so input and output) https://docs.espressif.com/projects/esp ... s/i2s.html "Each controller can operate in half-duplex communication mode. Thus, the two controllers can be combined to establish full-duplex communication"

I also read some technical support regarding i2s to prevent any problems

For example in this forum it is recommended to set the esp32 module as master to prevent any problems

https://esp32.com/viewtopic.php?t=8084
moreover it is also important to manage timings and interrupts in order to prevent possible corruption in the output or input

https://www.esp32.com/viewtopic.php?t=10140

It would also be ideal to use a double buffer for sampled signals. This way while processing a buffer (perhaps with dsp components) I can sample another buffer without interrupting the communication.

the total latency would then be given by the length of the two buffers (as well as the time limit for processing the signal would be the length of a single buffer)

Regards

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 686 times

Re: DSP FIR filter component coefficients

Post by BenR »

Hello Oscar,

I've now had a go at adding I2S support for the ESP32 device. I've tested things compile and that's as far as I've got. I've got no other I2S hardware available so if you have the capability to test out the component that would be much appreciated.

Oscar_T
Posts: 89
Joined: Wed Dec 02, 2020 10:06 am
Location: Italy
Has thanked: 37 times
Been thanked: 10 times

Re: DSP FIR filter component coefficients

Post by Oscar_T »

Hi Ben

Thank you so much for making the component in such a short time! Give me a couple of days and I'll try the component

The esp32 module I will use is the following esp-wroom-32 (esp32_devkitc_v4)

Regards

Oscar_T
Posts: 89
Joined: Wed Dec 02, 2020 10:06 am
Location: Italy
Has thanked: 37 times
Been thanked: 10 times

Re: DSP FIR filter component coefficients

Post by Oscar_T »

Hi Ben

A little update on the tests I'm running

I have analyzed the signals with the oscilloscope and the clock seems correct.

Now I'm trying to make a simple a pass-through ( copy I2S input to I2S output dsp esp32 dsp but it doesn't seem to be working.

I want to ask you a few things

In the i2s component there is the read macro which has 3 parameters

Data
Lenght
Timeout

Timout refers to the number of ticks. how much is a single ticks worth?

alternatively, before proceeding with thepass-through we can analyze a single port at a time. Only thing I would like to understand how to generate a sinwave internally so that I can send it externally to my dsp

I am attaching the program
Attachments
esp32_00.fcfx
(9.47 KiB) Downloaded 642 times

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 686 times

Re: DSP FIR filter component coefficients

Post by BenR »

Hello,

In your program both I2S components are using Channel 1 which might be causing an issue.

I'm guessing a tick is 1/ the sample rate but I'm not 100% on this. The ESP library gives about as much information as I'm passing via the component.

Here's a program that generates a sine wave that is then sent to I2S.
esp32_I2S_Sine.fcfx
(12.57 KiB) Downloaded 624 times

Post Reply