reading garbage from serial port PiTInfo
I'm trying to get a PiTInfo v1.0 to work on a freshly installed Jessie on my Raspberry PI, but for reasons that escape me, I can only read garbage.
As far as I can tell, the console on serial port is disabled:
cat /boot/cmdline.txt dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
I've got a link to ttyS0
sudo ln -s /dev/ttyAMA0 /dev/ttyS0
I've set the serial port:
stty 1200 cs7 evenp cstopb -igncr -inlcr -brkint -icrnl -opost -isig -icanon -iexten -F /dev/ttyAMA0
and yet what I read is not what I'm expecting:
cat /dev/ttyAMA0 BPT@3L623@1| G]JF8Ic @*.5 | 8j@6M&S 8 0LS c .@*| @rjE@1Va @` @c @0Ka ^C
Any pointers or help would be greatly appreciated.
Thing to check in order are :
- cable wiring and lenght
- remove any other devices already connected on téléinfo terminal block of ErdF counter
- did you solder the GPIO connector on the PITinfo board ?
then if it still doesn't work
- Change the 3.3K R1 resistor by a 1.2K
then if it still doesn't work
- remove the 1.2K and do a shunt.
Let me know these results, the last one should always works ;-)
Wonderful. I really am impressed with how much effort you help people trying to follow your foot steps.
- I'll check the cable length; I don't like the cable I'm using now or how much slack there is; but I didn't think this might be an issue;
- there are no other devices - the PiTInfo connected is the only thing on the GPIO, and is directly connected to the EDF meter. There is nothing else;
- I bought the PiTInfo fully assembled;
Note that to check I just ordered a fully assembled PiTInfo v1.2 via Tindie from you - so we will see if this is a cable issue, a PiTInfo/hardware issue, or something else.
Updates to follow.
Excellent, we'll know if the changes made on 1.2 version solve your problem if it's coming from the output of your device (it should),
Just let us know, because I don't have a such device, everything always worked first time on my both counters here.
@Charles New PiTInfo arrived, thanks! Installed and still the same thing happening. I also changed the cable from the PiTInfo to the meter. Output is still:
pi@raspberry ~ $ cat /dev/ttyAMA0 GT` @ cPT@3Yn623@1| gP0FP8Ic @*.5 L | $8j@6N $8 0H[ 1F `08 er `rjE@1PVa @` ec D0Ba $@
Next things to try: a different Raspberry, perhaps an A or B+ (I've been using a Raspberry Pi 1 Model A+) then also revert back to Wheezy OS.
I don't rely too much on cat command
would you mind try a
picocom -b 1200 -d 7 -p e -f n /dev/ttyAMA0instead ?
@Charles Sorry for the delay. I had a faulty SD card and couldn't figure out why making my bootable Wheezy SD card kept failing. Booted to Wheezy, adjusted the /boot/cmdline.txt file, /etc/inittab, and rebooted, but the cat command still yields the same results.
Here's the output of picocom:
picocom -b 1200 -d 7 -p e -f n /dev/ttyAMA0 $8 c 0[ `08 er `rjE@8@a @S@ @c " @0| P* $Rj , > u @ cPT@3L623@1| gP0FPP8Ic d*.5 H | j $8j@6n$ 8 1F 0[ (p08 er drjE@8@a @S@ @c " @0jq P* c! > q @ cPT@3L623@1| G]JF8Ic! d*.5 H | j $8j@6L$' $8 0[ @ c (t08 er @rjE@8P@a @` ec " @0ja P*
Now I'm testing if it's a locale/codepage issue. What local are you using in your configurations?
playing with code pages yields nothing - still only garbage - don't know where to look anymore
@Charles It works! Why, I don't know. stty wants odd parity, picocom no parity. This is beyond me for now.
pi@raspberrypi ~ $ stty --file /dev/ttyAMA0 1200 cs7 ixon -parenb pi@raspberrypi ~ $ cat /dev/ttyAMA0 5 ADCO 012345678901 L OPTARIF HC.. < ISOUSC 30 9 HCHC 002698197 0 HCHP 010687090 2 PTEC HP.. IINST 003 Z IMAX 038 J PAPP 00680 / HHPHC A , MOTDETAT 000000 B
or with picocom:
pi@raspberrypi ~ $ picocom --baud 1200 --flow x --parity n --databits 7 /dev/ttyAMA0 picocom v1.7 port is : /dev/ttyAMA0 flowcontrol : xon/xoff baudrate is : 1200 parity is : none databits are : 7 escape is : C-a local echo is : no noinit is : no noreset is : no nolock is : no send_cmd is : sz -vv receive_cmd is : rz -vv imap is : omap is : emap is : crcrlf,delbs, Terminal ready &4Nc HCHC 002698197 0 HCHP 010687195 8 PTEC HP.. IINST 012 Z IMAX 038 J PAPP 02840 / HHPHC A , MOTDETAT 000000 Thanks for using picocom
Good it works, but the 1st time I see two linux programs that need different config to work on the same serial port !!!
would be interesting to know what node red want ;-)