How to transmit five byte data transmit in UART_DMA?
I already try for send five byte data in UART DMA. I am using the controller in STM32G030K6T6. Data transmition is working properly but output is did not taken properly. The problem was am transmit data five bytes for UART_DMA but DMA transmit only two bytes data. HAL_UART_Transmit_DMA call in timer interrupt handler to check the output for just now. The output is came but this is not proper output. this method for just call in to the interrupt handler output is continuously came for five bytes data. I need a output for 500 millisec once Five Bytes data transmit. I attach the output for picture and code. please tell what can I do for next step.


#include "main.h"
TIM_HandleTypeDef htim3;
UART_HandleTypeDef huart2;
DMA_HandleTypeDef hdma_usart2_tx;
/* USER CODE BEGIN PV */
uint16_t tim=0;
uint8_t tx_buf[5]= {0x01,0x02,0x03,0x04,0x05};
/* USER CODE END PV */
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_DMA_Init(void);
static void MX_USART2_UART_Init(void);
static void MX_TIM3_Init(void);
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_DMA_Init();
MX_USART2_UART_Init();
MX_TIM3_Init();
/* USER CODE BEGIN 2 */
HAL_TIM_Base_Start_IT(&htim3);
HAL_UART_Transmit_DMA(&huart2, tx_buf, sizeof(tx_buf)); // 500 msec once
/* USER CODE END 2 */
while (1)
{
}
}
void TIM3_IRQHandler(void)
{
/* USER CODE BEGIN TIM3_IRQn 0 */
/* USER CODE END TIM3_IRQn 0 */
HAL_TIM_IRQHandler(&htim3);
/* USER CODE BEGIN TIM3_IRQn 1 */
tim++;
if(tim==500)
{
__HAL_DMA_ENABLE(huart2.hdmatx);
tx_buf[0] = 0x01;
tx_buf[1] = 0x02;
tx_buf[2] = 0x03;
tx_buf[3] = 0x04;
tx_buf[4] = 0x05;
tim=0;
__HAL_DMA_DISABLE(huart2.hdmatx);
}
/* USER CODE END TIM3_IRQn 1 */
}