brubetinha Posted February 25, 2016 Share Posted February 25, 2016 Hi everybody! We have an application that uses RS-485 and we decided to use the OMAP UART implementation, but it doesn't seems to work with Cubieboard A10. We tried to enable in userspace, by calling ioctl and also via dts file. ioctl (C code): ------------------------ ... if (ioctl (fd, TIOCGRS485, &rs485conf) < 0) {printf("Error: TIOCGRS485 ioctl not supported.\n");} /* Enable RS-485 mode: */rs485conf.flags |= SER_RS485_ENABLED; /* Set rts/txen delay before send, if needed: (in microseconds) */rs485conf.delay_rts_before_send = 0; /* Set rts/txen delay after send, if needed: (in microseconds) */rs485conf.delay_rts_after_send = 0; if (ioctl (fd, TIOCSRS485, &rs485conf) < 0) {printf("Error: TIOCSRS485 ioctl not supported.\n"); <---------- Always get this error message!} ... dts file: ----- serial@01c28c00 { compatible = "snps,dw-apb-uart"; reg = <0x1c28c00 0x400>; interrupts = <0x4>; reg-shift = <0x2>; reg-io-width = <0x4>; clocks = <0x30 0x13>; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&uart3_pins>; /* No extra delay after/before transmissions */ rs485-rts-delay = <0 0>; /* GPIO pin PG8 for data direction */ rts-gpio = <0xC8>; /* Enable RS-485 */ linux,rs485-enabled-at-boot-time; }; Does anyone knows what could be wrong or if the Cubie doesn't support this feature ? Thank you, Bruna Link to comment Share on other sites More sharing options...
rreignier Posted February 25, 2016 Share Posted February 25, 2016 Hi, I am not an expert in that domain, but I am also interested in RS-485 communication on Allwinner based SBC. For your information OMAP is a series of CPU for Texas Instrument, so the OMAP UART driver is only used on these CPUs. The BeagleBone Black is made of an OMAP processor for example. What I found is that RS-485 drivers only exists for few devices likes the AT91 series from Atmel, OMAP serias from Texas Instruments, i.MX28 series from Freescale (now NXP)... One solution is to use the RTS signal of the UART to drive the RS-485 direction. But I have measured a 3 ms delay for the turnaround on a H3 based Orange Pi One, that delay is too big for my application. So I am finally using a USB-RS485 adapter from Devantech which manage the RS-485 direction automatically. I did not measured the turnaround yet but it worked well for my tests and they advertise a 3uS delay turnaround. But note that this module cost two times the price of my Orange Pi One http://www.robot-electronics.co.uk/htm/usb_rs485_tech.htm 1 Link to comment Share on other sites More sharing options...
brubetinha Posted February 29, 2016 Author Share Posted February 29, 2016 Hi! Thank you for your reply. We will try these options! Link to comment Share on other sites More sharing options...
Nick Posted March 2, 2016 Share Posted March 2, 2016 Could you not use a normal GPIO pin for the turnaround? That is how I deal with RS485 on 8bit Micros etc. In theory, the GPIO pins can be accessed via the /sys/class/gpio file system, however I'm currently having trouble with that on a Banana Pi M1+, so you might want to keep an eye on my other thread. Nick Link to comment Share on other sites More sharing options...
Recommended Posts