Jump to content
43oh

Ymir

Members
  • Content Count

    16
  • Joined

  • Last visited

  1. Hi, i need to use systick and serial comunication, but i cant serial communication works. I am using TM4C1294XL board. I've tested diferents values for Serial.setTimeout(10) (2, 10,50, 100) but no results Any idea? Thanks #include <stdint.h> #include "Energia.h" #include "driverlib/systick.h" #include "driverlib/systick.c" #include "driverlib/sysctl.h" #include "driverlib/adc.h" #include "wiring_private.h" #define pin 2 //PE4 #define SamplingFreq 60000 //Sampling frequency in HZ #define TickerPeriod (120000000/SamplingFreq) String inData = ""
  2. Ymir

    FFT

    First, sorry for not answer before, but i was incredibly bussy and couldnt test neither circuits nor the code deep. Anyway, I've used a function generator to test the accuracy and range of the code and it runs perfect from 30 Hz to 330Hz, i only tested my working range. Moreover i've tested the circuits linearity, and they are incredibly linear. So, with this results, i tested the input....when the input is direct from the guitar, the code runs, but when i use a microphone, suddenly appears a problem, the lowest string frequency, at 82Hz, it isnt detected but the code detect it sec
  3. Ymir

    FFT

    Yes, i modified the parameters to get a 1Hz resolution, giviing a 511Hz max frequency, it is true this values arent in the table. #define LOG2N 10 //log base 2 of the number of points, e.g. LOG2N = 8 is 256 points #define FREQ_RESOLUTION 1 //Frequency resolution of output in Hz #define ANALOG_IN 27 //analog input pin #define ANALOG_RESOLUTION 12 //CPU specific The problem is that sometimes it works right and suddenly it works wrong, detecting the main frequency or double frec (the second harmonic). I think it is an aliasing problem. Trying to so
  4. Ymir

    FFT

    Here ar all the data, after the LP filter unCorrectedSampleInterval = 978 micros totalTime = 1010654 micros expectedTime = 1001472 micros errorTime = 9182 micros sampleInterval = 970 micros
  5. Ymir

    FFT

    well the project is in the same point. I've check some LP filters but it doesnt work right. It stil detecting double low frequencies. Any good LP filter there? [...] for( i=0; i<nPts; i++) imag[i] = 0; // clear imaginary array for (i = 1; i < nPts; i++) { int gain = 0.01; //Filer A //real_LP[i] = (gain * real[i] + real[i-1])/(1+gain); //-----> gain=3; //Filter B real_LP[i] = gain * real[i] + (1-gain)*real[i-1]; //-----> 0<gain<1; } fix_fft(real_LP, imag, LOG2N, 0); // perform fft on sampled points in real[i]
  6. Ymir

    FFT

    In the lowest frequency doesnt match, but i think it is more a problem of amplification in the microphone, it amplifies the fundamental and its first harmonic, but the program detect only the harmonic instead the fundamental, however, the harmonic should be attenuate. In this way, i dont understand why the fft gives more importance to the harmonic when the fundamental is more powerfull. Tomorrow i'll use the debug print, I delete it before haved tested the program with the microphone, that's my fault. I suppose and hope i can, i'll try to implement a low pass filter by software
  7. Ymir

    FFT

    The code works but in the lowest frequency, note E wtih 82,4Hz, in which detect the double, 164Hz. I think this is because the microphone
  8. Ymir

    FFT

    I tried the FFT code with LOG2N = 8 and FREQ_RESOLUTION = 5 and it works, i also tried with LOG2N = 10 FREQ_RESOLUTION = 1, and works too. I have to remark that it takes more than 1 sec to get the data, but works. Im using a 555 circuit to test and a multimeter to measure the frequency (i dont have a counter and my oscilloscope is veeery old so this is the stuff with most accuracy i have and it is calibrated). i'll try to decrease the sampling time.
  9. Ymir

    FFT

    Ok, now works.....this is stupid, the program creates a libraries folder in the schektbook location and copied fix_fft.ccp and fix_fft.h there. I have delete it and now compiles. For detecting frequencies up to 400Hz with this values LOG2N = 8 FREQ_RESOLUTION = 5 should work?
  10. Ymir

    FFT

    The compiler folder is in a temp folder and those files are there. But now appears this errors: fix_fft\fix_fft.cpp.o: In function `fix_fftr(int*, int, int)': C:\Users\alvaro\Desktop\FFT\Energia\Afinador\libraries\fix_fft/fix_fft.cpp:169: multiple definition of `fix_fft(int*, int*, int, int)' fix_fft.cpp.o:C:\Users\alvaro\AppData\Local\Temp\build5236453045155780907.tmp/fix_fft.cpp:166: first defined here fix_fft\fix_fft.cpp.o: In function `fix_fftr(int*, int, int)': C:\Users\alvaro\Desktop\FFT\Energia\Afinador\libraries\fix_fft/fix_fft.cpp:285: multiple definition of `fix_fftr(int*, int, i
  11. Ymir

    FFT

    Yes, the library and the function are there
  12. Ymir

    FFT

    Im working on Energia v17 and windows 8, and after actualize that line, it is giving the same errors. I'll work on it
  13. I have changed the TickerPeriod value for 1363 so it work around 88kHz and the way to calculate frequency so the actual loop function looks (i post the whole code): // MISEA-UC3M 2014-15 // Programa base // Proyectos Experimentales I // Proyectos Experimentales II // Copy Right Universidad Carlos III de Madrid #include <stdint.h> // libreria estandar de tipos enteros (utilizados en las librerias siguientes) #include "driverlib\systick.h" // libreria estandar para el manejo de SysTick (header) #include "driverlib\systick.c" // libreria estandar para el manejo de SysTic
  14. Ymir

    FFT

    i'm very sorry cos im a noob with microcontroler and energia environment, but i have copied the 3 files (FFt.ino, fix_fft.ccp and fix_fft.h) in the same folder or sketchbook (named FFT) and i have the next compiling errors: FFT.ino: In function 'void setup()': FFT.ino:25:41: error: 'analogReadResolution' was not declared in this scope I tried to solved defining the resolution with this line: #define analogReadResolution 14 the 14 value it takes in fix_fft.h in #define ANALOG_RESOLUTION 14 but the i get this errors fix_fft\fix_fft.cpp.o: In function `fix_fft(int*, int*, int, i
  15. Ymir

    FFT

    Hi! Im working in a guitar tuner with a TM4C129 and i would use tour code to get the frequency, do you know if this code works in a tm4c129? Thanks
×
×
  • Create New...