Change in simtrace2[master]: UART: switch baud rate to 921600 bps

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Kévin Redon gerrit-no-reply at lists.osmocom.org
Tue Aug 28 17:44:05 UTC 2018


Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/10669


Change subject: UART: switch baud rate to 921600 bps
......................................................................

UART: switch baud rate to 921600 bps

the higher baud rate allows for more debugging (without dropping
data) and is well supported by USB for UART adapters (this
standard baud rate is 8 x 115200).
the closest matching integer value is calculated for UART CR.
no floating point calculation can be used since this would
increase the size of the resulting binary by ~ 2kB (for the
softfp). this is not possible for the DFU since it already is
close to the maximum size of 16 kB.

Change-Id: I82b74f697342d580ccb79ada4715f35f4e8cca86
---
M firmware/libboard/common/include/board_common.h
M firmware/libboard/common/source/uart_console.c
2 files changed, 8 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/69/10669/1

diff --git a/firmware/libboard/common/include/board_common.h b/firmware/libboard/common/include/board_common.h
index db030ad..1155158 100644
--- a/firmware/libboard/common/include/board_common.h
+++ b/firmware/libboard/common/include/board_common.h
@@ -77,8 +77,8 @@
 #define PINS_UART  { PIO_PA9A_URXD0|PIO_PA10A_UTXD0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
 
 /** UART0 */
-/** Console baudrate always using 115200. */
-#define CONSOLE_BAUDRATE    115200
+/** Console baud rate in bps */
+#define CONSOLE_BAUDRATE    921600
 /** UART peripheral used by the console (UART0). */
 #define CONSOLE_UART       UART0
 /** UART peripheral ID used by the console (UART0). */
diff --git a/firmware/libboard/common/source/uart_console.c b/firmware/libboard/common/source/uart_console.c
index 3a00e49..bcfb0b7 100644
--- a/firmware/libboard/common/source/uart_console.c
+++ b/firmware/libboard/common/source/uart_console.c
@@ -85,7 +85,12 @@
 
 	/* Configure baudrate */
 	/* Asynchronous, no oversampling */
-	pUart->UART_BRGR = (masterClock / baudrate) / 16;
+	//pUart->UART_BRGR = (masterClock / baudrate) / 16;
+	if ((masterClock / baudrate) % 16 >= 7) {
+		pUart->UART_BRGR = ( masterClock / baudrate) / 16 + 1;
+	} else {
+		pUart->UART_BRGR = ( masterClock / baudrate) / 16 + 0;
+	}
 
 	/* Disable PDC channel */
 	pUart->UART_PTCR = UART_PTCR_RXTDIS | UART_PTCR_TXTDIS;

-- 
To view, visit https://gerrit.osmocom.org/10669
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I82b74f697342d580ccb79ada4715f35f4e8cca86
Gerrit-Change-Number: 10669
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon <kredon at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180828/4183d252/attachment.htm>


More information about the gerrit-log mailing list