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.

TMDSSOLARPEXPKIT: Sine anaalyzer with power calc.



When I try to add initialization, the output frequency is changed. 

After adding 

	sineanalyzer_diff_wpwr1.SampleFreq = 40000;
	sineanalyzer_diff_wpwr1.Threshold = _IQ15(0.2);
	sineanalyzer_diff_wpwr1.nsamplesMin = _IQmpy(_IQdiv((1.0),(50+5)),(40000));
	sineanalyzer_diff_wpwr1.nsamplesMax = _IQmpy(_IQdiv((1.0),(50-5)),(40000));

The output frequency of the inverter change from 50 to 37. When I comment that and leave the rest, the frequency is not changing. 

  • I am not sure how this is manifesting as a change in the inverter frequency. 

    Which build level are you testing at?  

    Also, I will recommend making sure you have not changed anything else inadvertently. 

  • Thank you for the answer, I am doing build 1. I sense it on the oscilloscope. When I comment all the lines I showed in post I have 50Hz, and then when I toggle the section I have 37Hz. 

  • This is a very old piece of code, and to be honest very tough to support at this point/ 

    Looking back the inv freq should be controller by the following 

    You can try putting that in the watch window and see if it is the same in both the conditions. 

    /* Signal Generator module initialisation */
    sgen.gain=0x7fff; /* gain=1 in Q15 */
    sgen.freq=0x14F8CF92; /* freq = (Required Freq/Max Freq)*2^31 */
    /* = (50/305.17)*2^31 = 0x14f8cf92 */
    sgen.step_max=0x3E7FB26;/* Max Freq= (step_max * sampling freq)/2^32 */
    /* =(0x3E7FB26*20k)/2^32 = 305.17 */
    sgen.phase=0x80000000; /* Phase=(required Phase)/180 in Q31 format */
    /* = (+90/180) in Q31 = 8000h */