EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Asyn4-38 SetOption Parity "Even" fails - "Invalid argument"
From: Florian Feldbauer via Tech-talk <tech-talk at aps.anl.gov>
To: tech-talk at aps.anl.gov
Date: Tue, 2 Jun 2020 20:32:54 +0200

Hey Jan,

if you are using a Raspi 3, it might be a configuration problem of the Pi itself.

I found several bug reports for "pyserial" (Python lib for serial communication) describing the same problem. The solution here was as follows;

/dev/ttyS0 of Raspberry Pi 3 Model B does not support EVEN and ODD.
So, you need to use /dev/ttyAMA0.
However /dev/ttyAMA0 of Raspberry Pi 3 Model B is bound to Bluetooth module.
In order to use /dev/ttyAMA0, you need to add the followings line into /boot/config.txt.

dtoverlay=pi3-miniuart-bt

After reboot, you can use /dev/ttyAMA0 as physical serial port.

HTH! Florian


On 6/2/20 8:23 PM, Jan Hoppius via Tech-talk wrote:
Hey everyone,

I have some trouble running an Raspberry Pi IOC with serial communication in parity-mode "even".

I adapted an online example and got it running without problems as long as the asynsetOption parity in st.cmd is "none"
asynSetOption("SERIALPORT",-1,"parity","none"). I checked the communication with an oszilloscope and it is fine.
As soon as I change the parity to "even" (thats what I read from the ASYN4.38 manual) it fails.

Base is R7.0.3.1
I tried ASYN 4-36 and 4-38
I tried "even" "EVEN" and "Even"

st.cmd and log after ioc-start see below

Do I have to change the parity somewhwer else? Or are other settings colliding?

Thanks in advance, best regards, Jan


st.cmd: (parity "none" is fine, "odd" is also failing)

#################################
#!/home/pi/Apps/epics/helloWorldIOC/bin/linux-arm/helloWorldIOC

#- You may have to change helloWorldIOC to something else
#- everywhere it appears in this file

< envPaths
epicsEnvSet(STREAM_PROTOCOL_PATH,"/home/pi/Apps/epics/helloWorldIOC/helloWorldIOCApp/Db")
cd "${TOP}"

## Register all support components
dbLoadDatabase "/home/pi/Apps/epics/helloWorldIOC/dbd/helloWorldIOC.dbd"
helloWorldIOC_registerRecordDeviceDriver pdbbase
drvAsynSerialPortConfigure("SERIALPORT","/dev/ttyS0",0,0,0)
asynSetOption("SERIALPORT",-1,"baud","19200")
asynSetOption("SERIALPORT",-1,"bits","8")
asynSetOption("SERIALPORT",-1,"parity","even")
asynSetOption("SERIALPORT",-1,"stop","1")
asynSetOption("SERIALPORT",-1,"clocal","Y")
asynSetOption("SERIALPORT",-1,"crtscts","N")
dbLoadRecords("/home/pi/Apps/epics/helloWorldIOC/db/arduino.db","PORT='SERIALPORT'")

## Load record instances
#dbLoadRecords("db/xxx.db","user=pi")

cd "${TOP}/iocBoot/${IOC}"
iocInit

## Start any sequence programs
#seq sncxxx,"user=pi"
###############################

Log after starting the IOC - Failure in Line 14.:

###############################
#!/home/pi/Apps/epics/helloWorldIOC/bin/linux-arm/helloWorldIOC
< envPaths
Can't open envPaths: No such file or directory
epicsEnvSet(STREAM_PROTOCOL_PATH,"/home/pi/Apps/epics/helloWorldIOC/helloWorldIOCApp/Db")
macLib: macro TOP is undefined (expanding string cd "${TOP}")
## Register all support components
dbLoadDatabase "/home/pi/Apps/epics/helloWorldIOC/dbd/helloWorldIOC.dbd"
helloWorldIOC_registerRecordDeviceDriver pdbbase
drvAsynSerialPortConfigure("SERIALPORT","/dev/ttyS0",0,0,0)
asynSetOption("SERIALPORT",-1,"baud","19200")
asynSetOption("SERIALPORT",-1,"bits","8")
asynSetOption("SERIALPORT",-1,"parity","even")
setOption failed tcsetattr failed: Invalid argument
asynSetOption("SERIALPORT",-1,"stop","1")
asynSetOption("SERIALPORT",-1,"clocal","Y")
asynSetOption("SERIALPORT",-1,"crtscts","N")
dbLoadRecords("/home/pi/Apps/epics/helloWorldIOC/db/arduino.db","PORT='SERIALPORT'")
## Load record instances
#dbLoadRecords("db/xxx.db","user=pi")
macLib: macro TOP is undefined (expanding string cd "${TOP}/iocBoot/${IOC}")
macLib: macro IOC is undefined (expanding string cd "${TOP}/iocBoot/${IOC}")
iocInit
Starting iocInit
############################################################################
## EPICS R7.0.3.1
## EPICS Base built May 13 2020
############################################################################
iocRun: All initialization complete
## Start any sequence programs
#seq sncxxx,"user=pi"
epics>
###############################
-- 
Ruhr-Universität Bochum
AG der Experimentalphysik I
Dr. Florian Feldbauer
NB 2/131 / Fach 125
Universitätsstr. 150
D-44801 Bochum

Office: NB 2/134
Phone:  (+49)234 / 32-23563
Fax:    (+49)234 / 32-14170
https://paluma.ruhr-uni-bochum.de

References:
Asyn4-38 SetOption Parity "Even" fails - "Invalid argument" Jan Hoppius via Tech-talk

Navigate by Date:
Prev: Re: Asyn4-38 SetOption Parity "Even" fails - "Invalid argument" Eric Norum via Tech-talk
Next: Re: Asyn4-38 SetOption Parity "Even" fails - "Invalid argument" Jan Hoppius via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Asyn4-38 SetOption Parity "Even" fails - "Invalid argument" Eric Norum via Tech-talk
Next: Re: Asyn4-38 SetOption Parity "Even" fails - "Invalid argument" Jan Hoppius via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 02 Jun 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·