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.
sudo pigpiod
to start the pigpio daemon.