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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,496 次查看
ganeshramachand
Contributor IV

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.

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

          }

        }

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. 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.

PIN_21);

1 解答
1,138 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

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

在原帖中查看解决方案

0 项奖励
7 回复数
1,138 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Gnesh,

About this feature , you must enable DMA first, or you  can not use this feature :

pastedImage_0.png

Hope it helps


Have a great day,
Alice

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,138 次查看
ganeshramachand
Contributor IV

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.

0 项奖励
1,139 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

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

0 项奖励
1,138 次查看
ganeshramachand
Contributor IV

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..

0 项奖励
1,138 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

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

0 项奖励
1,138 次查看
ganeshramachand
Contributor IV

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.

0 项奖励
1,138 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Genesh,

You can check the UART data register through "EmbSys Registers":

Window ->  show view -> other ....

pastedImage_2.png

pastedImage_1.png

pastedImage_0.png

if you want check variable,  you can use the "Expressions" view:

pastedImage_3.png

Hope it helps

Alice