2020-01-12 01:51 AM
i using the cubmx and generate the code.
I add the code in main function below ,(sur_dma_data[100] is arry and uint16_t size send i defined them before). but it is dose not work. can not see the any data from serilas port of my board . i check data with computer serials tools and also does not stop the brakerpoint at call back function. the DMA setings in cubmx are ok,
i set the breakpoint in call back function as below.
//*****within Mina()
HAL_UART_Transmit_DMA(&huart1,sur_dma_data,size_send);
//********
if i write this code HAL_UART_Transmit_IT(&huart1,Pdata,1); to replace above DMA. anything is ok - I can see data at serials tools and also the call back function is called.
// -------call backe function
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
//pro_counter++;
led_data=receive_data[0];
}
//------------
any one can help me to settle the probelem ? thank you very much.
2020-01-12 01:01 PM
Did you add the USART1_TX DMA channel in STM32CubeMX Configuration > USART1 > DMA Settings?
2020-01-12 04:44 PM
Read out and check the relevant DMA and USART registers content.
JW
2020-01-13 05:05 AM
HI KnarfB
thank you for your help.
all the setings and configruations are ok, and these set by Cubmx. I find out the problem ready. the problem is the executed squence of the DMA _int and uart1_int. it should be DMA_int firstly then uart1_int, otherwise it is does not work with DMA.
it work
MX_DMA_Init();
MX_USART1_UART_Init();
it does not work
MX_USART1_UART_Init();
MX_DMA_Init();
2020-01-13 05:07 AM
Hi Waclawek
thank you for your help.
all the setings and configruations are ok, and these set by Cubmx. I find out the problem ready. the problem is the executed squence of the DMA _int and uart1_int. it should be DMA_int firstly then uart1_int, otherwise it is does not work with DMA.
it work
MX_DMA_Init();
MX_USART1_UART_Init();
it does not work
MX_USART1_UART_Init();
MX_DMA_Init();
2020-01-23 06:30 AM
Is your code initially generated with latest STM32CubeMX version (5.5)?
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.