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.

FFT library for Piccolo f28027 / SIMULINK

Other Parts Discussed in Thread: CONTROLSUITE

Hi,

I'm a new SW developer for this µC family.

I have some questions regarding to the implementation of a FFT algorithm in the chip f28027, family C2000.

 

- Is there an specific FFT library from TI for this chip? If yes, where can I find it?

- Is the library FFT 16x16 for the family C6000 compatible with the chip f28027? has anybody tried it?

- Has any body tried to generate code for a FFT routine with the FFT Simulink blocks? What was the experience?

 

Thank you in advance and best regards!

David

  • David,

    C2000 provides a comprehensive software library to support development with our devices called controlSUITE. Which you can download from www.ti.com/controlsuite

    Once downloaded take a look at our fixed point DSP library in:

    C:\TI\controlSUITE\libs\dsp\FixedPointLib\v101

    This library includes functions for real and complex FFTs as well as FIR and IIR filters.  The functions in this library are written in assembly and have been hand optimized by TI experts, so I would recommend you use these as a starting point (not C6000 libraries).

    Many of our customers do use Simulink to generate embedded code for our devices.  It has been our experience that while Simulink is an excellent tool for modeling, the code it generates is very inefficient.  The difference between a Simulink FFT on C2000 and the assembly FFT in our library will be orders of magnitude both in terms of speed and code size.

    Trey

  • Hi Trey,

     

    thank you for the fast and effective answer :-)

     

    I went through the libraries and yes they are much more smaller in comparison to the code that simulink generates from the FFT blocks. Actually when I  compile it I get problems with the size of the RAM in order to allocate the huge FFT tables that Simulink needs for its algortihm.

     

    Anyway I'm forced to keep working with Simulink and the f28027. In my first post I asked about the compatibility between the FFT libraries for the C6000 and its implementation on a C2000 chip, I did this becuase Simulink provides a block that calls directly the FFT libraries for the C6000 chips. I don't know who developed this, guys from TI or from Mathworks, but it would had been great that a block for the C2000 also would had existed. (It is useless to try the C6000 libs on C2000 families :S)

     

    So my plan is to create a mex file that interface the FFT library for C2000 and matlab and then to create a Simulink block, so I can still simulate it in Simulink, as it is already possible for the C6000 series. I'll share my advances.

     

    I appreciate any advice from the TI forum community.

     

    Best regards from Germany!

    David

     

     

  • David,

    While I'm not a simulink expert, I don't believe this will work.  You may be able to create a block or somehow link in our library to simulink, but I don't believe you will be able to simulate with it.

    I'm pretty sure that Simulink can only simulate C code.  Our FFT, FIR, and IIR libraries are all written in assembly.  For Simulink to be able to simulate assembly it would have to have a full processor model and understand the instruction set.  Given the number of processors supported, I don't believe this is the case.  This is why Simulink calls our compiler to build the embedded code for the device.  C is much more standardized and as such a common interpreter can be used to simulate C code designed to run on any given processor. 

    I wish you luck with your efforts, but I think you're going to run into a lot of trouble.  It sounds like your firm has already invested in Simulink, but in the future I would recommend you take a look at VisSim.  Its a Simulink knockoff, but is very powerful.  It can import MDLs from simulink and its embedded code generation tools are orders of magnitude better than Simulink's.

    Let us know if you are able to get the FFT blocks working in Simulink :)

     

    Trey

  • Hi Trey,

    thank you for the answer and for the advice about VisSim, I'm hearing more and more about it. I think now I'm curious about it.

    Yes, it is true, without a model of the HW I won't be able to simulate the asm libraries. I know that for other HW platforms like  ARM, it is possible to do it using  SW like OVP "open virtual platforms" , it can also interact  with simulink... Anyway my priority is the implementation and not the simulation.

    So, I'll be happy, if I'm able to substitute the FFT block of simulik  with the calling (S-function) of a C-routine that links with the FFT asm libraries, so when I build the code through Embedded Coder in Simulink,  the generated code for the target (F28027) will use the optimized FFT Libraries. Just ready to be compiled and ran in Code Composer :-)

    I'm working around with the TI FFT asm libraries and I realized that they are desgined for long data type (4 bytes), I think that the buffer memory addresses are prepared also for this data type. My plan is to work with 16 Bit word lenght data type, I don't need more, I'm building my input buffer directly from the 12 bit ADC.

    So the question is: could the FFT from TI libs  work with 16 Bit data type or they work just with 32 Bit? another question, what is the maximal length for a  real FFT, 512? in FFT.init it is possible to find the coefficients (long) of the Butterfly operations, where is this table allocated in the memory ?,  would it be necessary to redefine this table for 16 bit data type?

    David

     

  • Hi David,

    could the FFT from TI libs  work with 16 Bit data type or they work just with 32 Bit?

    The fixed point libraries use IQ math on 32 bit fixed point data types. I dont think it would be possible to switch over to 16-bit types without revamping the whole library.

    what is the maximal length for a  real FFT, 512?

    In the documentation for the fixed point lib, it seems that the max length for the real FFT is 1024, although the code in FFT32_calc.asm and the size of the twiddle factor table suggests you can go upto a 4096 point complex FFT (8192 for real)

    in FFT.init it is possible to find the coefficients (long) of the Butterfly operations, where is this table allocated in the memory ?,  would it be necessary to redefine this table for 16 bit data type?

    The table of twiddle factors is stored in a section "FFTtf". In the examples this section is allocated to a RAM section. This table is in IQ (32-bit) format and it will be necessary to redefine it if you decide to use 16 bit types.

     

  • Hi David,

    I am quite new with texas instrument and simulink and I would ask you in which development tool are you running (F28027)? because iIhave a program in simulink which is basically a field oriented control to control a BLDC motor and i would like to find a compatible developmento tool for simulink apart from eZdsp. are you using "Piccolo" F28027 ecperiment kit?

     

    Kind regads,

    David