ModMike Posted October 5, 2021 Posted October 5, 2021 I am trying to connect to a 3D printer board using 3 wire serial, that is no CTS and RTS. I had a Wemos wifi module on it previously so I know it works. Now I need to use my BanaPi M2 Zero to control it thorough the same port, the Wemos has been removed and not going back. I keep getting a failure to initialize when I try to connect to the board. I am trying to use Pins 8 & 10 which is supposed to be UART 3 = /dev/ttyS3 from what I understand. Questions: How can I test the port? I have Minicom installed. How do I set the parameters to disable CTS and RTS? What flow control should I be using? Software? Here is my setup: armbianEnv.txt verbosity=1 bootlogo=false console=both disp_mode=1920x1080p60 overlay_prefix=sun8i-h3 rootdev=UUID=e7e80086-a15f-4f2e-825d-9913c71ff19c rootfstype=ext4 usbhost0 overlays=uart3 usbhost0 param_uart3_rtscts (bool) Enable RTS and CTS pins Optional Default: 0 Set to 1 to enable CTS and RTS pins usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u Is that the correct parameters fro disabling RTS and CTS for 3 wire serial? I am using RX and TX cross connected as well as ground. Both boards are independently powered. Other data: My serial port seems to be working, see bold line: dmesg | grep tty [ 0.000000] Kernel command line: root=UUID=e7e80086-a15f-4f2e-825d-9913c71ff19c rootwait rootfstype=ext4 console=ttyS0,115200 console=tty1 hdmi.audio=EDID:0 disp.screen0_output_mode=1920x1080p60 consoleblank=0 loglevel=1 ubootpart=bfca11dd-01 ubootsource=mmc usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_fb_mem_reserve=16 cgroup_enable=memory swapaccount=1 [ 0.000352] printk: console [tty1] enabled [ 2.223565] printk: console [ttyS0] disabled [ 2.223659] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 44, base_baud = 1500000) is a 16550A [ 2.223915] printk: console [ttyS0] enabled [ 2.225223] 1c28400.serial: ttyS1 at MMIO 0x1c28400 (irq = 45, base_baud = 1500000) is a 16550A [ 2.225410] serial serial0: tty port ttyS1 registered [ 2.226212] 1c28c00.serial: ttyS3 at MMIO 0x1c28c00 (irq = 46, base_baud = 1500000) is a 16550A [ 6.072173] systemd[1]: Created slice system-serial\x2dgetty.slice. [ 7.101175] systemd[1]: Found device /dev/ttyGS0. [ 8.576630] systemd[1]: Found device /dev/ttyS0. Second Test: sudo setserial -g /dev/ttyS3 /dev/ttyS3, UART: 16550A, Port: 0x0000, IRQ: 46
tparys Posted October 6, 2021 Posted October 6, 2021 Couple of thoughts: 1 - You probably mean RS232 serial, and not 485. Both are 3 wire serial. Just FYI. 2 - The setserial application is exclusively for ISA bus based serial ports. I doubt you have one of these. You can look at stty if you want, but generally whatever software you run will set those parameters for you at run-time. There's no system-level configuration you'll need to do aside from making the port active. If it's showing up in the kernel log, that's a good start. 3 - The big parameters you'll want to worry about are baud rate, and disabling HW flow control. There's a bunch of other settings too which are more rare, such as number of data bits, parity, and stop bits. Unless you have documentation that says otherwise, assume 8 data bits, no parity, 1 stop bit (sometimes listed as 8N1). 4 - If you want to test with minicom, be aware it enables HW flow control by default. You can change this default by doing: $ sudo minicom -s <Select "Serial Port Setup"> <Hit 'F' to set "Hardware Flow Control" to "OFF"> <Hit Esc> <Select "Save setup as dfl"> You may also want to add your user to the "dialout" group. You'll probably want to log out/back in afterwards. $ sudo usermod -aG dialout <username> Then you can launch minicom on that port by doing this: $ minicom -D /dev/ttyS3 -b <printer baud here>
ModMike Posted October 7, 2021 Author Posted October 7, 2021 Thank you for the tips. I think baud rate was my biggest issue and yes I meant RS-232. Are my parameters properly configured? How can I turn off RTS and CTS? I am unsure of the parameter syntax. Thanks again!
tparys Posted October 9, 2021 Posted October 9, 2021 Depends on what program you're accessing the serial port. For minicom, you disable the "Hardware Flow Control" as above via "minicom -s". If you're using stty, it's the crtscts flag (see "man stty"). For C programming, it's the CTSRTS flag (see "man tcsetattr"). Past that, I don't know what software you're trying to drive your printer, so can't tell you what parameters you need.
ModMike Posted October 9, 2021 Author Posted October 9, 2021 I am not using uart to connect to the computer. I am using it to the 3d printer control board, it's a Fysetc Cheetah. I have it working with a regular pi and raspbian. On PI, all I had to do was disable serial console and enable uart. Trying to do the same on Armbian so I can use a BPI instead of a zero. Can you please tell me how to use the parameters to disable RTS and CTS and which port name is assigned to GPIO 14 & 15 (physical pins 8 & 10). Thanks!
tparys Posted October 9, 2021 Posted October 9, 2021 As far as I'm aware, there is no OS level control to disable RTS/CTS pins. It's entirely in the user application accessing the UART/Serial Port, per my last post. Not familiar with the BPi at all, so you'll have to find that in the documentation. Past this, I cannot help you. Good luck.
Recommended Posts