B0naparte
Posts: 1
Joined: Fri Apr 19, 2019 2:00 pm

Why do I receive unreadable data via serial Port on Raspberry Pi?

Fri Apr 19, 2019 2:14 pm

I receive data with an Raspberry Pi3 from another device with an ATMEGA 8 Chip via serial port, what I receive should look like : #00 341 341 332 13123 R-? ...

But what I receive on my Raspberry is:

b'\xff\xfa\xfd\xff\xff\xff\xff\xff\xff\xfd\xff\xea~\xf8\xff\xfe\xfe\xff\xd5\xff\xfe\xfd\xff\xff\xfd\xff\xff\xff'

My port config:

port = serial.Serial("/dev/ttyAMA0", baudrate=115200, timeout=3.0)

How do I decode this or do you have any other suggestions?

I already tried to encode to utf-8, ascii etc. I also tried codecs. I just got errors or some more disturbing data. Nothin I can work with.

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Why do I receive unreadable data via serial Port on Raspberry Pi?

Fri Apr 19, 2019 2:57 pm

That's almost always going to be a baud rate problem. Check the program running in your ATMEGA8.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
skywatch
Posts: 46
Joined: Tue May 21, 2013 8:17 pm

Re: Why do I receive unreadable data via serial Port on Raspberry Pi?

Sun Apr 21, 2019 10:50 am

Serial on pi 3 version is not as stable as previous models of pi in my experience.

I suggest you get a serial to usb adaptor (about $1 or so) and try using that instead.

hippy
Posts: 7729
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Why do I receive unreadable data via serial Port on Raspberry Pi?

Sun Apr 21, 2019 11:33 am

B0naparte wrote:
Fri Apr 19, 2019 2:14 pm
port = serial.Serial("/dev/ttyAMA0", baudrate=115200, timeout=3.0)
Doesn't ttyAMA0 normally connect to the Wi-Fi/Bluetooth chip on a "Pi 3" ?

Maybe try /dev/ttyS0 or, preferably, /dev/serial0.

Return to “Troubleshooting”