2020-09-03 01:45 AM
I generated the code for the uart in dma mode in a cube. But the data does not go, and the HAL_UART_Transmit_DMA function returns HAL_BUSY.
I already found a solution to the problem, just publish it.
The cube generates code:
MX_USART2_UART_Init ();
MX_DMA_Init ();
At the same time, in the first line of the indicated ones, it writes to the DMA registers, but they are not clocked and therefore nothing is written. Adding a block before MX_USART2_UART_Init () helped;
In my example, a working initialization looks like this:
/ * Configure the system clock * /
SystemClock_Config ();
/ * USER CODE BEGIN SysInit * /
MX_DMA_Init (); // need for normal uart work
/ * USER CODE END SysInit * /
/ * Initialize all configured peripherals * /
MX_GPIO_Init ();
MX_LPUART1_UART_Init ();
MX_USART2_UART_Init ();
MX_DMA_Init ();
thank