Hey,
I've to get a PWM with 40kHz and 16-bit Resolution with a TMS320F2812. At first, is this possible? I need it for my bachelor thesis but I can´t get the right PWM. Either I get the 40kHz or the 16-bit Resolution on the Compare Register...
Actually I use the ev-pwm Code Sample and I've changed the Timer Period to 0x0E9F to get the higher PWM (40kHz)
EvaRegs.T1PR = 0x0E9F; // Timer1 period
After that I've changed the timer compare value( Is this the maximum value for the CMPRx register?) Now I thought I have a 16-bit resolution but the PWM Output is steady high until CMPR1 fall below 0x1000.
EvaRegs.T1CMPR = 0xFFFF; // Timer1 compare
Thanks in advance for your help!
FIY here is my whole EVA- Init
void init_eva()
{
// EVA Configure T1PWM, T2PWM, PWM1-PWM6
// Initalize the timers
// Initalize EVA Timer1
EvaRegs.T1PR = 0x0E9F; // Timer1 period
EvaRegs.T1CMPR = 0xFFFF; // Timer1 compare
EvaRegs.T1CNT = 0x0000; // Timer1 counter
// TMODE = continuous up/down
// Timer enable
// Timer compare enable
EvaRegs.T1CON.all = 0x1042;
// Initalize EVA Timer2
EvaRegs.T2PR = 0x0E9F; // Timer2 period
EvaRegs.T2CMPR = 0xFFFF; // Timer2 compare
EvaRegs.T2CNT = 0x0000; // Timer2 counter
// TMODE = continuous up/down
// Timer enable
// Timer compare enable
EvaRegs.T2CON.all = 0x1042;
// Setup T1PWM and T2PWM
// Drive T1/T2 PWM by compare logic
EvaRegs.GPTCONA.bit.TCMPOE = 1;
// Polarity of GP Timer 1 Compare = Active low
EvaRegs.GPTCONA.bit.T1PIN = 1;
// Polarity of GP Timer 2 Compare = Active high
EvaRegs.GPTCONA.bit.T2PIN = 2;
// Enable compare for PWM1-PWM6
EvaRegs.CMPR1 = 0x0F00;
EvaRegs.CMPR2 = 0x1F00;
EvaRegs.CMPR3 = 0xDF00;
EvaRegs.ACTRA.all = 0x0555;
EvaRegs.DBTCONA.all = 0x0000; // Disable deadband
EvaRegs.COMCONA.all = 0xA600;
}