AnsweredAssumed Answered

SCI baud rate,  PLL ?

Question asked by Mohammad Shekarforoush on Jan 13, 2011
Latest reply on Jan 13, 2011 by Mohammad Shekarforoush

Hello again,

 

I'm able to send a receive the correct data using the below Initialization registers. My clock frequency is 4MHz and I'm using HCS12

void OpenSCI(void){    SCI0BDL=0x68; /* 4000000/16/2400==>2400 bps 4MHz is Bus clock for crystal freq of 8MHz*/               SCI0BDH=0x00; /* 0x00 ==>0x0068 is divisor to produce 2400 bps */    SCI0CR2=0x2C; /* enable SCI, enable receive interrupt */}

 

 

 

The problem starts when I change the clock from 4MHz to 24MHz using PLL code below and try to send data:

 

void Set_Clock(void){    CLKSEL &= 0x7F;    PLLCTL |= 0x40;    SYNR  = 0x05;    REFDV = 0x01;    while(!(0x08 & CRGFLG));    CLKSEL |= 0x80;} void OpenSCI(void){    SCI0BDL=0x71; /* 24000000/16/2400==>2400 bps 24MHz is Bus clock for crystal freq of 48MHz*/                 SCI0BDH=0x02; /* 0x00,0x0271 is divisor to produce 2400 bps */    SCI0CR2=0x2C; /* enable SCI, enable receive interrupt */}

 I can still send and receive data but its sending strange characters.

I think there's a problem with the baud rate. I have gone over the math and initialization and it looks correct.

 

Any ideas as to why I'm getting random characters ??

Outcomes