MC56F84763 PWM and ADC Synchronizzation

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MC56F84763 PWM and ADC Synchronizzation

962 Views
liviotilotta
Contributor I

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!!!

Labels (1)
Tags (1)
0 Kudos
Reply
1 Reply

742 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Livio,

Regarding your question, I think your scheme is too complicated. I think it is okay to use PWM triggering signal to trigger ADC directly via crossbar.

This is the scheme for example the PWMA_SM0_VAL0 can trigger ADC directly:

1)set the bit0 in PWMA_SM0TCTRL register.

2)set the XBAR_OUT12 bits with the code:

XBARA_SEL6 |=20; //the ADCA triggering source is XBAR_IN20, PWMA0_TRG0

it is okay, it is unnecessary to use quadTimer or PDB module.

Pls refer to the application note an4675(

Using eFlexPWM Module for ADC

Synchronization in MC56F82xx

and MC56F84xx Family of Digital

Signal Controllers

):

You can download an4675 from the website:

http://tinyurl.com/gwp4ug2

BTW, if you use complementary mode, if you use VAL2/VAL3 to control the rising/falling edge of PWM signal, VAL4 or VAL5 can be used to trigger ADC.

Hope it can help you.

BR

XiangJun Rong

0 Kudos
Reply