2014-12-18 07:15 AM
Hello to everyone
i have being used to std library on stm. Now i passed to Hal library. I write an Usart code. I i dont use intrerrupt its work correct. But whe i set interrupt routine its not enter to RXNE IRQ handler. Code is below could you check and help me about my mistake.HAL_Init(); /* Configure the system clock */ SystemClock_Config(); HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_0); HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); saveToFlash(); MX_GPIO_Init(); HAL_GPIO_WritePin(GPIOH,GPIO_PIN_12,GPIO_PIN_SET); MX_USART3_UART_Init(); HAL_UART_Transmit(&huart3,(uint8_t*)dene,4,1000); while (1) { } }void USART3_IRQHandler(void){ HAL_NVIC_ClearPendingIRQ(USART3_IRQn); }void SystemClock_Config(void){ RCC_OscInitTypeDef RCC_OscInitStruct; __PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3); RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.HSICalibrationValue = 6; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; HAL_RCC_OscConfig(&RCC_OscInitStruct);}/* USART3 init function */void MX_USART3_UART_Init(void){ __GPIOC_CLK_ENABLE(); __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; huart3.Init.OverSampling = UART_OVERSAMPLING_16; HAL_UART_Init(&huart3); HAL_NVIC_SetPriority(USART3_IRQn, 0, 1); HAL_NVIC_EnableIRQ(USART3_IRQn); __HAL_UART_ENABLE_IT(&huart3,UART_IT_RXNE); __HAL_UART_ENABLE_IT(&huart3,UART_IT_TXE);}Thanx.2014-12-22 01:26 AM
You have to use HAL_UART_Receive_IT & HAL_UART_Transmit_IT.
-Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2014-12-24 12:56 AM
Hi,
Please Format Code Block - Paintbrush [<>] icon, upper left of Word-in-a-box(tm) interface..Regards,Heisenberg.