How to change the sampling frequency in c2000 F28027?
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.
How to change the sampling frequency in c2000 F28027?
Hi Gautam,
Can you tell me how to calculate the value of TBPRD for sampling frequency of 200Khz.
Regards,
Mani.
Hi Gautam,
I don't understand the calculation for TBPRD register in Up mode. In the ePWM reference guide it is given that T(pWM) = (TBPRD +1) * TBCLK.
But how TBPRD = 60Mhz/200Khz . Can you please elaborate.
I don't understand the calculation for TBPRD register in Up mode. In the ePWM reference guide it is given that T(pWM) = (TBPRD +1) * TBCLK.
This forumula is very well applicable when T(TBCLK) is scaled ie for example:
EPwm2Regs.TBCTL.bit.HSPCLKDIV = TB_DIV2; // Clock ratio to SYSCLKOUT EPwm2Regs.TBCTL.bit.CLKDIV = TB_DIV2;
Hence, T(TBCLK) in this case would be 60MHz/(2*2) = 15MHz
Now, lets calculate TBPRD for 50Khz PWM frequency:
2E-5 = (TBPRD + 1) * 6.67e-8
TBPRD = 299 or 300 if you want to round off.
Mani Sathasivam said:But how TBPRD = 60Mhz/200Khz .
This will if there are no scaling. For example:
EPwm1Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; // Clock ratio to SYSCLKOUT EPwm1Regs.TBCTL.bit.CLKDIV = TB_DIV1;
Then,
TBPRD = 60MHz/75KHz
TBPRD = 800
I hope you got this. You can use the first formula for any div_sel.
Regards,
Gautam
What is the revision of F28027 folder in ControlSuite that you use? Please use the example from the latest folder.
For example, mine is rev 222, and compared to your code, your code misses CLK_enableTbClockSync(myClk) line. And this is why the code doesn't work well.
Please get the latest one from C:\ti\controlSUITE\device_support\f2802x\v222\f2802x_examples_drivers\adc_soc
Best regards,
Maria
Hi, i've been trying to configure the sample rate of f28027 adc.
I set the TPBRD to 500 in order to obtain 100kHz, but i don't know how to verify this configuration. then i tried toggle a led before i read the ADC result, but it gives me 9.61 kHz so I don't know if i'm measuring wrong.
Regards
thank you