Question: How do I calculate the clock input to an UART, TX8 or RX8 user module for a given baud rate? What are the various clock sources that can be used to clock an UART, TX8 or RX8?
Answer: The clock to the UART, TX8 and RX8 modules should be 8 times that of the baud rate. For example, the clock for a baud rate of 9600 should be 76.8KHz. As the PSoC is very flexible in terms of clock sources, an UART, TX8 or RX8 can be clocked by VC1, VC2, VC3, SysClk, SysClk*2 as clock source. Alternately, another digital block may also be used as a clock source.
First find out the divider required to divide the 24MHz SysClk (SysClk could be 12MHz or 6MHz if the SLIMO option is enabled in certain devices) to get the desired clock. Then select a combination of dividers using VC1, VC2, VC3 and / or a digital block, to achieve the nearest rounded divider.
Some real time examples are shown below. There can be innumerable other possibilities of deriving the clock.
Example: Baud Rate 9.6kbps
Clock = 9.6kbps * 8 =76.8KHzDivider required on 24MHz = 24MHz / 76.8KHz = 312.5
Round off the divider to 312. This rounding off will introduce an error of 0.16% on the clock. This is acceptable as the UART can have a maximum of 5% variation in clock.
Now, various combinations can be worked out to get this divider.
Option-1:
Clock to the UART = VC3
VC1 = 2
VC3 Source = VC1
VC3 Divider = 156
Option-2
Clock to the UART is a Counter placed in DBB00
VC1 = 2
Clock to DBB00 = VC1
Period of Counter = 155 (The divider is Period + 1)
Compare Value of Counter = 78
Connect Counter output to a Row Broadcast net and then connect to UART



