Main Site Documentation

USART1 on STM32F4xx


#1

May be other native developer has faced same issue on Cerberus firmware …
I can’t use USART1 (PB7-PB6 pins) as SerialPort on my firmware. When calling flush() (or the buffer overflow) the firmware stop responding. No problem on other USARTs (USART3).

I’ve corrected the code in STM32F4_usart_functions.cpp file:

	
// enable UART clock
	if (ComPortNum == 5) { // COM6 on APB2
		RCC->APB2ENR |= RCC_APB2ENR_USART6EN;
		clk = SYSTEM_APB2_CLOCK_HZ;
	} else if (ComPortNum) { // COM2-5 on APB1
		RCC->APB1ENR |= RCC_APB1ENR_USART2EN >> 1 << ComPortNum;
		clk = SYSTEM_APB1_CLOCK_HZ;
	} else { // COM1 on APB2
		// USART1 is not used on Cerberus but USART6 is used on Cerbuino.
		// This is just for Cerbuino. 
		//RCC->APB2STR |= RCC_APB2RSTR_USART1RST;
		RCC->APB2ENR |= RCC_APB2ENR_USART1EN;
		clk = SYSTEM_APB2_CLOCK_HZ;
		//RCC->APB2ENR |= RCC_APB2ENR_USART6EN;
		//clk = SYSTEM_APB2_CLOCK_HZ;
	}

I’ve also modified to run the correct interrupt routine.
No way to start the USART1. May be firmware debug reserve USART1 for some reason ?