Title: Raspberry Pi Zero W serial communication
Tags: serial;pi-zero-w;python-3
Question: I just got a RPI zero w and I want to communicate to a device through serial comm. I also have a MAX232 board and a RS232 TTL converter. I want to use one of this boards to be able to communicate with that device because of what I red I can't dirrectly use the RPI's serial pins to add parity bits wich I need. I have tryed many thing to get this to work but it seems something I'm doing is wrong and can't figure it out. The code is in python and works great if I use a USB serial converter.
import time
import serial
import binascii
import re
ser = serial.Serial(
port = '/dev/ttyAMA0',
baudrate = 19200,
parity = serial.PARITY_MARK,
stopbits = serial.STOPBITS_ONE,
bytesize = serial.EIGHTBITS,
timeout = 2
while True:
print("Connected to: " + ser.name)
counters = [0x01,0x0F]
ser.write(counters)
a = ser.read(30)
state = binascii.hexlify(a)
asd = re.sub(rb'([0-9, a-z, A-Z])(?!$)', rb'\1,', state)
print(asd)
So that's the code I'm using and I don't get any data back.
These are the connections I made
I'm a beginner to all this stuff but I hope someone could help me make this work.
Comment: Run [./monitor.py 14 15](http://abyz.me.uk/rpi/pigpio/examples.html#Python_monitor_py) to see if there is any activity on the serial link.

Comment: I'm sorry but I don't know to configure that module. It gives me and error that it can't connect to that  port

Comment: It requires the pigpio daemon to be running, `sudo pigpiod` to start the pigpio daemon.

Comment: I did run ./monitor.py 14 15 and it does nothing, just hangs in there.

Comment: That indicates nothing is being sent or received.  Did you run your program after starting monitor.py ?

Comment: G=31 l=1 d=10281726
G=30 l=1 d=14043678
G=31 l=0 d=3916440
G=30 l=0 d=151188
G=31 l=1 d=6384842
G=30 l=1 d=10044995
G=31 l=0 d=14393653
G=30 l=0 d=10735718
G=31 l=1 d=4899385
G=30 l=1 d=8034910
G=31 l=0 d=124987872
G=30 l=0 d=121852304
G=31 l=1 d=8498241
G=30 l=1 d=12044570

Comment: Those GPIO (30, 31) are not relevant. 14/15 are the UART.

Comment: I get nothing from pins 14 15

Comment: Remove the wires from 14/15.  Then run yout script and monitor.py.  Still nothing? Software wrong or UART being used by something else.  Activity? Wiring wrong.

Comment: I only get some data on 15 when pluging the TTL converter to 3.3V on the PI, and it heats up the MAX3232

Comment: I did remove 14/15 and still nothing

Comment: Remove everything and run [gpiotest](https://elinux.org/R-Pi_Troubleshooting#Testing)

Comment: Well, looks like that was the last test. After I removed the wires the pi heated up and now it's dead. I have another PI 2 B, I will try with that one later on.

Comment: I hooked up the MAX232 board on the Pi 2B and used an external 5V power, works perfect. I will try with the RS232 hoffmanrichard@example.org powered from the board and see.  Hope this one won't die like the Pi zero. But it bugs me why the PI zero didn't work because I use the same SD card on the pi 2 B.

Here is the accepted answer: The RS232 converter works great aswell powered from the 3.3V on the RPI 2B. I'll get another pi zero in the future and hopefully don't burn it. Thank you for your help @joan
Comment for this answer: Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.


{'source': 'StackExchangeDataset', 'subset': 'raspberrypi.stackexchange.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 14, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2020:00:02/02/20', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<serial><pi-zero-w><python-3>', 'Title': 'Raspberry Pi Zero W serial communication', 'ViewCount': 261, 'id': 107996, 'user_AboutMe': None, 'user_AccountId': 13603346.0, 'user_DisplayName': 'X Tzevu', 'user_Reputation': 41.0, 'user_Views': 0.0, 'user_id': 114285.0}}