0

I'm trying to send a signal from a programable IC to my Pi Zero W but all I get is b' '

My IC is setup to send an alternating value between AA and 55. The data is sent on the UART line every .35 seconds. I tested the IC with another IC and it was working so I know my IC is correct.

part of the config.txt

# NOOBS Auto-generated Settings:
hdmi_force_hotplug=1
start_x=1
gpu_mem=128
enable_uart=1
core_freq=250

#dtoverlay=pi3-miniuart-bt
init_uart_clock=3000000

Available ports

pi@raspberrypi:~ $ python -m serial.tools.list_ports
/dev/ttyAMA0        
1 ports found

My code

from gpiozero import LED, Button

from tkinter import messagebox

import spidev
import pip
import time
import serial

ser = serial.Serial(
        port='/dev/ttyAMA0', #Replace ttyS0 with ttyAM0 for Pi1,Pi2,Pi0
        #port='/dev/ttyS0',
        baudrate = 3000,  #9600 ,#115200, 10417 on PIC
        parity=serial.PARITY_NONE,
        stopbits=serial.STOPBITS_ONE,
        bytesize=serial.EIGHTBITS,
        startbits=serial.STARTBITS_ONE,
        timeout=1
)

print(ser.name)
Test1 = 0

while 1 == 1:
    #Test1 = ser.read(1)
    print(ser.is_open)
    Test1 = ser.readline()
    print(Test1)
    for n in Test1:
        print(n)
        print("n")
234Mike432
  • 29
  • 2

1 Answers1

0

Milliways, Thank you for your response. The link you provided was very helpful. In my case the UART was working after I changed my port to /dev/serial0, I also had to reset my baudrate back to where it should have been after I was doing some testing.

ser = serial.Serial(
        port = '/dev/serial0',
        baudrate = 10417,  #9600 ,#115200, 10417 on PIC
        parity=serial.PARITY_NONE,
        stopbits=serial.STOPBITS_ONE,
        bytesize=serial.EIGHTBITS,
        timeout=1
)
234Mike432
  • 29
  • 2
  • 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. – Ingo May 20 '20 at 08:56