2016-12-08 12:38 AM
I'm trying to send data by STM32f103 to an Arduino board using UART. Data isn't received properly. The code is generated using STM32CUBEMX and here is the part I added:
uint8_t Test[] = '1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 \n'; //Data to send HAL_UART_Transmit(&huart1,Test,sizeof(Test),1000);// Sending in normal mode HAL_Delay(1000); HAL_UART_Transmit_DMA(&huart1,Test,sizeof(Test));// Sending in DMA mode HAL_Delay(1000);
the received data is:
{1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1}
in both DMA and normal modes the received data is pretty similar. The UART baud rate is 115
What should I do?
#uart #dma-usart #stm32f1 #stm32cube2016-12-08 02:10 AM
Hi
,The issue seems to be within the amount of data to be sent provided as parameter in the call ofHAL_UART_Transmit_DMA orHAL_UART_Transmit.
In the examples available in the Cube package, a 'COUNTOF' macro is defined to precise the amount of data:
#define COUNTOF(__BUFFER__) (sizeof(__BUFFER__) / sizeof(*(__BUFFER__)))�?
Ex:STM32Cube_FW_F1_V1.4.0\Projects\STM32F103RB-Nucleo\Examples\UART\UART_TwoBoards_ComDMA
-Amel-
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.
2016-12-08 11:15 PM
Hello, thanks for your answer.
The baud rate between STM32 and Arduino wasn't match! I used lower baud rate and it's working fine.