SCI s08pa16 not working

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

SCI s08pa16 not working

716 Views
avditkohli
Contributor III

Hi,

I am  trying to work with SCI on the MCU mc9s08pa16 (32 Pins) and seem to set the right baud rate of 28.8k for a 8MHz clock and I think my initialisation is also correct but the output seems like garbage values. If I send 'A' 0x41 and 'B' 0x42, I observe 1F 0F on the terminal. I checked my hardware and it seemed to be working correctly.

 

 

void Init_SCI(void) // using TxD1 RxD1

 

{

SCI1_BDH = 0x00;

SCI1_BDL = 0x12; //Sets the baud rate at 28.8K bps for a bus clock speed of 8MHz ,decimal =17.36 ** I have tried pre scalars from 0x09 to0x16

SCI1_C1 = 0x03; //Sets 8 bit communication, with parity enabled and odd parity

SCI1_C2 = 0x00; //Not really required for our use, but none the less explicitly set

SCI1_C3 = 0x10; //Transmit output inverted hence TXINV set,to take care of the level shifter transistor in between

SCI1_C2_TE = 0b1; //Enable transmitter

SCI1_C2_RE = 0b1; //Enable receiver

SCI1_C3_TXINV = 0b1; //Invert transmit characters

}

 

 

void transmit_data(byte tx_data) //Tested fine with baud rate 28.8K, 7 data bits, 1 stop bit and odd parity

 

{

if(SCI1_C2_TE != 0b1) {SCI1_C2_TE = 0b1;} //Enable transmitter

while (SCI1_S1_TDRE != 0b1);

SCI1_D = tx_data;

}  //Sends one byte of data = tx_data to the PC

 

Thanks,

Avdit

Labels (1)
Tags (2)
0 Kudos
2 Replies

521 Views
arpitaagarwal-b
NXP Employee
NXP Employee

Hello Avdit,

Since you are able to get some characters on the terminal, this indicates your connections are good. It might be the issue of baud rate setting.

Try to use the baud rate which will give the integer value for BDL. For example, if Baud Rate = 10K, BDL will be 50.

This might avoid the garbage value.

Also if you want to use 28.8K, try writing 0x11 in BDL.

If this post helps you, kindly mark it as correct/helpful answer.

-Arpita

521 Views
avditkohli
Contributor III

I tried baud rates from 0x07 to 0x15 but none worked. Do you think I need

to initialize the SCI0 registers to 0 since I am using SCI1 channel?

Avdit

On Mon, Jul 14, 2014 at 4:29 PM, Arpita Agarwal <

0 Kudos