Strange serial port behaviour on Raspberry PI
Clash 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?
raspberry-pi raspbian serial-port stty uart
add a comment |Â
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?
raspberry-pi raspbian serial-port stty uart
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
add a comment |Â
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?
raspberry-pi raspbian serial-port stty uart
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?
raspberry-pi raspbian serial-port stty uart
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
add a comment |Â
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
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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