AnsweredAssumed Answered

Problems with uart communication on MC9S08PT60 mcu (CW 10.5 and 10.6)

Question asked by fredrikb on Apr 24, 2014
Latest reply on May 27, 2014 by fredrikb

Hi everyone!

 

I'm trying to communicate serially between a TWR-S08PT60 kit, and the hyperterminal in my PC,

with the Processor Expert component "term", and the code generated by it.

I seem to be having two different problems, I don't know if they are related to each other...

 

First, the baudrate is off by roughly 10%

When I set it to 9600 baud, the length of one bit sent from the mcu is 115us instead of 104us

Here are a couple of screenshots on how I've set the timing:

(I changed the internal oscillator to 36kHz to allow for a wide variety of baud rates)

Screenshot 2014-04-24 14.14.38.png

Screenshot 2014-04-24 14.22.11.png

I can trick it into communicating in the correct baud rate if I set the baud rate to 10500 though...

 

The second problem is more critical.

When the mcu is reading a character from the PC, it's reading two characters even if there are only one sent.

 

The following code should echo the received character back to the PC:

 

void main(void)

unsigned char ch;

while(1)

{

     Term1_ReadChar(&ch);

      Term1_SendChar(ch);

}

 

But in my case it echoes back two characters for every character it receives.

The first character sent is the same as it receives (as long as I have set the baudrate to 10500),

the second one is the same as the first BUT shifted one bit.

ie. if i send an ascii '4' (0x34)=(00110100) from the PC

I will receive '4Ü' from the mcu.

'Ü' (0x9A)=(10011010)

 

I've tried this with both  CW 10.5 and CW 10.6, but with the same result.

I've earlier done exactly the same thing with CW 10.2 and a MC9S08AW60 mcu, and it has worked well.

I've double checked the baud rate/parity/stop bit settings in hyperterminal.

 

Have I forgotten some settings, or is this a bug?

I'm very grateful for any input!

 

Best regards

Fredrik

Outcomes