iMX6 UART RS485 mode?

cancel
Showing results for 
Search instead for 
Did you mean: 

iMX6 UART RS485 mode?

10,627 Views
Contributor I

Has anyone had any experience using the RS485 capabilities of the iMX6 in Linux?  Just had a quick look through the Kernel sources and arrived at drivers/tty/serial/imx.c which seems to be doing the right things with regard to standard 232 and IRDA functionality, but I can't find anywhere the 485 functionality is implemented.

In fact RS485 mode is allegedly enabled by setting the MDEN field of the UARTx_UMCR register to  0x02 but this register definition is suspiciously missing from the defines in imx.c, which I guess means that IRDA compatibility with slow data rate isn't implemented either.

TIA

Labels (2)
5 Replies

692 Views
Contributor I

I modified the imx.c driver and device treers485_direction.jpeg.jpg, and it look like it working fine. The problem is that I could not use the DTE mode, as this swap the RX/TX and CTS/RTS pin direction, thus I left it in the normal DCE mode, and toggle DTR, as this is now an output!!  The reason for this was that I already have a PCB and did not want to do 'cut and past'.  I had to change the device tree as follows

&uart5 {

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_uart5>;

    fsl,uart-has-rtscts;

    status = "okay";

};

pinctrl_uart5: uart5grp {

  fsl,pins = <

      MX6QDL_PAD_KEY_COL1__UART5_TX_DATA    0x1b0b1

      MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA    0x1b0b1

      MX6QDL_PAD_CSI0_DAT18__UART5_RTS_B    0x1b0b1

      MX6QDL_PAD_CSI0_DAT19__UART5_CTS_B    0x1b0b1

    >;

};

The scope trace show the direction change before the first byte and ends when the last byte is transmitted.

This is most obviously not the perfect solution but it worked for me, please feel free to comment and correct my short comings.

This was tested on a RiOTboard.

0 Kudos

692 Views
NXP Employee
NXP Employee

Hello!

A customer is in need of the exact same feature, I wonder if someone has an update on this topic?

Thanks!

Bruno

0 Kudos

692 Views
Contributor I

Sorry I should have posted my findings.

Anyway there is no RS485 driver support in the BSP so the existing serial driver will need to be modified.  A 485 transceiver will need to be added to your board and brought out on one of the UARTs.  UART5 is brought out to a connector designed for blue tooth (J13) or UART2 is brought out on pads EIM_D27 -> 29 (amongst others) via J508  which you might be able to connect to quite easily for development purposes.  I can't see that the sabre SD board exposes any other UARTs that might be suitable; uart1 is attached to a usb to serial converter and uart3 to a GPS receiver for example.

Incidentally my initial post included reference to the MDEN field, well ignore that.  The MDEN field only enables rs485 9 bit address mode and standard 485 multi drop will work quite happily without this particular feature.

HTH

0 Kudos

692 Views
Contributor I

Hi,Can you describe in detail under the 485 model?

0 Kudos

692 Views
Senior Contributor I

Have you found anything new concerning this topic? Has Freescale weighed in or provided any development assistance?

I have a custom I.MX6Q board and I am attempting to transfer files using the minicom program. I am getting traffic on the ports but my transmit side gets a 'Retry 0: Timeout on pathname' error message.

Following is my COM port status before and after the file transmission attempt:

root@winsys-ubuntu-desktop:/etc/init# cat /proc/tty/driver/IMX-uart

serinfo:1.0 driver revision:

0: uart:IMX mmio:0x02020000 irq:58 tx:10579 rx:260 RTS|CTS|DTR|DSR|CD

1: uart:IMX mmio:0x021E8000 irq:59 tx:0 rx:0 DSR|CD

2: uart:IMX mmio:0x021EC000 irq:60 tx:0 rx:0 DSR|CD

3: uart:IMX mmio:0x021F0000 irq:61 tx:0 rx:0 DSR|CD

4: uart:IMX mmio:0x021F4000 irq:62 tx:0 rx:0 DSR|CD

root@winsys-ubuntu-desktop:/etc/init# cat /proc/tty/driver/IMX-uart

serinfo:1.0 driver revision:

0: uart:IMX mmio:0x02020000 irq:58 tx:10962 rx:264 RTS|CTS|DTR|DSR|CD

1: uart:IMX mmio:0x021E8000 irq:59 tx:0 rx:0 DSR|CD

2: uart:IMX mmio:0x021EC000 irq:60 tx:99 rx:0 RTS|DSR|CD

3: uart:IMX mmio:0x021F0000 irq:61 tx:140 rx:0 DSR|CD

4: uart:IMX mmio:0x021F4000 irq:62 tx:0 rx:0 DSR|CD

0 Kudos