Power & Source of Big Ideas

UART communications via the USB 2.0 port, possible?

Moderators: chensy, FATechsupport

Hi Friendly folks, I have a problem that has had me bogged down for 3 full days now and I'm beginning to hallucinate wild friendly creatures. :evil: :mrgreen: :geek:

Im using the NanoPi NEO

Code: Select all

Linux nanoPi 4.11.2 #1 SMP Wed May 31 15:47:40 CST 2017 armv7l armv7l armv7l GNU/Linux

to communicate over UART to a drone flight controller. It requires 115200 baud standard UART settings.
For hardware I am using a 3.3V USB-TTL converter, with RX->Tx, Tx->Rx, GND -> GND connections. It is a tested hardware setup that has worked on similar projects.

The issue is I do not know what the /dev/ttySx name is of the USB 2.0 port and I have no clear way of identifying it, no clear way of testing it, and certainly no idea if it is possible to use it as UART on nanoPi.
1) I have tried to look up the name of the USB 2.0 port used with:

Code: Select all

sudo cat /proc/tty/driver/serial

which displays:

Code: Select all

serinfo:1.0 driver revision:
0: uart:U6_16550A mmio:0x01C28000 irq:41 tx:7637 rx:0 RTS|DTR
1: uart:U6_16550A mmio:0x01C28400 irq:42 tx:57 rx:0 RTS|CTS|DTR
2: uart:unknown port:00000000 irq:0
3: uart:unknown port:00000000 irq:0
4: uart:unknown port:00000000 irq:0
5: uart:unknown port:00000000 irq:0
6: uart:unknown port:00000000 irq:0
7: uart:unknown port:00000000 irq:0

However, I know uart 16550A is ttyS0, and this has console enabled on it so it is not usable for UART comms unless I disable the console on ttyS0 (I believe this must be the debug UART).
2) I have attempted to change the console on ttyS0 to ttyS1 by editing the /boot/boot.cmd file:

Code: Select all

setenv bootargs console=ttyS1,115200 earlyprintk root=/dev/mmcblk0p2 rootfstype=ext4 rw rootwait fsck.repair=${fsck.repair} panic=10 ${extra}


Code: Select all

dmesg | grep tty
remains unchanged and still produces:

Code: Select all

[    0.000000] Kernel command line: console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rootfstype=ext4 rw rootwait fsck.repair=yes panic=10
[    0.306011] console [ttyS0] disabled
[    0.326181] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 41, base_baud = 1500000) is a U6_16550A
[    0.996436] console [ttyS0] enabled
[    1.022823] 1c28400.serial: ttyS1 at MMIO 0x1c28400 (irq = 42, base_baud = 1500000) is a U6_16550A

3) I have tried to disable the console on ttyS0 which would (probably?) allow me to use the ttyS0(the debug pins?) for UART by using

Code: Select all

sudo systemctl mask serial-getty@ttyS0.service
but to no avail.

4) I have also added "enable_uart=1" into

Code: Select all


5) I have saved the value of /proc/tty/driver/serial before and after plugging in the USB to TTL converter to check for changes in /proc/tty/driver/serial but it shows no change whether usb is plugged in or not, even after system reset.

I can't seem to find documentation or articles on how to use the USB 2.0 port as UART, at this point despite all that i've discovered... I still don't know how to reference the /dev file of the usb 2.0 or even if it is capable of UART. I may have to use the GPIO pins for UART but I would honestly think it was possible to use the USB port.

Extra info: My program gives an error "unable to open serial" unless I set the permissions on the /dev/ttyS0 to allow non-root access. Using

Code: Select all

sudo chown my_username /dev/ttyS0
seems to resolve this issue and my code will successfully 'open' the port, however it still doesn't send any information on TX (verified with a logic analyzer).

Here is the current ls - l /dev | grep ttyS:

Code: Select all

crw-rw---- 1 pi    dialout   4,  64 Feb 11  2016 ttyS0      
crw-rw---- 1 root dialout   4,  65 Feb 11  2016 ttyS1
crw-rw---- 1 root dialout   4,  66 Feb 11  2016 ttyS2
crw-rw---- 1 root dialout   4,  67 Feb 11  2016 ttyS3
crw-rw---- 1 root dialout   4,  68 Feb 11  2016 ttyS4
crw-rw---- 1 root dialout   4,  69 Feb 11  2016 ttyS5
crw-rw---- 1 root dialout   4,  70 Feb 11  2016 ttyS6
crw-rw---- 1 root dialout   4,  71 Feb 11  2016 ttyS7
Hi, I have the same problem but I don't have as much knowledge of the problem as you. Any help I'll be very gratefull.

Who is online

In total there are 19 users online :: 0 registered, 0 hidden and 19 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 19 guests