AnsweredAssumed Answered

illegal_bp

Question asked by zhanqiang qin on Dec 8, 2015
Latest reply on Dec 17, 2015 by zhanqiang qin

I am a college student and I met a problem when i was learning mc9s12p128.

The command window always warn me that there was a illegal_bp problem when i was debuging use TBDML,but when i try in full chip simulation mode ,there was nothing wrong!

i donnot know the reason,anyone knows?

 

#include "MC9S12P128.h"

void SetBusClock_16M() {

 

CPMUCLKS_PLLSEL = 1; //f(bus)=f(osc)/2   ;fosc = 4m

 

 

CPMUSYNR =0X43; //01000011

                        //fvco = 2*4*(1+1)/1 = 16m

                        //VCOFRQ[7:6]  SYNDIV[5:0]

                        //fVCO= 2*fOSC*(SYNDIV + 1)/(REFDIV + 1) =2*4M*(3+1)=32M

                        //fPLL= fVCO/(2 × POSTDIV)

                        //fBUS= fPLL/2

                        //VCOCLK Frequency Ranges  VCOFRQ[7:6]                       

                        // 32MHz <= fVCO <= 48MHz    00                       

                        // 48MHz <  fVCO <= 64MHz    01                       

                        // Reserved                  10                       

                        // Reserved                  11

CPMUREFDIV = 0X40;//0100 0000

                        //REFFRQ[7:6]  REFDIV[5:0]

                        //fREF = fOSC/(REFDIV + 1)

                        //REFCLK Frequency Ranges  REFFRQ[7:6]                       

                        // 1MHz <= fREF <=  2MHz       00                       

                        // 2MHz <  fREF <=  6MHz       01                       

                        // 6MHz <  fREF <= 12MHz       10                       

                        // fREF >  12MHz               11                                                

                        // pllclock=2*fosc*(1+SYNDIV)/(1+REFDIV)=16MHz;

CPMUPOSTDIV = 0X00;    //fPLL = fVCO/(1+POSTDIV)

 

 

CPMUOSC_OSCE = 1;    //choose osc as bus clock;

while(!(CPMUFLG_UPOSC==1)) {

_asm(nop);

_asm(nop);

}

while(!(CPMUFLG_LOCK==1)) ;   //WHEN PLL IS STEADY

//CPMUCLKS_PLLSEL = 1;        //

}

Outcomes