I need to send files/ strings serially to my board. The PTD7 is the UART2 Tx and PTD6 is the UART2 Rx. There is an RS 485 connected to this UART connection. Since RS 485 is Half Duplex, I am facing issues while sending and parsing files, whereas I could send strings successfully.
for(;;) {
GPIO_PDD_TogglePortDataOutputMask(GPIOA_BASE_PTR, GPIO_PDD_PIN_21);
CLS1_SendStr("Hello World!\r\n", CLS1_GetStdio()->stdOut);
WAIT1_Waitms(1000);
CLS1_SendStr("Welcome Ganesh!\r\n", CLS1_GetStdio()->stdOut);
}
The output in the Terminal Application which I use is what I desired.
But when I try to execute this code, the terminal application didn't respond. I never got anything on the terminal screen.
static void ReadText(void) {
uint8_t buffer[32], ch, i;
for(;;) {
CLS1_SendStr("Enter some text: ", CLS1_GetStdio()->stdOut);
buffer[0] = '\0';
i = 0;
do {
if (CLS1_KeyPressed()) {
CLS1_ReadChar(&ch); /* read the character */
if (ch!='\0') { /* received a character */
buffer[i++] = ch; /* store in buffer */
if (i>=sizeof(buffer)) { /* reached end of buffer? */
buffer[i] = '\0'; /* terminate string */
break; /* leave loop */
}
if (ch=='\n') { /* line end? */
buffer[i] = '\0'; /* terminate string */
break; /* leave loop */
}
}
}
} while(1);
CLS1_SendStr("You entered: ", CLS1_GetStdio()->stdOut);
CLS1_SendStr(buffer, CLS1_GetStdio()->stdOut);
CLS1_SendStr("\r\n", CLS1_GetStdio()->stdOut);
}
}
GPIO_PDD_TogglePortDataOutputMask(GPIOA_BASE_PTR, GPIO_PDD_PIN_21);
This piece of code is responsible for toggling the PIN 21.
In the above code snippet it is impossible and illogical to insert this piece of code for toggling the PIN 21, whenever I send and receive characters.
The only possible way is UART should felicitate an automatic handshake (set/reset RTS). When I checked the Processor Expert Component Properties of AsynchroSerial Component I found this.
How does the above feature work ?
Is my understanding of the problem correct ?
How to approach and solve the Issue ?
Thanks in advance.
PIN_21);
解決済! 解決策の投稿を見る。
Hello Ganesh,
From the Reference Manual , the device of MKE02Z64VLD2 does not support RTS and CTS .
And so , please introduce your problem again without RTS clearly , you can first configure the
low baud rate have a try.
BR
Alice
Hello Gnesh,
About this feature , you must enable DMA first, or you can not use this feature :
Hope it helps
Have a great day,
Alice
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks for the help Alice.
Where Can I find that DMA in KDS ?
Also I could not locate the RTS PIN in my data sheet yet. I am connecting to UART2 (PTD6 -> Rx , PTD7 -> Tx) . But I couldn't find which is the RTS Pin.
Hello Ganesh,
From the Reference Manual , the device of MKE02Z64VLD2 does not support RTS and CTS .
And so , please introduce your problem again without RTS clearly , you can first configure the
low baud rate have a try.
BR
Alice
How to send a .s19 file to MKE02Z64VLD2 through a RS 485 (Half duplex) serial connection ?
Check this Link Alice. Hope my question is clear now..
Hello Ganesh,
I have check the thread and code you mentioned.
I think first you need set a breakpoint to check whether the UART receive the data PC send .
Then use one flag to send the data that MCU received .
BR
Alice
Hey Alice,
Is there any article or screenshots that explain the operation you asked me to perform. I am new to this IDE and Controller. Thanks alot for your reply.
Hello Genesh,
You can check the UART data register through "EmbSys Registers":
Window -> show view -> other ....
if you want check variable, you can use the "Expressions" view:
Hope it helps
Alice