Does UART in RS485 mode support only 9 Bit mode for i.MX6 ?

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

Does UART in RS485 mode support only 9 Bit mode for i.MX6 ?

7,836 Views
abin444
Contributor II

Hi,
We would like to use UART interface in conjunction with CTS# (for automatic direction control) of i.MX6 processor for a half duplex RS485 bus implementation.
Our RS485 transceiver has active high driver enable (DE) and active low receive enable (RE). My questions are:
 

  1. Does the default functioning of CTS# be applicable here as well (with UART in RS485 mode) and matches with the above provided direction control requirements (CTS# normally low- transceiver receives data and CTS# becomes high when data is written into the appropriate UART register and transceiver transmits it)?
  2. Our project is a design improvement over the earlier Atmel MPU based design and it used 8 bit RS-485 mode with built in direction control. We want to maintain the compatibility with the existing subsystems. Is there an option to use 8 bit RS-485 mode in i.MX6ULL processor, still using built in transceiver direction control (CTS#)? 

Thanks,

Abin

Labels (1)
9 Replies

3,362 Views
kghamilton
Contributor I

Looking at the manual (page 5029 i.MX 6Dual/6Quad Applications Processor Reference Manual, Rev. 6, 05/2020) I am not sure if the CTS_B pin is active high or active low. Is a low on the CTS_B supposed to enable the buffer?

0 Kudos

4,271 Views
csoapy
Contributor III

Our local service told us: ALL imx6 reference boards not support RS485. so, it's not tested, not validated in the standard BSP. And, imx8 too.

So now, it's clear that, they don't want to eat their own dog food. we should do our own jobs individually. And, get along with old kernel, because gpu driver maybe not built for new kernel like 4.13.2 or 4.16 and so on. 

0 Kudos

4,271 Views
fabio_estevam
NXP Employee
NXP Employee

I have tested rs485 on a custom board recently. I have made some fixes for the imx UART operation that are not present in NXP 4.1 kernel, so I would suggest you to use a recent kernel such as 4.13.2 for rs485 evaluation. 

There have been some recent fixes on rs485/DMA operation on mx6q.

Hope this helps.

0 Kudos

4,271 Views
peterhasse
Contributor I

Hey FabioEstevam‌ , I'm running an 4.16 kernel on the imx 6 UUL eval board with im6ul SOM.

I altered the DTS file to make UART2 an RS485 interface

&uart2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart2>;
uart-has-rtscts;
status = "okay";
linux,rs485-enabled-at-boot-time;
};

which seems to have the desired result

cat /proc/tty/driver/IMX-uart
serinfo:1.0 driver revision:
0: uart:IMX mmio:0x02020000 irq:19 tx:5119 rx:0 RTS|DTR|DSR|CD
1: uart:IMX mmio:0x021E8000 irq:58 tx:95 rx:0 DTR|DSR|CD

i can send data from the IMX board but cant receive anything as you can see by the rx counter.

Also looking with an logic analyzer at the RTS / CTS pins show that they don't change and are always low.

Are these patches you a mentioned in the mainline kernel ? Any hint what else needs to be done?

0 Kudos

4,271 Views
fabio_estevam
NXP Employee
NXP Employee

Hi Peter,

What do you have defined in pinctrl_uart2?

Also, does your UART2 CTS pin connect to the RS485 transceiver enable pin?

Kernel 4.16 should have RS485 well supported on i.MX6. Unfortunately I don't have access to a custom i.MX6 board with RS485 support anymore to try it myself.

Regards,

Fabio Estevam 

4,271 Views
peterhasse
Contributor I

Hey Fabio,

thanks for the quick replay. We looked again on the schematics of the eval board and realized that the CTS pin is not connected and a 0 OHM resistor needs to placed on the board. Now it seems to work.

For completes here is the pincrtl you asked for. This is from 4.16 kernel and not altered by us.

pinctrl_uart2: uart2grp {
fsl,pins = <
MX6UL_PAD_UART2_TX_DATA__UART2_DCE_TX 0x1b0b1
MX6UL_PAD_UART2_RX_DATA__UART2_DCE_RX 0x1b0b1
MX6UL_PAD_UART3_RX_DATA__UART2_DCE_RTS 0x1b0b1
MX6UL_PAD_UART3_TX_DATA__UART2_DCE_CTS 0x1b0b1
>;
};

0 Kudos

4,271 Views
fabio_estevam
NXP Employee
NXP Employee

Hi Peter,

Glad to know it is working fine :-)

0 Kudos

4,270 Views
fabio_estevam
NXP Employee
NXP Employee

Also, make sure in userspace you set the following:

/* enable RS485 mode: */
rs485conf.flags |= SER_RS485_ENABLED;

/* set logical level for RTS pin equal to 1 when sending: */
rs485conf.flags |= SER_RS485_RTS_ON_SEND;

/* set logical level for RTS pin equal to 0 after sending: */
rs485conf.flags &= ~(SER_RS485_RTS_AFTER_SEND);

The first one is probably not needed as you pass linux,rs485-enabled-at-boot-time.

4,271 Views
CarlosCasillas
NXP Employee
NXP Employee

Hi Abin,

You should take a look at the following Community thread:

https://community.nxp.com/thread/312742


Hope this will be useful for you.
Best regards!
/Carlos
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos