"Broken" UART port on VIM3 Pro (With Ubuntu 20.04)

Hello everyone, I’m trying to listen the UARTC_RX pin (15).
The problem is that, when I write in the terminal cat /dev/ttyS3, it immediately wraps up with the input line for the commands, without listening to the port as you can see in the screenshot.
immagine
I have all the permissions and, when I listen to the same port with Pyserial, it sniffs lots of strange data.
immagine

This is the code that I’m using:

import serial
import time
import os

btport = "/dev/ttyS3" #technically this is the port for the pins 15 (rx) and 16 (tx) - (is it right?)
btser = serial.Serial(btport, baudrate=9600)

print("ready")

while True:
    newdatabt = btser.readline()
    if newdatabt:
        print(newdatabt)

I’m using Ubuntu 20.04 with kernel 4.9.241, Python 3.9, on a VIM3 Pro v14.
Thank you for help! :smile:

Hello @SpheLC

Seems like you are receiving data in raw binary format, if you are sure it’s text data maybe replace the print line to decode it to ascii, or utf-8 accordingly

    if newdatabt:
        print(newdatabt.decode('ascii'))

Regards.

Hi, thank you for your answer, unfortunately it doesn’t work and it gives me an error, both for ascii and for utf-8. By the way, I tried the same program on my Raspberry Pi (without the decode thing) and it works perfectly. I tried to change the wires, but nothing changed
immagine

@SpheLC are you able to read from the UART port with picocom ?

$ sudo apt install picocom
$ sudo picocom -b 9600 /dev/ttyS3

Yes but, there are lots of strange data again, but this time they’re different
immagine
I hope that it is not an hardware problem…
By the way, it is reading actually some data 'cause de GPS module sends those " ` ", but the most of the input is corrupted

@SpheLC which GPS module are you using, is it powered by the GPIO ?
Maybe it needs to be powered up after the VIM3 is booted and running.

The GPS module is a NEO-6 but it works, because I tried to put the serial cable to a Raspberry Pi and it works perfectly. I’m using the same power port that I used for the Raspberry Pi

Hey @Electr1, I thought of something. What would happen if we created a new serial port using regular GPIOs? I Honestly have no idea of how to create a new serial port, but maybe it could work for some reason! (anyway I wanted to tell you something, I don’t want to seem rude, but can I ask you if we only write programs in Python please? I can only use Python for my project)

@SpheLC that is not necessary, it is probably due to the uart configuration itself. please try changing the configuration of the uart to read 8 bits and 1 stop bit, etc.

ok, where can I found the configuration file?

Please check out the usage of stty.

Maybe you haven’t configured your VIM uart the same way your Pi uart is configured.

Not just the baud rate but also the stop bit, parity bit configurations.