AnsweredAssumed Answered

Which is the predefined RTS pin in MKE02Z64VLD2 and How to initialize it using Kinetis Design Studio 2.0 ?

Question asked by Ganesh Ramachandran on May 9, 2016
Latest reply on May 12, 2016 by Alice_Yang

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);
      CLS1_SendStr("Welcome Ganesh!\r\n", CLS1_GetStdio()->stdOut);


The output in the Terminal Application which I use is what I desired.

Terminal output got.jpg

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);



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. RTS Handshakedoubt.jpg

How does the above feature work ?

Is my understanding of the problem correct ?
How to approach and solve the Issue ?



Thanks in advance.