Other Parts Discussed in Thread: C2000WARE, DRV8353
Hi,
I'm trying to set up the PWM registers in the 2802, but they keep resetting to 0. If I try this manually with CCS in debug mode they all still revert to 0. Similarly for the ADC registers.
I can change the CPU core registers and the GPIO registers by the same method and these values stick. Can someone please assist?
oid init3ph(){
volatile Uint32 *pwm1BaseAddr;
volatile Uint32 *pwm2BaseAddr;
volatile Uint32 *pwm3BaseAddr;
// volatile Uint32 *pwm4BaseAddr;
Uint16 regOffset;
Uint16 reg_data;
pwm1BaseAddr = (Uint32 *)0x6800;
pwm2BaseAddr = (Uint32 *)0x6840;
pwm3BaseAddr = (Uint32 *)0x6880;
// pwm4BaseAddr = (Uint32 *)0x68c0;
EALLOW;
// setup code goes here..
//TBCTL
regOffset = 0x00;
reg_data = 0x0;
pwm1BaseAddr[regOffset] = reg_data;
pwm2BaseAddr[regOffset] = reg_data;
pwm3BaseAddr[regOffset] = reg_data;
//TBSTS tb Status
regOffset = 0x01;
reg_data = 0;
pwm1BaseAddr[regOffset] = reg_data;
pwm2BaseAddr[regOffset] = reg_data;
pwm3BaseAddr[regOffset] = reg_data;
//TBHSHR Extension for HRPWM Phase Register
regOffset = 0x02;
//TBPHS Time base Phase Register
regOffset = 0x03;
reg_data = 0;
pwm1BaseAddr[regOffset] = reg_data;
pwm2BaseAddr[regOffset] = 360;
pwm3BaseAddr[regOffset] = 720;
//TBCTR Time-Base Counter Register
//TBPRD Time-Base Period Register
regOffset = 0x03;
reg_data = 1080;
pwm1BaseAddr[regOffset] = reg_data;
pwm2BaseAddr[regOffset] = reg_data;
pwm3BaseAddr[regOffset] = reg_data;
}