Can the Cyclone V SoC UART Controller be used as RS485 ?
I have a Cyclone V SoC running in my product with Linux on the ARM.
I uses UART0 controller on the HPS pins for the linux console mounted on /dev/ttyS0.
The UART1 controller signals are linked to the FPGA matrix and then drive a RS485 driver. The RS485 drivers needs 3 signals to perform its tasks :
- RX => OK
- TX => OK
- TX_Enable => Problem !
I have read on several places that I have to use theRS232 RTS signal as TX_Enable to perform RS485 communications.
What I observe is that the RTS pin changes state when I perform an output stream of data, but it doesn't return to its previous state at the end of the frame, but several ms later.
The component I try to read from respond is less than 1ms on the RS485 line. Because RTS is still active, the reception can't be made.
I tried several configuration on the linux driver without success and I'm not sure that I can configure the UART controller driver to use it as an RS485 driver.
I can't imagine I'm the first one facing this problem and any help is welcome. Here is the device tree part of the UART1 controller which make it mounted as ttyS1 in Linux :
hps_uart1: serial@0xffc03000 {
compatible = "snps,dw-apb-uart-17.1", "snps,dw-apb-uart";
reg = <0xffc03000 0x00000100>;
interrupt-parent = <&hps_arm_gic_0>;
interrupts = <0 163 4>;
clocks = <&l4_sp_clk>;
reg-io-width = <4>; /* embeddedsw.dts.params.reg-io-width type NUMBER */
reg-shift = <2>; /* embeddedsw.dts.params.reg-shift type NUMBER */
status = "okay"; /* embeddedsw.dts.params.status type STRING */
dmas = <&hps_dma 30>,
<&hps_dma 31>;
dma-names = "tx", "rx";
}; //end serial@0xffc03000 (hps_uart1)