2020-06-22 07:01 AM
when I use the DMA functions as below:
HAL_UART_Transmit_DMA(&huart1,(uint8_t *)aTxStartMessage,sizeof(aTxStartMessage));
HAL_Delay(10000);
In PC side,It always display such symbols at the hand of the aTxStartMessage after the first success reciever.
Which register should be set ?
What is the DMA function`s program process?
��
2020-06-22 09:57 AM
How are you defining aTxStartMessage? Is it ASCII? Perhaps you are transferring the '\0' at the end of the C string if it is? You may wish to use the strlen() function instead of the sizeof() operator.
2020-06-22 09:36 PM
In HAL_UART_Transmit_DMA function, *pdata should be defined to uint8_t.As below:
HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
When I change the aTxStartMessage to char type, and the sizeof to strlen. That error still occur.
Main.c Program:
#include<string.h>
char aTxStartMessage[]="\r\n****UART-Hyperterminal communication based on IT****\r\nEnter 10 Characters using Keyboard:\r\n";
int main()
{
while(1)
{
HAL_UART_Transmit_DMA(&huart1,(uint8_t *)aTxStartMessage,strlen(aTxStartMessage));
HAL_Delay(10000);
}
}
2020-06-22 11:38 PM
And what exactly do you receive? Try a terminal program which can display binary (hex) values, such as Bray.
What hardware do you use to connect the STM32 to PC?
JW
2020-06-23 10:18 AM
like this:
��****UART-Hyperterminal communication based on IT****
Enter 10 Characters using Keyboard:
Hardware:STM32F0Discovery
2020-06-23 02:57 PM
Insert a delay after initialization of the USART and before transmitting, with a duration of couple of characters.
JW
2020-06-23 03:35 PM
Oh, your weird characters are showing up at the start of the transmission, not at the end. I'm not sure which MCU you are using, but in RM0091 (STM32F0x1/F0x2/F0x8), under the "27.5.2 USART Transmitter" section, there is the following note:
"An idle frame will be sent after the TE bit is enabled."
I'm not sure if there's a way to disable that. I imagine this is what you are seeing in your terminal program. I think you are seeing the same thing as this thread:
https://community.st.com/s/question/0D50X00009XkaduSAB/how-to-stop-the-idle-frame-on-uart
and there were some suggestions there on how to deal with it.