High active RTS in RS485 mode

Hi,
I want to use one of the imx6 uarts in RS485 mode. Therefore i followed the instructions here. The RTS line goes low when sending and is high otherwise. Now i need to invert this line so that RTS is high when sending and low otherwise. I tried to change the devicetree by replacing rs485-rts-active-low with rs485-rts-active-high but this does not change the RTS behaviour. Even when i use ioctl commands (see code snippet) i am not able to invert the RTS line. Any help would be welcome.

struct serial_rs485 rs485conf;

/* 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;

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

/* Set this flag if you want to receive data even whilst sending data */
rs485conf.flags |= SER_RS485_RX_DURING_TX;

Hi @qojote

Could you provide the hardware version of the module? Could you share any changes you made to the kernel and the devicetree?

I tried to change the devicetree by replacing rs485-rts-active-low with rs485-rts-active-high but this does not change the RTS behaviour.

Could you just try to delete this property and check the behaviour?

Thanks and best regards,
Jaski

Hi,
I have installed the most recent demo image via TEZI and did some measurements using a Ixora carrier board. Please find my results and the test program attached. The “low active RTS” looks fine i guess (-6V means logic high). However the “high active RTS” looks odd. Can you confirm that this is the expected behavior?

"low active RTS"
"high active RTS"

Hi @jaski.tx
Thanks for the clarification. We will add an inverter on our carrier board. Can you please set this ticket to resolved.
Regards

Hi @qojote

Sorry for the delayed answer. I could reproduce the behaviour.

Actually when you set RTS active low, then the output on Ixora is high, since there is a Inverter integrated in the RS-232 Line Driver which is on the board.

Regarding your issue, you are right, the RTS is high only after setting up the IoCtl and some time after the transmission has finished, which is not what you want.

It seems this is a bug, as reported here. The solution seems to be use the mainline kernel driver, where you can use the RTS_Pin being any gpio. You need to check if this fits your requirements, since changing a GPIO through the driver (software) will take more time the hardware. In this case, the recommendation will be to add a inverter on your carrier board.

Best regards,
Jaski

Thanks for your feedback. Yes, I marked the Question as resolved.