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.

Generating high-precision low-THD sine wave on C2000 launchpad - 23377S

Other Parts Discussed in Thread: CONTROLSUITE

Dear Forum ,

We are in need of a signal generator functionality with accurate frequency control and low noise (THD). I have referred to code samples provided with ControlSUITE in SGEN library. This question is about understanding the three variations of sine-wave generators: 

1. SGENT : Standard THD

2. SGENTL: Low THD 

3. SGENHP: High-precision

I have been able to observe the sine-waves generated on 28377S. I want to understand the frequency control of these sine-waves. As the explanation in module's user guide suggests:  SGENT/SGENTL use a 16 bit modulo for calculation and use step = 2^16*f/fISR and SGENHP uses 32-bit modulo and step = f*2^32 / fISR, where f is the required frequency, and fISR is the ISR frequency = 20 kHz, as given in the examples. 

When I run the default code in SGENHP and SGENT which aims for a frequency of 50Hz, and sets the step and freq values appropriately, I get a SINE wave output as attached. I have changed the x axis representation to seconds from samples and I changed the y axis to Q1 format in place of Q15. From the graph we can deduce the period of sine wave to be around 400 seconds. This number was halved when I tried to set a frequency of 100 Hz in place of 50 Hz.

I have following questions regarding the generators:

1. How does the frequency of sine wave relate to the frequency we set (50hz) ? Also, if this is not the correct method of checking the period (frequency) of the generated sine wave, how should I do that ? I am sensing that this would relate to the SIGNAL_LENGTH (= 512) as well as number of points in SINE table ( = 256), but I am not able to deduce anything further.

2. What are the advantages of using high precision generator over SGENTL ? Is it only a higher frequency resolution given by Fmax/step_max or is there some advantage in THD quality as well ? The graph on page-5 and page-4 of the user guide look similar in terms of the generated signals THD. What then is the cost associated with using SGENHP ?

Thanks 

SGENHP and SGENT

  • Chintan,

    Different options are available for accuracy, speed trade-offs of sine value computation - in turn defined by the number of bits, table based approximation etc.

    1. For usage, there are details in the library documentation and you can also refer to some of the example projects/files like C:\ti\controlSUITE\development_kits\SolarExplorer_v1.0\SolarExplorer_PVInverter_F2803x\SolarExplorer-Main.c

    2. Resolution in terms of sine wave accuracy. You can get more steps as well for a given output freq of 50Hz by sampling faster than 20KHz.

    I'm not sure if I completely understood/addressed your question. Are you seeing any issues in the sine output being different from expected etc.?

    -Bharathi.
  • : Thanks for your reply. The example you cited uses the high-precision sine-wave, that I am interested in.

    I want to know the difference the between the various sine-wave generator options like SGENT, SGENTL, and SGENHP. For example, if we use sgenhp, we get high-precision in frequency control, buts does this result in a loss of overall frequency range ? If not, are there any disadvantages/trade-offs to using it ?

    Also, how can I use CCS to verify the frequency of the output sine wave ?

    Thanks
  • Hi Chintan,

    Precision is for sine value - it is determined by a fully table based approximation or combination of table based and linear interpolation techniques. The frequency resolution though , as described in the doc, is a function of step-max and fmax.
    So, for a same freq/step resolution you can get high precision output of sine value using HP variant.

    You can plot a graph using Graph utility of CCS for monitoring the sine wave. Assign the sine values obtained to an array and plot the array using graph utility.

    -Bharathi.