SCI Data register problem

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

SCI Data register problem

1,774 Views
Tacky
Contributor I
Hey all:

  I am having a problem with the SCI Data register. I am sending bytes (via hyperterminal, hercules, and/or a self made app) through a RS232 cable to the board. The board (specifically SCI data reg [SCID]) receives all bytes properally....except... when I send 0x00 the SCID magically reads 0x80. And then occasionally when I send an opcode 0xD0 I get 0xC7 (about 30% of the time). These values are read from the SCID register itself immediately after sent (or last byte cleared).

I was wondering what might cause this problem and/or how to fix it.

Thanks in advance!
Labels (1)
0 Kudos
4 Replies

511 Views
peg
Senior Contributor IV
Hi Tacky,
 
It looks like a problem of baudrate mis-match.
Are you running on an internal clock?
Are you trimming it properly?
Is your code checking for framing errors? Are you getting any? (framing errors!)
What MPU are you using?
 
Using a SCI with a baudrate mismatch will function better when MSB is clear (as long as some bits are set).
 
0 Kudos

511 Views
Tacky
Contributor I
Peg:

Thanks for the reply

That's what I thought initially at first was a BR problem. But then I thought why would I receive all my other bytes correctly and ONLY 0x00 fails to 0x80 (with exception of 0xd0 to 0xc7. But I checked the bytes surroudning the 0xd0 and there is no possible way to create a 0xc7 with timing errors)

Either way, I rechecked my BR's and they all appear to be correct
for 9600 Baud on a 20 MHz Bus clock  SCIBD = Bus/(16*BR)    SCIBD = 9600
SCI1BDL = 0x82
Bus clock is actually 18.87 MHz, Maybe I should make this value closer? I get 0x7A

I am using internal clock
I'm not trimming at all? Not sure what it does or if I even need it?
No framing errors
MPU = (for now) M68DEMO908GB60 Demo board
but will be likely MC9S08GB60 or the GT60 when I'm done debugging

Thanks

**********EDIT************
How does the GB60 board expect SCI packets to be sent? Is it expecting a parity? How many stop bits?

Maybe there is a conflict with what the board expects from SCI and what I'm actually sending. If I only knew what the board wanted...


Message Edited by Tacky on 2007-06-08 02:49 PM

Message Edited by Tacky on 2007-06-08 02:50 PM

Message Edited by Tacky on 2007-06-08 02:52 PM

Message Edited by Tacky on 2007-06-08 02:57 PM
0 Kudos

511 Views
Tacky
Contributor I
AHA!

Thanks peg

I adjusted the baud for the newly calculated ICG (18.8728 MHz) instead of going off 20 MHz
and this seems to have fixed the problem!

Much thanks!

0 Kudos

511 Views
peg
Senior Contributor IV
Hi Tacky,
 
Unless you are lucky and get a MPU on your demo board with a internal reference that is very close to what it should be then you need to trim it for reliable SCI comms.
The internal reference varies in frequency from device to device.
Look at the manual under ICG or search this forum for TRIM perhaps.
If you changed the ICG setup to get it to work then perhaps you now have a theoretical baudrate which is now slightly faster than desired and before you had slightly slower (or the other way around) and now the error in the internal clock is now correcting rather than making the error worse. And that is why it works now, however you should not rely on this.
 
How about you tell us your ICG and SCI configuration values, before and now.
 
0 Kudos