File tree Expand file tree Collapse file tree 10 files changed +60
-20
lines changed
06_drivers_gpio_uart/src/bsp/device_driver/bcm
07_uart_chainloader/src/bsp/device_driver/bcm
08_timestamps/src/bsp/device_driver/bcm
09_hw_debug_JTAG/src/bsp/device_driver/bcm
10_privilege_level/src/bsp/device_driver/bcm
11_virtual_memory/src/bsp/device_driver/bcm
12_exceptions_part1_groundwork/src/bsp/device_driver/bcm
13_integrated_testing/src/bsp/device_driver/bcm
14_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm
X1_JTAG_boot/src/bsp/device_driver/bcm Expand file tree Collapse file tree 10 files changed +60
-20
lines changed Original file line number Diff line number Diff line change @@ -174,8 +174,12 @@ impl PL011UartInner {
174
174
175
175
/// Set up baud rate and characteristics.
176
176
///
177
- /// Results in 8N1 and 230400 baud (if the clk has been previously set to 48 MHz by the
178
- /// firmware).
177
+ /// The calculation for the BRD given a target rate of 2300400 and a clock set to 48 MHz is:
178
+ /// `(48_000_000/16)/230400 = 13,02083`. `13` goes to the `IBRD` (integer field). The `FBRD`
179
+ /// (fractional field) is only 6 bits so `0,0208*64 = 1,3312 rounded to 1` will give the best
180
+ /// approximation we can get. A 5 % error margin is acceptable for UART and we're now at 0,01 %.
181
+ ///
182
+ /// This results in 8N1 and 230400 baud (we set the clock to 48 MHz in config.txt).
179
183
pub fn init ( & mut self ) {
180
184
// Turn it off temporarily.
181
185
self . registers . CR . set ( 0 ) ;
Original file line number Diff line number Diff line change @@ -174,8 +174,12 @@ impl PL011UartInner {
174
174
175
175
/// Set up baud rate and characteristics.
176
176
///
177
- /// Results in 8N1 and 230400 baud (if the clk has been previously set to 48 MHz by the
178
- /// firmware).
177
+ /// The calculation for the BRD given a target rate of 2300400 and a clock set to 48 MHz is:
178
+ /// `(48_000_000/16)/230400 = 13,02083`. `13` goes to the `IBRD` (integer field). The `FBRD`
179
+ /// (fractional field) is only 6 bits so `0,0208*64 = 1,3312 rounded to 1` will give the best
180
+ /// approximation we can get. A 5 % error margin is acceptable for UART and we're now at 0,01 %.
181
+ ///
182
+ /// This results in 8N1 and 230400 baud (we set the clock to 48 MHz in config.txt).
179
183
pub fn init ( & mut self ) {
180
184
// Turn it off temporarily.
181
185
self . registers . CR . set ( 0 ) ;
Original file line number Diff line number Diff line change @@ -174,8 +174,12 @@ impl PL011UartInner {
174
174
175
175
/// Set up baud rate and characteristics.
176
176
///
177
- /// Results in 8N1 and 230400 baud (if the clk has been previously set to 48 MHz by the
178
- /// firmware).
177
+ /// The calculation for the BRD given a target rate of 2300400 and a clock set to 48 MHz is:
178
+ /// `(48_000_000/16)/230400 = 13,02083`. `13` goes to the `IBRD` (integer field). The `FBRD`
179
+ /// (fractional field) is only 6 bits so `0,0208*64 = 1,3312 rounded to 1` will give the best
180
+ /// approximation we can get. A 5 % error margin is acceptable for UART and we're now at 0,01 %.
181
+ ///
182
+ /// This results in 8N1 and 230400 baud (we set the clock to 48 MHz in config.txt).
179
183
pub fn init ( & mut self ) {
180
184
// Turn it off temporarily.
181
185
self . registers . CR . set ( 0 ) ;
Original file line number Diff line number Diff line change @@ -174,8 +174,12 @@ impl PL011UartInner {
174
174
175
175
/// Set up baud rate and characteristics.
176
176
///
177
- /// Results in 8N1 and 230400 baud (if the clk has been previously set to 48 MHz by the
178
- /// firmware).
177
+ /// The calculation for the BRD given a target rate of 2300400 and a clock set to 48 MHz is:
178
+ /// `(48_000_000/16)/230400 = 13,02083`. `13` goes to the `IBRD` (integer field). The `FBRD`
179
+ /// (fractional field) is only 6 bits so `0,0208*64 = 1,3312 rounded to 1` will give the best
180
+ /// approximation we can get. A 5 % error margin is acceptable for UART and we're now at 0,01 %.
181
+ ///
182
+ /// This results in 8N1 and 230400 baud (we set the clock to 48 MHz in config.txt).
179
183
pub fn init ( & mut self ) {
180
184
// Turn it off temporarily.
181
185
self . registers . CR . set ( 0 ) ;
Original file line number Diff line number Diff line change @@ -174,8 +174,12 @@ impl PL011UartInner {
174
174
175
175
/// Set up baud rate and characteristics.
176
176
///
177
- /// Results in 8N1 and 230400 baud (if the clk has been previously set to 48 MHz by the
178
- /// firmware).
177
+ /// The calculation for the BRD given a target rate of 2300400 and a clock set to 48 MHz is:
178
+ /// `(48_000_000/16)/230400 = 13,02083`. `13` goes to the `IBRD` (integer field). The `FBRD`
179
+ /// (fractional field) is only 6 bits so `0,0208*64 = 1,3312 rounded to 1` will give the best
180
+ /// approximation we can get. A 5 % error margin is acceptable for UART and we're now at 0,01 %.
181
+ ///
182
+ /// This results in 8N1 and 230400 baud (we set the clock to 48 MHz in config.txt).
179
183
pub fn init ( & mut self ) {
180
184
// Turn it off temporarily.
181
185
self . registers . CR . set ( 0 ) ;
Original file line number Diff line number Diff line change @@ -174,8 +174,12 @@ impl PL011UartInner {
174
174
175
175
/// Set up baud rate and characteristics.
176
176
///
177
- /// Results in 8N1 and 230400 baud (if the clk has been previously set to 48 MHz by the
178
- /// firmware).
177
+ /// The calculation for the BRD given a target rate of 2300400 and a clock set to 48 MHz is:
178
+ /// `(48_000_000/16)/230400 = 13,02083`. `13` goes to the `IBRD` (integer field). The `FBRD`
179
+ /// (fractional field) is only 6 bits so `0,0208*64 = 1,3312 rounded to 1` will give the best
180
+ /// approximation we can get. A 5 % error margin is acceptable for UART and we're now at 0,01 %.
181
+ ///
182
+ /// This results in 8N1 and 230400 baud (we set the clock to 48 MHz in config.txt).
179
183
pub fn init ( & mut self ) {
180
184
// Turn it off temporarily.
181
185
self . registers . CR . set ( 0 ) ;
Original file line number Diff line number Diff line change @@ -174,8 +174,12 @@ impl PL011UartInner {
174
174
175
175
/// Set up baud rate and characteristics.
176
176
///
177
- /// Results in 8N1 and 230400 baud (if the clk has been previously set to 48 MHz by the
178
- /// firmware).
177
+ /// The calculation for the BRD given a target rate of 2300400 and a clock set to 48 MHz is:
178
+ /// `(48_000_000/16)/230400 = 13,02083`. `13` goes to the `IBRD` (integer field). The `FBRD`
179
+ /// (fractional field) is only 6 bits so `0,0208*64 = 1,3312 rounded to 1` will give the best
180
+ /// approximation we can get. A 5 % error margin is acceptable for UART and we're now at 0,01 %.
181
+ ///
182
+ /// This results in 8N1 and 230400 baud (we set the clock to 48 MHz in config.txt).
179
183
pub fn init ( & mut self ) {
180
184
// Turn it off temporarily.
181
185
self . registers . CR . set ( 0 ) ;
Original file line number Diff line number Diff line change @@ -174,8 +174,12 @@ impl PL011UartInner {
174
174
175
175
/// Set up baud rate and characteristics.
176
176
///
177
- /// Results in 8N1 and 230400 baud (if the clk has been previously set to 48 MHz by the
178
- /// firmware).
177
+ /// The calculation for the BRD given a target rate of 2300400 and a clock set to 48 MHz is:
178
+ /// `(48_000_000/16)/230400 = 13,02083`. `13` goes to the `IBRD` (integer field). The `FBRD`
179
+ /// (fractional field) is only 6 bits so `0,0208*64 = 1,3312 rounded to 1` will give the best
180
+ /// approximation we can get. A 5 % error margin is acceptable for UART and we're now at 0,01 %.
181
+ ///
182
+ /// This results in 8N1 and 230400 baud (we set the clock to 48 MHz in config.txt).
179
183
pub fn init ( & mut self ) {
180
184
// Turn it off temporarily.
181
185
self . registers . CR . set ( 0 ) ;
Original file line number Diff line number Diff line change @@ -226,8 +226,12 @@ impl PL011UartInner {
226
226
227
227
/// Set up baud rate and characteristics.
228
228
///
229
- /// Results in 8N1 and 230400 baud (if the clk has been previously set to 48 MHz by the
230
- /// firmware).
229
+ /// The calculation for the BRD given a target rate of 2300400 and a clock set to 48 MHz is:
230
+ /// `(48_000_000/16)/230400 = 13,02083`. `13` goes to the `IBRD` (integer field). The `FBRD`
231
+ /// (fractional field) is only 6 bits so `0,0208*64 = 1,3312 rounded to 1` will give the best
232
+ /// approximation we can get. A 5 % error margin is acceptable for UART and we're now at 0,01 %.
233
+ ///
234
+ /// This results in 8N1 and 230400 baud (we set the clock to 48 MHz in config.txt).
231
235
pub fn init ( & mut self ) {
232
236
// Turn it off temporarily.
233
237
self . registers . CR . set ( 0 ) ;
Original file line number Diff line number Diff line change @@ -174,8 +174,12 @@ impl PL011UartInner {
174
174
175
175
/// Set up baud rate and characteristics.
176
176
///
177
- /// Results in 8N1 and 230400 baud (if the clk has been previously set to 48 MHz by the
178
- /// firmware).
177
+ /// The calculation for the BRD given a target rate of 2300400 and a clock set to 48 MHz is:
178
+ /// `(48_000_000/16)/230400 = 13,02083`. `13` goes to the `IBRD` (integer field). The `FBRD`
179
+ /// (fractional field) is only 6 bits so `0,0208*64 = 1,3312 rounded to 1` will give the best
180
+ /// approximation we can get. A 5 % error margin is acceptable for UART and we're now at 0,01 %.
181
+ ///
182
+ /// This results in 8N1 and 230400 baud (we set the clock to 48 MHz in config.txt).
179
183
pub fn init ( & mut self ) {
180
184
// Turn it off temporarily.
181
185
self . registers . CR . set ( 0 ) ;
You can’t perform that action at this time.
0 commit comments