cancel
Showing results for 
Search instead for 
Did you mean: 

HAL UART IT stm32f091RB

rafik
Associate II
Posted on December 31, 2014 at 21:13

Hello.

for starters, I'm a beginner. So I want to use UART of STM32F091RB and for this I used STM32CUBEMX, and I found much difficulty, so I'll ask my questions. in my program I do not know when I will receive data from UART, so the program works and I want when I receive a data I'm going to treat it, so I used the interreption

GPIO_InitTypeDef GPIO_InitStruct;
if(huart->Instance==USART3)
{
/* USER CODE BEGIN USART3_MspInit 0 */
/* USER CODE END USART3_MspInit 0 */
/* Peripheral clock enable */
__USART3_CLK_ENABLE();
/**USART3 GPIO Configuration 
PC4 ------> USART3_TX
PC5 ------> USART3_RX 
*/
GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
GPIO_InitStruct.Alternate = GPIO_AF1_USART3;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/* System interrupt init*/
HAL_NVIC_SetPriority(USART3_8_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(USART3_8_IRQn);

Now I want to know what I should do after that and told me to préferanc, how routine switches the program when the MCU recoi a data, when in IT mode. excuse me for my bad english and Happy New Year #hal #uart #stm32f0
0 REPLIES 0