Are there any code examples of performing a Hilbert transform on a Piccolo or any C2000 part?
Thanks!
Tim
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Are there any code examples of performing a Hilbert transform on a Piccolo or any C2000 part?
Thanks!
Tim
Tim,
Unfortunately, we don't have any Hilbert transform examples.
The only examples I could find are of FFT's and FIR filters here: controlSUITE\libs\dsp\FPU\v120\examples_ccsv4
Regards,
Alvaro
Hello,
I was the customer that requested this info from Tim.
I will continue to search for C code that can perform the Hilbert Transform, but I thought you guys might help me get started on other aspects of this application.
What I would ideally like to do is generate a sine wave with a range of 21 KHz to 25 KHz with a step resolution of 20 Hz. This sine wave would drive the device under test (DUT) and allow me to find and track its resonant frequency based on the output signal from the DUT. Its resonance is usually around 23 KHz and will change depending on certain environment changes.
I can detect the resonance in several ways.
First I can monitor the amplitude of the output signal from the DUT. When the amplitude is at its peak I am at resonance. This method is simple, but may not give me the resolution I need since the amplitude does not change much with several frequency steps around resonance.
Second, I could drive the DUT with a square wave and gain the resulting DUT output signal enough that it appears as a square wave input to the HRCAP of the TMS320F28035 that I am using. I could also feed the driving square wave into another input to the HRCAP. This would allow me to measure the phase shift (time) between the two signals with a 300 ps resolution. The phase should be very sensitive at resonance and allow me to detect resonance with higher resolution than the First method above that uses only the amplitude. This phase measurement may be sensitive to clock jitter noise and clock drift.
Third, from some investigation on the web, it seems I can filter out some of the noise issues by using the Hilbert Transform and a trigonometric ratio to measure the phase. This is why I thought I would give it a try. In order to do this, I believe I would have to produce a good sine wave for it to work and I am not sure if I have enough processing speed to perform the transformation with a sample frequency of 100 KHz or more.
So, with this said, I guess if you guys could just point me in the best direction by answering the questions below
I assume that I cannot produce a 21 KHz to 25 KHz sine wave with 20 Hz steps using the TMS320F28035 PWM. It seems I would need a much faster clock than 60MHz. Is this true?
If I need to produce a square wave from 21 KHz to 25 KHz, what is the best way to do this that would give me the highest resolution steps? Should I use a PWM output or a Timer output or some other method? If I could get better than 20 Hz steps that would be good.
Also I assume I should use an external crystal or clock to get the least amount of noise and jitter and to provide the most accuracy. If so, do you have any recommended parts for this?
I really need to track the 23 KHz resonance to within 20 Hz resolution, but at this point it sounds like tracking a needle in a haystack of noise. I am just looking for some suggestions that might give me the best chance of success and possibly save me some time by preventing me from heading down the wrong path. Any help would be appreciated.
Best Regards
Hi Gary
You can try to use Matlab with it's link to CCS to perform Hilbert transform in TMS320F28035. It generates a commented source code but this code is not optimized. Anyway it can serve as a start point for your investigations.
As for PWM generation I think it is possible to produce 25 kHz sin wave with PWM module but it will cause a big CPU load. May be CLA unit of 28035 can help with it. 25 kHz square wave generation with PWM unit is not a problem with the assumption all prescalers are 1. It looks the step must be around 11 Hz.
"a needle in a haystack of noise" -- beautiful phrase, I like it! :)
Regards
Hi Gary,
for signal generation, look at DDS. I think you should be able to generate mentioned sine wave with sample frequency around 500kHz. You would need to find if you can get the data out fast enough (assuming SPI connected DAC). the other solution is to have external counter (let's say 16 bit) which is connected directly to parallel DAC, and you generate the counter clock with the DSC (using HRPWM)
You can also simplify DUT measurement response with sliding DFT (you know the frequency of the signal, which you can use directly in DFT calculations. The phase angle can be obtained through A and B cofficents of DFT.
Regards, Mitja