I work on the development of a system using Raspberry Pi3. I had a issue with the ttyS0. I try to make communicate my raspberry with a module GSM.
When I launch my code nothing appears on my screen in spite of my printf.
I have to try to initialize the exit while following various presentations on Internet. But I revealed Bus error.
I have thus to check that my ports sérial was open. I have also to check in my C++ code which I gave well the good exit.
After that, i use a Python code to see, if my port work.
Code: Select all
import serial test_string = "Je teste le port série 1 2 3 4 5" port_list = ["/dev/ttyAMA0", "/dev/ttyAMA0", "/dev/ttyS0", "/dev/ttyS0",] for port in port_list: try: serialPort = serial.Serial(port, 9600, timeout = 2) print "Port Série ", port, " ouvert pour le test :" bytes_sent = serialPort.write(test_string) print "Envoyé ", bytes_sent, " octets" loopback = serialPort.read(bytes_sent) if loopback == test_string: print "Reçu ", len(loopback), "octets identiques. Le port", port, "fonctionne bien ! \n" else: print "Reçu des données incorrectes : ", loopback, " sur le port série ", port, " bouclé \n" serialPort.close() except IOError: print "Erreur sur ", port, "\n"
I thank you for your assistance.