2018-09-14 06:17 PM
#define RXBUFFERSIZE 2
uint8_t aRxBuffer[RXBUFFERSIZE];
static void MX_USART3_UART_Init(void) {
__HAL_RCC_USART3_CLK_ENABLE();
huart3.Instance = USART3;
huart3.Init.BaudRate = 115200;
huart3.Init.WordLength = UART_WORDLENGTH_8B;
huart3.Init.StopBits = UART_STOPBITS_1;
huart3.Init.Parity = UART_PARITY_NONE;
huart3.Init.Mode = UART_MODE_TX_RX;
huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
if(HAL_UART_DeInit(&huart3) != HAL_OK)
{
Error_Handler();
}
if (HAL_UART_Init(&huart3) != HAL_OK)
{
Error_Handler();
}
if (HAL_UART_Receive_IT(&huart3, (uint8_t *)aRxBuffer, RXBUFFERSIZE) != HAL_OK) {
Error_Handler();
}
}
void USARTx_IRQHandler(void)
{
HAL_UART_IRQHandler(&huart3);
}
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle)
{
ToggleLED(LED1);
}
My idea is that when I receive the byte, LED toggles. But instead of this, STM32F103RB is frozen. I do not see any problem. Can you help me please?
2018-09-14 07:09 PM
Try being explicit
And if you don't get a multiple definition error, check the macro