AnsweredAssumed Answered

MPC5604 eMIOS SAOCmode?

Question asked by BP HU on Jan 4, 2016
Latest reply on Jan 5, 2016 by Petr Stancik

hi,all:

i try to use the emios_0 channel18 in  SAOC mode to output a pulse. In the main(),  polling the EMIOS_0.CH[18].CSR.B.FLAG instead of using the interrupt.  but cannot find the FLAG set.

Here is the code:

(1)  how is BUS_ A's clock generated? how to confirm the clock work?                channel 18 has no internal clocks like channel 1-8, so choose the BUS_ A。

(2)  SAOC compared the data stored in the register A1 with internal counter, am i right?   what is the internal clock here?

(3) does the freeze mode matter when i use PE to debug SAOC,  i had disable the freeze mode ,but it didn't help.

emois_0_init()

{

  SIU.PCR[66].R = 0x0603;    //set as emios

 

  EMIOS_0.MCR.B.GPRE  = 63;        // global prescalser set 63

  EMIOS_0.MCR.B.GPREN = 1;         // prescaler enable

  EMIOS_0.MCR.B.GTBE  = 1;         // enable global time base

  EMIOS_0.MCR.B.FRZ   = 0;         // disable the freeze.

 

  EMIOS_0.CH[18].CCR.B.BSL   =  0;        //CLOCK select BUS_ A,

  EMIOS_0.CH[18].CCR.B.EDSEL  = 1;      //troggle

  EMIOS_0.CH[18].CCR.B.UCPRE =  0;      //prescaler set 1

  EMIOS_0.CH[18].CCR.B.UCPEN =  1;      //enable prescaler

  EMIOS_0.CH[18].CCR.B.FREN  =  0;      //disable freeze mode

  EMIOS_0.CH[18].CCR.B.FORCMA = 0;  //

  EMIOS_0.CH[18].CCR.B.FORCMB = 0;  //

  EMIOS_0.CH[18].CCR.B.MODE  =  3;    //select SAOC mode 

 

  EMIOS_0.CH[18].CSR.B.FLAG  = 1;

  EMIOS_0.CH[18].CADR.R=5000;

}

the main:

main:

{

    SWT_DisableWatchDog(); 

    SYSTEM_Init();    //64MHZ

     emois_0_init();

 

// EnableExternalInterrupts();

 

   while(1)

   {

      if(EMIOS_0.CH[18].CSR.B.FLAG  == 1)

      {

      EMIOS_0.CH[18].CSR.B.FLAG  = 1;

      EMIOS_0.CH[18].CADR.R=500;

      }

   };

}

 

thank you very much for your time !!~

Outcomes