Strange serial port behaviour on Raspberry PI

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I'm trying to receive serial data on a Raspberry Pi through the GPIO15(RXD) pin.
I have the following python script:



serPort = serial.Serial("/dev/ttyAMA0", baudrate=2400)
while True:
rcv = ord(serPort.read())
print(str(rcv))


Used to work like a charm on raspbian distribution. Printing all the bytes as they came in.



Where looking into changing distributions. and have our eyes on DietPI.
With the DietPI distribution. It receives only garbage bytes. (mainly lots of zero's).



Some considerations:



stty -F /dev/ttyAMA0 -a (result on old distribution):



speed 2400 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke


stty -F /dev/ttyAMA0 -a (result on new dietpi distribution):



speed 2400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke -flusho -extproc


When i configure the baudrate via stty command in dietpi (stty -F /dev/ttyAMA0 2400). It changes it to 2400. But when i blast it with serial data, it changes it back to a different value, most of the time 19200. I think it tries to auto calibrate to a baudrate? I've verified that it still works on the old distribution. This is NOT a hardware issue. Is there something wrong with the serial port configuration on a dietpi distribution?







share|improve this question





















  • I don't know DietPI but maybe you need to disable shell and kernel messages on the serial connection?
    – laktak
    Jun 14 at 9:23










  • Could you elaborate? Do you mean in cmdline.txt?
    – Oht
    Jun 14 at 11:55










  • see github.com/Fourdee/DietPi/issues/306
    – laktak
    Jun 14 at 14:35














up vote
1
down vote

favorite












I'm trying to receive serial data on a Raspberry Pi through the GPIO15(RXD) pin.
I have the following python script:



serPort = serial.Serial("/dev/ttyAMA0", baudrate=2400)
while True:
rcv = ord(serPort.read())
print(str(rcv))


Used to work like a charm on raspbian distribution. Printing all the bytes as they came in.



Where looking into changing distributions. and have our eyes on DietPI.
With the DietPI distribution. It receives only garbage bytes. (mainly lots of zero's).



Some considerations:



stty -F /dev/ttyAMA0 -a (result on old distribution):



speed 2400 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke


stty -F /dev/ttyAMA0 -a (result on new dietpi distribution):



speed 2400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke -flusho -extproc


When i configure the baudrate via stty command in dietpi (stty -F /dev/ttyAMA0 2400). It changes it to 2400. But when i blast it with serial data, it changes it back to a different value, most of the time 19200. I think it tries to auto calibrate to a baudrate? I've verified that it still works on the old distribution. This is NOT a hardware issue. Is there something wrong with the serial port configuration on a dietpi distribution?







share|improve this question





















  • I don't know DietPI but maybe you need to disable shell and kernel messages on the serial connection?
    – laktak
    Jun 14 at 9:23










  • Could you elaborate? Do you mean in cmdline.txt?
    – Oht
    Jun 14 at 11:55










  • see github.com/Fourdee/DietPi/issues/306
    – laktak
    Jun 14 at 14:35












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I'm trying to receive serial data on a Raspberry Pi through the GPIO15(RXD) pin.
I have the following python script:



serPort = serial.Serial("/dev/ttyAMA0", baudrate=2400)
while True:
rcv = ord(serPort.read())
print(str(rcv))


Used to work like a charm on raspbian distribution. Printing all the bytes as they came in.



Where looking into changing distributions. and have our eyes on DietPI.
With the DietPI distribution. It receives only garbage bytes. (mainly lots of zero's).



Some considerations:



stty -F /dev/ttyAMA0 -a (result on old distribution):



speed 2400 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke


stty -F /dev/ttyAMA0 -a (result on new dietpi distribution):



speed 2400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke -flusho -extproc


When i configure the baudrate via stty command in dietpi (stty -F /dev/ttyAMA0 2400). It changes it to 2400. But when i blast it with serial data, it changes it back to a different value, most of the time 19200. I think it tries to auto calibrate to a baudrate? I've verified that it still works on the old distribution. This is NOT a hardware issue. Is there something wrong with the serial port configuration on a dietpi distribution?







share|improve this question













I'm trying to receive serial data on a Raspberry Pi through the GPIO15(RXD) pin.
I have the following python script:



serPort = serial.Serial("/dev/ttyAMA0", baudrate=2400)
while True:
rcv = ord(serPort.read())
print(str(rcv))


Used to work like a charm on raspbian distribution. Printing all the bytes as they came in.



Where looking into changing distributions. and have our eyes on DietPI.
With the DietPI distribution. It receives only garbage bytes. (mainly lots of zero's).



Some considerations:



stty -F /dev/ttyAMA0 -a (result on old distribution):



speed 2400 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke


stty -F /dev/ttyAMA0 -a (result on new dietpi distribution):



speed 2400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke -flusho -extproc


When i configure the baudrate via stty command in dietpi (stty -F /dev/ttyAMA0 2400). It changes it to 2400. But when i blast it with serial data, it changes it back to a different value, most of the time 19200. I think it tries to auto calibrate to a baudrate? I've verified that it still works on the old distribution. This is NOT a hardware issue. Is there something wrong with the serial port configuration on a dietpi distribution?









share|improve this question












share|improve this question




share|improve this question








edited Jun 14 at 9:15
























asked Jun 14 at 9:04









Oht

62




62











  • I don't know DietPI but maybe you need to disable shell and kernel messages on the serial connection?
    – laktak
    Jun 14 at 9:23










  • Could you elaborate? Do you mean in cmdline.txt?
    – Oht
    Jun 14 at 11:55










  • see github.com/Fourdee/DietPi/issues/306
    – laktak
    Jun 14 at 14:35
















  • I don't know DietPI but maybe you need to disable shell and kernel messages on the serial connection?
    – laktak
    Jun 14 at 9:23










  • Could you elaborate? Do you mean in cmdline.txt?
    – Oht
    Jun 14 at 11:55










  • see github.com/Fourdee/DietPi/issues/306
    – laktak
    Jun 14 at 14:35















I don't know DietPI but maybe you need to disable shell and kernel messages on the serial connection?
– laktak
Jun 14 at 9:23




I don't know DietPI but maybe you need to disable shell and kernel messages on the serial connection?
– laktak
Jun 14 at 9:23












Could you elaborate? Do you mean in cmdline.txt?
– Oht
Jun 14 at 11:55




Could you elaborate? Do you mean in cmdline.txt?
– Oht
Jun 14 at 11:55












see github.com/Fourdee/DietPi/issues/306
– laktak
Jun 14 at 14:35




see github.com/Fourdee/DietPi/issues/306
– laktak
Jun 14 at 14:35















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f449758%2fstrange-serial-port-behaviour-on-raspberry-pi%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f449758%2fstrange-serial-port-behaviour-on-raspberry-pi%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay