2021-08-24 12:39 AM
Hi, all
I am trying to receive packet from uart3 and send them to uart2
but the results of my trials are:
which I thought was:
My problem is "once" and "every 65ms"
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) {
HAL_DMA_Abort_IT(&huart2);
}
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
HAL_UART_Receive_DMA(&huart3, (uint8_t*)b, 2);
}
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
HAL_UART_Transmit_DMA(&huart2, (uint8_t*)b, 2);
}
HAL_UART_Receive_DMA(&huart3, (uint8_t*)b, 2);
It's what I tried, "b" is uint8_t array
Thanks.
Solved! Go to Solution.
2021-08-24 01:02 AM
Hello @Frogram and welcome to the Community :)
Please take a look into the STM32 UART DMA RX/TX application note contains explanation with examples.
Hope this helps you!
When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.
Imen
2021-08-24 01:02 AM
Hello @Frogram and welcome to the Community :)
Please take a look into the STM32 UART DMA RX/TX application note contains explanation with examples.
Hope this helps you!
When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.
Imen
2021-08-24 01:06 AM
Thanks!
I will check them right now
2021-08-24 05:40 AM
I have no idea how to apply this in my project... TT
2021-08-24 11:19 AM
You don't need to call HAL_DMA_Abort_IT at the end of a completed transfer.
The other calls should work. Consider simplifying the problem by removing the timers and implementing a fixed delay. Toggle a pin instead of using UART to verify timings. Monitor return value from HAL calls to ensure they succeed.
2021-08-24 11:32 PM
/*inside of main*/
HAL_TIM_Base_Start_IT(&htim6);
HAL_UART_Receive_DMA(&huart2, (uint8_t *)b, 8);
/*outside of main*/
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim){
if (htim == &htim6) {
HAL_UART_Transmit_DMA(&huart3, (uint8_t *)b, 8);
}
}
It worked! thanks all