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.

TMS320F28335: The output value is different from the calculated value when using c2000ware's SGEN library on 28335

Part Number: TMS320F28335
Other Parts Discussed in Thread: C2000WARE

When using c2000ware's SGEN library on 28335, the output frequency is different from the theoretical value calculated by me. The questions are as follows, I hope you can help me to answer them:

1. According to page 12 and page 13 of the guidance document sgen_mdl.pdf, I get that the output frequency = (Freq*step_max*Fs) /(2^16*2^15), the calculation method, may I ask whether the calculation method I summarized is correct

2. When SGENT_1 is used on 28335, what is Fs? How is this value calculated or viewed

3. sgen.calc(&sgen), how does this function in the routine achieve frequency tunability by returning only one sgen.out

4, the documentation is not the same as the code I downloaded in c2000ware, I use routines, his sgen.out does not return a value

Thanks

  • Hi, 

    Will reassign this thread to an expert. 

    Best Regards

    Siddharth

  • Hello, it looks like you have opened multiple posts on the same topic. It would help to consolidate to just one post.

  • Hi, I apologize for the delay

    The SGEN library has been archived and developers that developed the code is no longer in TI. But I'll try my best to answer your inquiry.

    1. The parameter freq is in Q15 format, so the derivation of freq would be in (Freq/Max_Freq), or (Freq/(step_max*Fs))*(2^16*2^15). Note that both "Freq", "Max_Freq" is in Q16 format. This derivation expanded the Max_Freq to obtain the 2^16 multiplier, but "Freq" is still in Q16 format.

    2.This Fs is determined by you and would be the part of calculation used for SGENT_1's freq and step_max.

    3. I'm not too sure what you meant by frequency tunability, you can try modifying the freq and step_max parameter dynamically in your routine and presumably would result in producing a sine wave of different sampling frequency.

    4.Do you mind disclosing the routine that you've used?

    We also release all SGEN implementations in source code, sgt1c.asm for instance, describes how sgen.calc is used for SGENT_1. In SGEN the sine wave generation is based on look-up tables and the output would be scaled by the gain and offset.

    Best,

    Sen Wang 

  • Does the FS sampling rate refer to the DAC sampling rate, or what?

    I am now using the SGEN library to generate sinusoidal points and then transfer these points to the DAC via IIS. Is FS the sampling rate of my DAC?

    The data I calculated according to the formula was actually brought in but only got 1.817khz waveform.

    I calculated it like this: the sample rate is 384Khz, and the maximum frequency is 20K

    20000 =(step_max*384K)/2^32

    freq=(10K/20K)*2^31

    But the waveform I actually got was 1.820khz,Why?

    thanks

    The main code is these three sentences,SGENHP_2 used:

    sgenhp_2.calc(&sgenhp_2);
    McbspaRegs.DXR2.all = sgenhp_2.out1;// 输出左声道数据
    McbspaRegs.DXR1.all = sgenhp_2.out2;// 输出右声道数据

  • Wrong. The actual frequency is 48.88Khz. I set it to 10Khz

  • Hi guanqisheng,

    My apologies, the SGEN is no longer in active support and I've also asked other expert to see if they know this and no one has tinkered with this lib before. We provide the source code for SGEN as-is and feel free to tinker around with the source code to see if it behaves in your flavor.

    Best,

    Sen Wang