Hi, I'm fairly new to SBCs and Linux and try to get RS485 working on a NanoPi NEO running Armbian (Legacy 3.4.113).
I build a custom shield for the NanoPi Neo with a MAX3485 taht is connected to the UART2 (TX,RX,RTS) but so far only transmission works.
This is because the RTS pin which I planned to use for toggling the direction pins is always high.
I tried to use ioctrl to have it been toggled automatically, but had no success so far.
I'm tried to figure out whats the problem and I believe that the configuration of the UART2 does not include the RTS signal:
cat /proc/tty/driver/uart |head -8
serinfo:1.0 driver revision:
0: uart:SUNXI mmio:0x01C28000 irq:32 tx:8500 rx:0 RTS|DTR
1: uart:SUNXI mmio:0x01C28400 irq:33 tx:0 rx:0 CTS
2: uart:SUNXI mmio:0x01C28800 irq:34 tx:0 rx:0 CTS
3: uart:SUNXI mmio:0x01C28C00 irq:35 tx:0 rx:0 CTS
I also figured out that i can decompile the /boot/script.bin to the original fex file:
bin2fex script.bin > script.fex
In there I can see that no RTS signal is configured for uart2 (for some reason the is also none configured for uart0 which doesn't match with the output above for som reason!?)
[uart2]
uart_used = 1
uart_port = 2
uart_type = 2
uart_tx = port:PA00<2><1><default><default>
uart_rx = port:PA01<2><1><default><default>
On the linux-sunxi website I found out that I could add RTS to this configuration:
http://linux-sunxi.org/Fex_Guide#uart_configuration
Am I correct in assuming that I only need to change the config for UART2 like this:
[uart2]
uart_used = 1
uart_port = 2
uart_type = 4
uart_tx = port:PA00<3><1><default><default>
uart_rx = port:PA01<3><1><default><default>
uart_rts = port:PA02<3><1><default><default>
uart_cts = port:PA03<3><1><default><default>
The compile it again, replace the current script.bin with the new one and reboot in order to get RTS working?
Any help is highly appreciated!