--- terminal.s-orig 2014-06-26 23:14:38.000000000 +1000 +++ terminal.s 2018-03-31 22:18:24.941482000 +1100 @@ -77,19 +77,24 @@ ldr r0, = BIT14 @ USART1EN str r0, [r1] - @ Set PORTA pins 9 and 10 in alternate function mode + @ Set PORTA pin modes: PA9 (TX)-OUTPUT, PA10 (RX)-INPUT, PA11 (CTS)-INPUT, PA12 (RTS)-OUTPUT ldr r1, = GPIOA_MODER - ldr r0, = 0x28280000 @ 2800 0000 is Reset value for Port A, and switch PA9 and PA10 to alternate function + ldr r0, = 0x2A80000 str r0, [r1] - @ Set alternate function 1 to enable USART1 pins on Port A + @ set PORTA Alternate Functions: PA9 (TX), PA10 (RX), PA11 (CTS), PA12 (RTS) all to AF1 ldr r1, = GPIOA_AFRH - ldr r0, = 0x110 @ Alternate function 1 for TX and RX pins of USART1 on PORTA + ldr r0, = 0x011110 @ Alternate function 1 for TX, RX, CTS and RTS pins of USART1 on PORTA (tp) str r0, [r1] - @ Configure BRR by deviding the bus clock with the baud rate + @ Configure BRR by dividing the bus clock with the baud rate ldr r1, = USART1_BRR - movs r0, #0x46 @ 115200 bps, ein ganz kleines bisschen langsamer... + movs r0, #0x46 @ 115200 bps, ein ganz kleines bisschen langsamer... a little bit slower... + str r0, [r1] + + @ Enable RTS/CTS flow control (tp) + ldr r1, = USART1_CR3 + ldr r0, = 0x300 @ Enable RTS flow control, RTSE (bit 8) = 1, and CTSE (bit 9) = 1 str r0, [r1] @ Enable the USART, TX, and RX circuit