Good morning!
Actually I'm setting up a connection between my FR6989 and an EA DOGS102-6 LCD and I'm trying to figure out the best bit rate which consumes less power, but still gives me smooth grafics.
My SMCLK is running at 1.8432MHz and is sourcing UCB1 in SPI mode. The FR6989 uses the eUSCI which, compared to the USCI, uses a different bit rate setting formula - at least the user's guide says it does, actually it does not as I figured out. Or I have misunderstood the description.
This comes from the FR6989 user's guide:
It says, that setting the right prescaler is done by:
Bit clock = ( SMCLK / ( UCBR + 1 ) )
Now I wanted to try 460.8kHz which is a quarter of 1.8432MHz, so the formula is:
460800 = ( 1843200 / ( UCBR + 1 ) )
UCBR = ( ( 1843200 / 460800 ) - 1 )
UCBR = 3
But writing 3 to UCBR register results in a divider of 3 which gives me 614.4kHz at a duty cycle 66% high / 33% low. Having a look at the description of the bit rate setting...
It says that odd UCBR settings result in even divisions with a duty cycle of 50% / 50%. But as far as I remember 3 is odd and it outputs an odd duty cycle. And I think there is a contradiction between the given formula and the description because the text says that the 16bit value forms the prescaler which on the other hand is correct.
Maybe I don't get it, but in my opinion the description in the user's guide is
a) wrong
b) misleading
It seems as if everything is equal to the older USCI modules. The given formula for calculating the bit rate for the USCI was:
BRCLK / ( UCBR0 + ( UCBR1 * 256 ) )
This one was clear to me. Writing 4 into UCBR0 resulted in a division of....surprise...4.
Here are the results for different UCBR values for the eUSCI with SMCLK running at 1.8432MHz:
- UCBR = 0 results in 1.8432MHz @ 50% high / 50% low
- UCBR = 1 results in 1.8432MHz @ 50% high / 50% low
- UCBR = 2 results in 921.6kHz @ 50% high / 50% low
- UCBR = 3 results in 614.4kHz @ 66% high / 33% low
- UCBR = 4 results in 460.8kHz @ 50% high / 50% low
- UCBR = 5 results in 368.64kHz @ 66% high / 33% low
- UCBR = 6 results in 307.2kHz @ 50% high / 50% low