|
Rockbox mail archiveSubject: Baud rate calculationsBaud rate calculations
From: Björn Stenberg <bjorn_at_haxx.se>
Date: Sun, 9 Dec 2001 13:54:01 +0100 (CET) I need a second pair of eyes here. Maybe I haven't slept enough this weekend... :-) I'm looking at the setup code for serial port 1. It sets SMR1 to 0 which means "asynch mode, bits 8N1, no clock divisor (n)". Then it sets BRR1 to 255. BRR1 is the baud rate register. The BRR setting is calculated as follows (p359): Asynchronous mode N = [f/(64 * 2^(2n-1) * B)] * 10^6 - 1 B: Bit rate (bits/s) N: BRR setting for baud rate generator (0 <= N <= 255) f: f frequency (MHz) n: Baud rate generator clock source (n = 0, 1, 2, 3) So what bit rate do we have? Breaking out B from the above should be: B = [f / N / (64 * 2^(2n-1)] * 10^6 - 1 N=255, n=0, f=12 gives me: 12/255/(64*(2^-1))*10^6-1 = 1469.588 bps 1470 bps? Please someone doublecheck my math. /Björn Received on 2001-12-09 Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |