New to 68K processors, need to understand baud rate settings

cancel
Showing results for 
Search instead for 
Did you mean: 

New to 68K processors, need to understand baud rate settings

258 Views
Contributor I

I need to set two serial communication baud rates for connecting to two different pieces of equipment on TPU channels 12 and 14.  Currently in the code both are set to 9600 baud.  Could you please help me understand these settings?

 

I'm new to the 68332 processor and am working on some old code written by someone else.  The code is completely uncommented, fragmented (so it is hard to tell what lines are setting the communications), and the is just filled with hex and binary codes that I think I have interpreted correctly from reading the manuals.  So, please help correct me if I'm wrong here with the relevant commands.  This is what I think the old code is doing.

 

* The CFSR0 is set to 10111011 binary, meaning to set TPU channels 12 through 15 to be UART.

* The TPU Channel 12 and 14 Match Rate is set to 218.  What does this do?

* The TPU Channel 12 and 14 Data size 8.  I assume this is for 8 data bits per serial communication frame.

* The HSQR0 is set to 11111111 binary, meaning TPU channels 12 through 15 are set to no parity.

* The HSRR0 is set to 10111011 binary, meaning TPU channels 12 and 14 are set to transmit and 13, 15 are set to receive.

* The CPR0 is set to 01010101 binary, meaning TPU channels 12 through 15 are set to low priority.

* The SCCR0 is set to 27, which gives a baud rate of 9600.  This confuses me since the manual leads me to believe that this would be a 19200 baud rate with a 16.6 MHz clock.  (By the way, how is the clock 16.6 MHz when it is connected to a 32 kHz crystal?).

 

Now, is that interpretation correct?  How do I get two different baud rates on channels 12 and 14?

 

Thanks

Labels (1)
0 Kudos
1 Reply

15 Views
Specialist I

Read Section 5, the SIM chapter to understand how the clocking generation works. Figure 5-1 should make it clear.

 

The TPU chapter says to refer to "TPU programming note Universal Asynchronous Receiver/Transmitter
(UART) TPU Function (TPUPN07/D) for more information.". Do you have that document? That's the one that will tell yo how to program the TPU Uarts the way you want.

> The code is completely uncommented, fragmented ... and the is just filled with hex and binary codes

 

I'd suggest finding or writing some header files that declare all of the register control bits with readable #defines, and then replace the code with that.

 

SCCR0 is a register in the QSM. The QSM consists of an SPI and an SCI. The SPI supports a serial protocol usually used ith memory and ADC chips. The SCI is a slightly broken single-channel UART. The code may be using the TPU UARTS as well as the SCI. I wouldn't expect the SCI baud-rate would have anything to do with the TPU baud rates.

 

> The SCCR0 is set to 27, which gives a baud rate of 9600.  This confuses me

> since the manual leads me to believe that this would be a 19200 baud rate with a 16.6 MHz clock.

 

D.4.5 SCI Control Register

SCI Baud Rate = Fsys/(32 * SCBR) which is Fsys/864 = 19,200.

 

I agree. The SCI UART is probably running at 19,200.

 

Tom

 

0 Kudos