Help with triggering A/D from PWM in MC56F84789

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

Help with triggering A/D from PWM in MC56F84789

454 Views
ptszymanski
Contributor II

I am attempting to get the ADC12 and ADC16 to trigger from the PWMA output of SM0, SM1, and SM2 modules.  I have set the XBARA_SEL0, 1, 2 registers to map the pwm module's PWMA output to the ADC input, and similarly for the PWMB and and the ADC16. 

    XBARA_SEL0 = 0x140C;
    XBARA_SEL1 = 0x160D;
    XBARA_SEL2 = 0x180E;

When I run the code, the PWMA_SMxTCTRL register reads 0x0004 instead of 0x8004 (which is supposed to be setting the trigger for PWMA as a trigger).  The code does attempt to set the bit in PWMA_Init() in the PWMA.c module generated by ProcessorExpert (and similarly for SM1 and SM2),

  /* PWMA_SM0TCTRL: PWAOT0=1,PWBOT1=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,OUT_TRIG_EN=4 */
  setReg16(PWMA_SM0TCTRL, 0x8004U);     

but it doesn't get set when I look at it using CodeWarrior.  Any idea what is wrong?  Is this even possible with this chip?

0 Kudos
2 Replies

340 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Peter,

Pls refer to the screenshot in the MC56F847xxRM.pdf, if you want to use PWMA0_Trig0 to trigger ADCA, this is the crossbar setting:

   XBARA_SEL6 = 20; //the 20 means XBAR_IN20,    XBAR_OUT12 is  the ADCA trigger

If you want to use PWMA_Trig0 to trigger SAR ADC

  XBARA_SEL7 = 20; //the 20 means XBAR_IN20

Regarding the PWMA triggering setting:

setReg16(PWMA_SM0TCTRL, 0x04U);     //use VAL2 to trigger, do not set the PWMAOT0 or PWMAOT1 bits

Hope it can help you

BR

Xiangjun rong

pastedImage_1.png

pastedImage_2.png

0 Kudos

340 Views
ptszymanski
Contributor II

Thanks for reading, I figured it out...

0 Kudos