Closed tiantian1645 closed 2 years ago
And a similar problem in Timer trigger ADC1 DMA ,it will only get in HAL_ADC_ConvCpltCallback once, but there is no problem if changed to ADC3,.
Hi @tiantian1645,
This is unfortunately a CubeMX generation problem. To fix the issue you can change the order of the initialization functions generated by CubeMX by placing the DMA initialization before the UART initialization as following :
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_USART2_UART_Init();
/* USER CODE BEGIN 2 */
Would you please update the initialization sequence as described above in the code snippet and check back if you still have the erroneous behavior or not.
With regards,
I had tried to swap the initialization sequence but it does not work. I am not able to check back because I have resigned from this project.
Hi @tiantian1645,
We have implemented the proposed fix on the code you have provide and it works perfectly. As explained in the first comment, the point you reported is related to the CubeMX generation problem and not to the firmware published in this repository. Please allow me then to close this thread as we don't treat aspect related to CubeMX tool in our GitHub repositories. Thank you for your comprehension and for your contribution.
With regards,
Describe the set-up
Describe the bug
12 34 56 78 12 34 56 78 12 34 56 78 12 34 56 78
but dma receive buffer is78 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
How To Reproduce
Indicate the global behavior of your application project. Use UART DMA receive and transmit like https://github.com/MaJerle/stm32-usart-uart-dma-rx-tx
The modules that you suspect to be the cause of the problem (Driver, BSP, MW ...). UART MSP Init
The use case that generates the problem.
How we can reproduce the problem. I upload a mina.c and a ioc file, you can use it and send 16 bytes from serial.
Additional context Just add HAL_UART_MspInit(&huart2) before start DMA , it works.
Screenshots
ioc file F1_DMA_Test - .ioc.txt
main.c