2017-08-04 06:16 AM
hi,
i have STM32F401 with uart1 configurate in DMA and i would like to add uart2 (in DMA or not)
is it possible to do it?
how i manage the IT flag?
UART1 DMA, call fct :
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *UartHandleArg)
{ WiFi_HAL_UART_TxCpltCallback(UartHandleArg);}but when interrupt is uart2, how i do?
thks
Yoann
2017-08-04 08:05 AM
Have a unique callback for each U(S)ART, or recognize which one is being discussed by looking at the passed in handle.
2017-08-04 08:36 AM
what function i call to recognize which one is being...?
2017-08-04 11:13 AM
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
{ if (huart->Instance == USART1) // change USART instance { // Handle/Dispatch USART1 Stuff Here }}2017-08-07 11:56 PM
hi,
of course!
i will check
thks
yoann
2017-08-31 02:21 AM
hi,
next of the topic,
i configure uart1 dma rx et uart2 it rx
uart1 work ok but uart2 Rx receive ONLY 1 char and not good size
example : uart2 must receive XR+S.BND=1 and in buffer i receive only X.
Program not enter in HAL_UART_RxCpltCallback because variable Message_push_ready always equal to RESET.
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle)
{ if (UartHandle->Instance == WB_WIFI_UART) //USART1 { /* Disable the Idle Interrupt */ __HAL_UART_DISABLE_IT(UartHandle, UART_IT_IDLE); Read_DMA_Buffer(); /* Enable the Idle Interrupt */ __HAL_UART_ENABLE_IT(UartHandle, UART_IT_IDLE); } else if (UartHandle->Instance == STM32_UART_MSG) //USART2 { Message_push_ready = SET; STM32_MSG_HAL_UART_RxCpltCallback(UartHandle); } }an idea why i receive only 1 char?
is it better to setup uart2 with DMA two?
how i can do that?
Thks
yoann
2017-10-09 01:05 AM
hi,
fixed, i didn't understand how works idle callback
see
https://community.st.com/0D50X00009Xkg8YSAR
.thks
Yoann