Go Down

Topic: FFT Library for Arduino Due, SAM3X (Read 25569 times) previous topic - next topic

CM_Guy

I was so, so tempted not to keep it civil but I refuse to lower myself. I did, however, try to make a point. The purpose of this forum is that people who need advice can ask for it and they should never ever be belittled for doing so, no matter how daft the question.

They guy is obviously brilliant but disdains people who are not so clever and dare to ask for help. I am not the first to feel his contempt for those mere mortals who are beneath him and I wont be the last. Just check previous posts.

Whilst my code may not be as efficient as it could be, I like so many others on here am self taught, having never had the opportunity to go to university and study this sort of thing because 40 years ago, when I left school, this sort of thing hadn't been invented and apart from that, I had to get out into the world and earn a living and was down t'pit at 16.

To be told my code is ridiculous is extremely offensive. I just wish I could un-karma him. My offer of several Keo's certainly does not stand unless he wants me to shove them up his A*SE. Anyway, I wouldn't waste good Keo, he can have Leon instead!

ArthurD

#76
Jul 04, 2016, 01:15 pm Last Edit: Jul 04, 2016, 04:45 pm by ArthurD
Quote
The purpose of this forum is that people who need advice can ask for it and they should never ever be belittled for doing so, no matter how daft the question.
I agree about that,

and I also agree about the fact that Arduino libs in general do not always keep in real life what they promise to be capable of even if they are provided "as they are" by authors who do all that nitty pretty work non-obligatorily in their spare-time.

But I also agree that for trouble-shooting a common test set is required so that the developers can try to reproduce the faults or failures.

ghlawrence2000

#77
Nov 19, 2016, 04:50 pm Last Edit: Nov 19, 2016, 07:17 pm by ghlawrence2000 Reason: Stupidity! :P
I know I will regret this in advance, and wholly expect the forthcoming flaming, however, I don't see the point creating another thread when my question pertains to the SplitRadixRealP library.

Here goes..........

I am not a novice, I am not a numbskull, but I know nothing about FFT. I have watched as many youtube video explanations as I can find and just ended up getting bogged down with Maths that is beyond me. When I did my electronics qualifications back in the mid 80's we were told FFT is a method of analyzing signals and you need a sample rate double the maximum frequency you wish to sample.

I understand the sample size will yield the same number of bins, I understand each bin to represent a single frequency.

From my limited knowledge and understanding so far, I can conclude that with a sample size of 2048, a SMP_RATE of 40000 will cover me to max frequency of 20kHz and give me frequency bins of  approx 10Hz, what I am not sure of is how to determine the CLK_MAIN value.

If somebody with time and patience could explain in simple terms how to determine the relationship between these settings and correct me if any of my previous assumptions are incorrect, I would very much appreciate it.

Once I have all of this clear in my own mind, I could then do with knowing how to make use of the data collected.

Many thanks,

Regards,

Graham

EDIT: So my question was stupid and premature............... I  will leave it here as a record, and explain my own question for the benefit of others just starting out in the world of FFT............

Code: [Select]
#define   SMP_RATE          40960UL
#define   CLK_MAIN       84000000UL


The CLK_MAIN which I saw various values for so experimented myself........... should not be changed and is the clock speed of the DUE (84MHz), with a SMP_RATE of 40960 and sample size of 2048, the frequency step is 20Hz for example....
Code: [Select]
      79 140 60 6 2 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

The peak value of 140 in element 1 =20Hz
Code: [Select]
       -8 2 0 0 0 0 0 0 0 0 0 0 60 142 60 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

and here, the peak value in element 13 =260Hz

I hope this helps somebody.

UTFT_SdRaw now included in library manager!! ;) High speed image drawing from SD card to UTFT displays for Mega & DUE.
UTFT_GHL - a VASTLY upgraded version of UTFT_CTE. Coming soon to a TFT near you! 8) Shipping April 1 2016!

abonellitoro

Hi! I'm trying to achieve a similar goal as @DAN_X (or the same). I need to achieve maximum resolution with FFT as I can. I was following the comments and trying to make it but the wordpress from @Magician is broken  :(

Quote
Meantime I've also found out about the mystic "sum_dif_I" issue, by reading Magicians FFT block again and again - of course.
It's really a clever value overflow protection for bigger FFT array sizes. Now I've got it.
But under normal conditions, it is for the DUE user not so relevant until 32bit values leave plenty of bit space left.
I'm working the last two weeks to readapt the code but I couldn't find the mystic "sum_diff_I" Issue that DAN_X is talking about. Anyone has done a similar project? I'm using the code given from magician with Radix4 algorithm, but I cannot do it work.

I'm using 4096 points LUT tables


VioletGiraffe

#79
Dec 29, 2017, 10:25 am Last Edit: Dec 29, 2017, 10:47 am by VioletGiraffe
The link to the library is dead again. Does anyone know how to get it? I was specifically interested in settings up ADC + DMA for sampling audio signals. I feel somewhat bogged down by hard-to-understand details when reading SAM3X datasheets and appnotes without a working example to look at.

Alternatively, what are some tried-and-true FFT / DCT libraries for Arduino Due?

ard_newbie


VioletGiraffe

#81
Dec 29, 2017, 04:17 pm Last Edit: Dec 29, 2017, 04:29 pm by VioletGiraffe
ADC + PDC DMA example sketch, see reply #8 of this thread


An FFT Library for the DUE:
Thanks for replying!
I have to admit, I have already seen both these resources today. The DMA example is interesting because it shows how to initialize the thing, but it doesn't show how to actually access the data in a real project. The problem is the example does all its work inside loop(), which is not practical when you have other tasks to perform.

And the FFT code confused me for two reasons: first, it takes the imaginary part as well as real, while the actual data is always real (I can substitute 0 for the Im values, but why does it even have to be there?) And more importantly, it uses floating-point operations which is super impractical on embedded systems. I don't in any way intend to diminish your achievement of writing and open-sourcing a human-readable implementation (thanks for your effort!), but it doesn't look like something I want to rely on in my pet project for which FFT is only the framework, the first stage of pre-processing after which many more computations follow.

ard_newbie

The DMA example is interesting because it shows how to initialize the thing, but it doesn't show how to actually access the data in a real project. The problem is the example does all its work inside loop(), which is not practical when you have other tasks to perform.

I think you don't understand how works the DMA, read again Sam3x datasheet PDC DMA section.
Although if you need a DMA to send data to the monitor, then you will have to write your own UART code.


BTW, I am not the author of the FFT Library. With some efforts, I guess you could use fixed point arithmetics instead of floating point operations.

VioletGiraffe

I think you don't understand how works the DMA
That could be. I need to process the data on the Arduino, don't need to send it further. I have started reading the datasheet.

Go Up