You should check your RAM usage, because in your code you define 4 float arrays with N elements (i count cosval[] and sinval[] in TWIDDLE struct as one array with N elements, as both have N/2 elements): datos[N], datos_real[N], datos_imag[N] and the said TWIDDLE struct. As a float value uses 4 bytes (32 bit), with 1024 points you already use 16 kB of RAM only for the arrays. With 2048 points you would need 32 kB only for the arrays.
It's of course true that the LPC1768 has 64 kB of RAM, but only the lower 32 kB are readily accessible for global and local variables and must share the space with stack and heap. So actually with 2048 points your code just crashes, because the arrays overlap with stack and heap.
You can use the upper 32 kB of RAM only if you don't use some specific peripherals (ethernet and ... i don't remember which ones exactly) as two blocks of 16 kB, but you have to use specific declaration directives (search for AHB RAM in this forum) for the definition of variables in that space.
Best regards
Neni
Hi! I made a program that first calculates the FFT of a signal, in this case is a sinus, and then sends it through the serial port. Then the variable "N" is the number of points that I take sinus signal, as a function of N I have an array of signal values larger or smaller. The value of N has to be a power of 2 to run the algorithm. The program runs correctly until N = 1024, when I test with N => 2048 points and not just run, it seems that the program counter is lost. As the program progresses LEDs are lit to know at what point to running. I noticed that it stops executing when it enters the void FFT function. But not know why you lose at that point. Someone can help me or give an idea of what may be the problem? program My program code is as follows:
/media/uploads/ddobano/fft.txt
Thanks!