.. index:: autobaud, baudrate, serial, comms .. _autobaud: Autobaud ======== Autobaud for a Stm32F0xx Kernel ------------------------------- This Kernel Mod provides Autobaud which syncs to the Terminal after the Enter key is hit. The Baudrate stays in effect until the Target is rebooted or reset. Tested at 9600, 115200 and 460800 Baud on my STM32F051 Discovery Board which uses a STM32F051 MCU. Only works on USART1. .. warning:: If you normally reset the MCU before uploading new code (as I do), the serial comms will drop out unless you send some CR characters after the reboot or use "forgetram" instead of the "reset" Word if these preceed the new code. Assembly Source Mods ^^^^^^^^^^^^^^^^^^^^ File to mod is mecrisp-stellaris-X.X.X/mecrisp-stellaris-source/stm32f051-ra/terminal.s .. note:: Add the lines that start with a "+" but don't add the "+" itself. Leave all other code in your STM32F0xx terminal.s alone. :: @ Enable the USART, TX, and RX circuit ldr r1, =USART1_CR1 ldr r0, =BIT3+BIT2+BIT0 @ USART_CR1_UE | USART_CR1_TE | USART_CR1_RE str r0, [r1] + .equ USART1_ABREN_Shift, 20 @ bitWidth 1 + @ set up Autobaud + @ The automatic baud rate detection is activated by setting the ABREN bit in the USART_CR2 register. + ldr r1, = USART1_CR2 + movs r2, 0b01 + lsls r2, USART1_ABREN_Shift + str r2, [r1] bx lr .include "../common/terminalhooks.s" @ ----------------------------------------------------------------------------- Wortbirne Flag_visible, "serial-emit" serial_emit: @ ( c -- ) Emit one character @ ----------------------------------------------------------------------------- Rebuild your Kernel ^^^^^^^^^^^^^^^^^^^ :ref:`REBUILD The Kernel`