RS485 configuration in generic UART driver

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RS485 configuration in generic UART driver

2,156 Views
Raana
Contributor III

Dear Team,

I'm using i.Mx8x based custom board.

There we need to support RS485 interface.

External RS485 Transceiver IC is connected to UART1 of iMx8DX6.

UART1_RTS pin will be used for selecting Data Enable(DE)/Read Enable(RE) functionality.

 

Current UART driver (/tty/serial/fsl_lpuart.c ) is having below configuration with respect to RS485 functionality.

  1. In rs485_config function, configured TXRTSE and TXRTSPOL in UARTMODIR register.
  2. In set_ctrl function, configured TXRTSE in UARTMODIR register.

 

We feel that, driver side no additional configuration is required for RS485.

Please confirm this.

 

As per the current use case, We need to toggle the RTS pin depending on the mode (DE/RE).

Our understanding is this can be handled in application layer using ioctl  "TIOCMSET" (Configure RTS pin state to High/Low to select DE/RE).

Whether same logic (Managing DE/RE State using RTS pin) can be handled in UART driver level?

Please provide your feedback.

Thank You.

Best Regards,

J.P.Raja

0 Kudos
4 Replies

2,052 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi Raana,

  LPUART driver doesn't support RTS for RS485 DE/RE, BUT if you want to use software to control Tx/Rx direction of RS485, you will have to add the related source code to LPUART driver by yourself.

 For LPUART driver, RTS is used, BUT for UART driver(i.mx6/7) , CTS is used.

So you can refer to drivers/tty/serial/imx.c , which is UART driver.

Hardware solution for RS485, Here is the ticket I repied, check it, please!

https://community.nxp.com/message/1239337?commentID=1239337#comment-1239337 

Have a nice day!

B.R,

Weidong

0 Kudos

2,052 Views
Raana
Contributor III

Hi,

Can you please answer me the one more question which is asked in the above discussion.

which is, shall i use "TIOCMSET" to toggle the RTS pin from application ?

Is it possible ?

Thank You.

Best Regards,

J.P.Raja

0 Kudos

2,052 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Raana,

    I have ever discussed the question on RTS of LPUART with i.MX expert.  yes, it is possible to use it to control data direction of RS485 communication, BUT since it is not supported by current driver, you will have to add related code to driver by yourself and debug it.

Have a nice day!

B.R,

weidong

0 Kudos

2,052 Views
Raana
Contributor III

Hi,

Thank you so much for your response.

In my case it's not able to do the Hardware solution because HW setup is already ready.

So, I will try the Software solution and I let you know.

Thank You.

Best Regards,

J.P.Raja

0 Kudos