cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeF2 UART not sending more than 6 bytes

chris12892
Associate II
Posted on July 27, 2016 at 19:44

I'm using the STM32CubeF2 libraries on an STM32F Using the UART library, it seems like I can only send a few bytes before calls to HAL_UART_Transmit result in any additional sent bytes.

Code:

void ConfigureDebugUart()
{
// Enable clocks
__GPIOD_CLK_ENABLE();
__USART2_CLK_ENABLE();
// Configure GPIO
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Pin = GPIO_PIN_5 | GPIO_PIN_6;
GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
// Configure the USART peripheral
UartHandle.Instance = USART2;
UartHandle.Init.BaudRate = 115200;
UartHandle.Init.WordLength = UART_WORDLENGTH_8B;
UartHandle.Init.StopBits = UART_STOPBITS_1;
UartHandle.Init.Parity = UART_PARITY_NONE;
UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
UartHandle.Init.Mode = UART_MODE_TX;
UartHandle.Init.OverSampling = UART_OVERSAMPLING_8;
// Commit the USART
HAL_UART_Init(&UartHandle);
}
int fputc(int ch, FILE *f)
{
HAL_UART_Transmit(&UartHandle, (uint8_t *)&ch, 1, 0xFFFF); 
return ch;
}

Does anyone have an ideas as to what might be going on here?
0 REPLIES 0