1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00

Fixed terminal UART GPIO initialization. Even though UART was working, the previous UART TX (P5.0) initialization was making CAN TX (P3.2) not work, apparently because of IPConnected_Enabled on the GPIO_InitStructure. Probably it is safer always refresh the GPIO_InitStructure for every pin configuration on STR912.

This commit is contained in:
mauricio 2013-07-04 19:25:41 -03:00
parent 661e6855db
commit cef0fc45f5

View File

@ -118,16 +118,18 @@ static void platform_gpio_uart_setup()
{
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_StructInit( &GPIO_InitStructure );
// RX
GPIO_StructInit( &GPIO_InitStructure );
GPIO_InitStructure.GPIO_Direction = GPIO_PinInput;
GPIO_InitStructure.GPIO_Pin = uart_pin_data[ UART_RX_IDX ];
GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;
GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Enable;
GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1 ;
GPIO_Init( ( GPIO_TypeDef* )uart_port_data[ UART_RX_IDX ], &GPIO_InitStructure );
// TX
GPIO_StructInit( &GPIO_InitStructure );
GPIO_InitStructure.GPIO_Direction=GPIO_PinOutput;
GPIO_InitStructure.GPIO_Pin = uart_pin_data[ UART_TX_IDX ];
GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;
GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt3 ;
GPIO_Init( ( GPIO_TypeDef* )uart_port_data[ UART_TX_IDX ], &GPIO_InitStructure );
}