Communication with baudrate 110

Asked

Viewed 135 times

2

I have to receive data from a device that has a TTL interface that sends the data at 110 bits per seconds.

In all the tests I performed when I try to reach that speed I have problems, for example:

  • My program does not receive the 9 bytes sent, only 8 and what it receives does not agree with what should.

  • Receive Using minicom (Linux Ubuntu) it does not accept configure baudrate with 110 only 300 which does not favor reading.

  • With Arduino (ide v1.6 and v1.8) when I send something through the serial at 300 bits per second it only goes nonsense characters, any other speed works (to send a simple Serial.println("hi") )

Any idea what might be going on?

  • Maybe you have a better ability to answer if you ask here: https://arduino.stackexchange.com/ - since this doubt will not solve with knowledge or understanding of algorithms, but configuration of the serial port, and possibly physical components of the link.

1 answer

0

One option is to use the Python language using the pyserial module. It is a very versatile module, being able to receive several configurations of the serial communication and standards.

An example of Python code using serial below:

import serial

class Comunicacao():

    def SerialInit(self, NomePorta, Velocidade, TimeRX, TimeTX):

        try:
            self.PortaCom = serial.Serial(NomePorta, Velocidade, 8, serial.PARITY_NONE, serial.STOPBITS_ONE, TimeRX,
                                          False, False, False, TimeTX)
            self.PortaCom.reset_input_buffer()
            self.PortaCom.reset_output_buffer()

        except Exception:
            print("Erro na porta " + NomePorta + "!")



    def WriteSerial(self, DadosTx):

        try:
            self.PortaCom.flushOutput()
            TamPac = DadosTx[3]
            for i in range(TamPac):
                DadoTxByte = bytes((DadosTx[i],))

                self.PortaCom.write(DadoTxByte)
                print(DadoTxByte)

        except Exception:
            print("Erro Escrita")

    def Leitura_Serial(self, DadosRx):

        LeituraSerial = [0] * 200

        for i in range(200):

            if (self.PortaCom.in_waiting > 0):
                LeituraSerial[i] = self.PortaCom.read()
                LeituraSerial[i] = self.ByteToInt(LeituraSerial[i])
                print(LeituraSerial[i])

            else:
                break

DadosTx = [1,2,3,4,5,6,7,8]
DadosRx = [0] * 100
PortaCom = Comunicacao()
PortaCom.SerialInit("/dev/ttyUSB0", 115200, 1, 1)
PortaCom.WriteSerial(DadosRx)
  • I have tried reading with Python and had the same problem, is it possible that in the Raspberry Kernel the UART is limited to working at 300 bps? I say this because this is the lowest speed I can connect with the minicom.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.