Comportamento estranho da porta serial no Raspberry PI

1

Estou tentando receber dados seriais em um Raspberry Pi por meio do pino GPIO15 (RXD). Eu tenho o seguinte script python:

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

Usado para funcionar como um encanto na distribuição raspbian. Imprimindo todos os bytes quando eles chegam.

Onde procura mudar as distribuições. e ter nossos olhos em DietPI. Com a distribuição DietPI. Ele recebe apenas bytes de lixo. (principalmente muitos de zero).

Algumas considerações:

stty-F / dev / ttyAMA0 -a (resultado na distribuição antiga):

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 (resultado da nova distribuição da dieta):

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

Quando configuro a taxa de transmissão via comando stty em dietpi (stty -F / dev / ttyAMA0 2400). Ele muda para 2400. Mas quando eu explodi-lo com dados seriais, ele muda de volta para um valor diferente, na maioria das vezes 19200. Eu acho que ele tenta calibrar automaticamente para uma taxa de transmissão? Eu verifiquei que ainda funciona na distribuição antiga. Este não é um problema de hardware. Há algo errado com a configuração da porta serial em uma distribuição dietpi?

    
por Oht 14.06.2018 / 11:04

0 respostas