ICG in M68DEMO908GB60, SCI interrupts and baud rate settings

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

ICG in M68DEMO908GB60, SCI interrupts and baud rate settings

1,750 Views
Nefertum
Contributor I
Hi!
I'm new to Freescale products and Codewarrior. I have a M68DEMO908GB60 board and I'd like to write working code to communicate with SCI1. I've tried an example, coming with codewarior v. 5.1, which uses a "busy way" to do echo with SCI1: it waits for RDRF flag, reads the data register, clear the flag and sends back data. I've tried it with hyperterminal and it works fine.
Things change when I want to set baud rate and to use interrupts. In some other application written specifically for this board (see for example AN2616), the internal clock generator (ICG) is set to operate in FEE, high range, so I think that there is an external oscillator and I compute: bus_clock = (f_crystal*64*N)/(R*2) where f_crystal is 32768Hz and N and R are multiplicator and divisor. Is that correct???
Then I wrote a Matlab program to calculate the best N, R and bus clock divisors to get a desired baud rate of 19200bps. Results are: N=10, R=1, bus clock divisor = 34. As for the interrupt handler, I wrote code to blink a led every time there's an interrupt request BUT when I use the application with hyperterminal, three incorrect characters appear in the console and they don't change, no matter what key I press on the keyboard and the led doesn't blink! Debugging in simulation mode things work fine, but I really don't know how to debug a SCI application with serial monitor, also because of loss of connection when I write baud rate registers!
Any suggestion about debugging? Is ICG set correctly? Is baud rate set correctly? And what about hyperterminal?
 
Thanks in advance for Your help
 
Labels (1)
0 Kudos
2 Replies

300 Views
Nefertum
Contributor I
I solved my problems!!! Thanks a lot for your help
0 Kudos

300 Views
peg
Senior Contributor IV
Hi Nefertum,
 
Refer to AN2494 for a spreadsheet to assist with all your clocking setups.
 
Although what you have seems to check out OK.
 
Regards
David
 
0 Kudos