i.MX6UL RS485 Linux driver

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

i.MX6UL RS485 Linux driver

2,859 Views
a_r_f_
Contributor II

Hello,

I have an i.MX6UL design in which I have an RS485 transceiver connected to the processor. The RS485 bus is supposed to be handled by UART5, ie. /dev/ttymxc4 in Linux. The "driver enable" line of the transceiver is connected to CTS_B output, ie. the same pin as GPIO1_09.

Is there any version of the SERIAL_IMX driver (drivers/tty/serial/imx.c) known to correctly control the driver enable line? If someone has a working setup of this kind, please, let me know what system version is used.

In my design, no matter what I try, the driver enable signal is brought high on boot and it stays this way. I've tried kernels 4.9, 4.12 and 4.14 with their version of the driver.

I have spent some time digging in the driver, and in theory that should work correctly. I have added printk's to see when the driver initializes RS485, and attempts to bring driver enable signal high or low, and these debugs appear at correct moments. The driver tries to write values which make sense to the UART's control register 2, but the signal doesn't change.

Also, I have noticed that if the transmitting process gets killed, no debug message (generated by one of my added printk's) related to bringing the driver enable to inactive state (low) appears. Maybe this is the matter of just a not displaying the debug message, but it can be also a bug.

Best regards,
Adam

0 Kudos
3 Replies

1,546 Views
igorpadykov
NXP Employee
NXP Employee

Hi Adam

one can try to use patches on

[imx6] RS485 could be supported on Imx6 series ?  

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

0 Kudos

1,546 Views
a_r_f_
Contributor II

Hi Igor,

unfortunately, these patches don't solve the main problem, which is that

when UART peripheral gets disabled (Linux does this, but I don't

understand why, so can't tell anything more except that it happens) the

CTS_B signal, commonly used for control of RS485 transmitter, gets its

default value, which is logic '0' ie. "high voltage".

That happens on boot, and after each transmission, like

echo -n x > /dev/ttymxc4.

I've managed to fix the problem "after transmission", but not fully "on

boot", because for that I need to configure UART before its pins get

muxed, and Linux seems to do that first.

Best regards,

Adam

W dniu 2018-09-11 o 02:25, igorpadykov pisze:

>

NXP Community

<https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

>

Re: i.MX6UL RS485 Linux driver

reply from igorpadykov

<https://community.nxp.com/people/igorpadykov?et=watches.email.thread>

in /i.MX Processors/ - View the full discussion

<https://community.nxp.com/message/1055435?commentID=1055435&et=watches.email.thread#comment-1055435>

>

0 Kudos

1,477 Views
simon_pettersso
Contributor II

I am having the same problem on dunfell with an i.MX8 nano. How did you manage to get the driver to do the right thing with CTS_B when the driver isn't opened?

0 Kudos