0

I'm writing a signal processing software in CVI. I've got a signal, transmitted to the computer via USB at a very high speed (~50K). I want to filter it in RT. In order to do it I created a filter in Simulink and turned it into a C code, which I run in CVI using:

  • FuncName_initialize()
  • FuncName.in
  • FuncName_step()
  • FuncName.Out

The thing is that after a while (about 5-7 min) the filter works wrongly... Meaning showing inaccurate results and artifacts. I believe this is a result of using it too fast (because I used it before at lower speeds and this was fine).

Any suggestions on what might be the problem? How can I implement a RT filter in CVI directly (meaning a one that get one point at the input and gets one point in the output while maintaining some window).

I know that the data transmitted just fine at this speed since recording the signal works OK, and showing the raw data on screen works OK as well.

Thank you

BioSP
  • 518
  • 4
  • 15
  • How many terms in your filter and what hardware are you running it on ? – Paul R May 16 '13 at 11:50
  • What do you mean by terms? There is an input (actually 2 but they run simultaneously), its a simple "fir" 32 coeff. I'm running this on my Pentium i3 windows 7 64 bit system. – BioSP May 16 '13 at 12:17
  • 1
    It sounds like your filter has 32 (or perhaps 63) terms, which should be well within the capability of your CPU at a 50 kHz sample rate. You should probably profile your code before you do anything else to see how much time is being spent in the filter and anywhere else and then based on that profile you can start to look at optimisation methods. – Paul R May 16 '13 at 12:37
  • Thank you Paul. This is what I meant to do, but the problem with this approach is that if the speed was too low then I would have seen this problem right from the start. But it starts after about 5 minutes of run. It's like there is some sort of a buffer filling, but I'm not sure where... Thank again – BioSP May 16 '13 at 12:44
  • 1
    Profiling wil give you a much better idea of what's going on. Note that it may not even be a performance problem, e.g. if you have a memory leak then you may start to get VM page faults which can then cause buffer overruns etc. – Paul R May 16 '13 at 12:46

0 Answers0