AnsweredAssumed Answered

MC56F84763 PWM and ADC Synchronizzation

Question asked by Livio Tilotta on May 8, 2016
Latest reply on May 9, 2016 by xiangjun.rong

Dear comunity,

 

I need support for solve a problem of syncronizzation between PWM and ADC.

In my application I use the DSP MC56F84763 and the PWM signal are generated according the center alligned method.

In my case the I can not use VAL0 register for to generate the synch between PWM and ADC.

On application note (AN4583) I have read that other method is to use a delay timer plus timer A3

 

This is my problem:

the synchronization work properly but in two case the point of synchronization is moved:

1) When I use the jtag for debug operation, the point of synchronization is different and is moved when a breakpoint is reached.

2) When I modify the code the inizialization timing is modified and the poind of synchronization is changed.

 

I need support for solve this problems!!!

 

reading this application note I write the following code:

 

//Crossbar configuration

//synch between delay timer PDB0 and Timer TA3

XBARA_SEL19 = 0x00<<CODE_1 | 0x27<<CODE_0;

//synch between Timer TA3 and ADC

XBARA_SEL6  = 0x00<<CODE_1 | 0x1C<<CODE_0;

 

//Timer A3 configuration

void timerA3_init(void)

{

    TMRA_3_COMP1   = 0x0032;                    //Set Compare register 1

    TMRA_3_CMPLD1  = 0;

    TMRA_3_COMP2   = 0x186a - TMRA_3_COMP1 - 1; //Set Compare register 2

    TMRA_3_CMPLD2  = 0;   

    TMRA_3_CNTR    = 0;

    TMRA_3_CTRL    = 0b110<<CM | 0b1000<<PCS | 0b11<<SCS | 0<<ONCE | 1<<LENGTH | 0<<DIR | 0<<CO_INIT | 0b100<<OM;

    TMRA_3_SCTRL   = 0<<TCF | 0<<TCFIE | 0<<TOF | 0<<TOFIE | 0<<IEF | 0<<IEFIE | 0<<IPS | 0<<INPUT | 0b00<<CAPT_MODE | 0<<MSTR | 0<<EEOF | 0<<VAL | 0<<FORCE | 0<<OPS | 1<<OEN;          

}

 

//delay PDB0 (the signal synchronization of pwm go on this delay timer)

void PDB_0_init (void)

{

    PDB0_MCTRL     = 1<<PDBEN_PDB | 0b000<<TRIGSEL_PDB | 0<<CONT_PDB | 0<<LDOK_PDB | 0<<LDMOD_PDB | 0b000<<PRESCALER_PDB;

    PDB0_MOD       = 7000;

    PDB0_CTRLA     = 0<<FLTA | 0<<FLTAEN | 0<<FPOLA | 0<<FLENA | 0<<DAF | 0<<DAIE | 0<<DBF | 0<<DBIE  | 0<<AINIT | 0<<ABSEL | 0<<BYPA | 0<<BYPB | 1<<ENA | 0<<ENB;

    PDB0_DELAYA    = 1600;   

    PDB0_MCTRL    |= 1<<LDOK_PDB;

}

 

Thanks!!!

Outcomes