Reputation: 41
My issue is to make a serial communication between raspberry pi and another hardware. The recommended connection for this hardware is as shown on the manual, I have to connect, RX, TX, GND, RS, and CS.
But on raspberry pi we have only RX, TX so I connected RX and TX and The GNG of Pi to this hardware. I modified Pi's parameters as shown on the link : here
Then I maked a simple python program that initialize the communication, and send data. Here is the code : import serial,os port=serial.Serial("/dev/ttyAMA0",baudrate=9600) print ('port is ok') port.write('Command') rcv=port.read(10) print rcv
after running this code on pi, I got ('port is ok'), But the problem is that this hardware don't respond correctly to the command, and as respoce it gave me normally OK, but I got some extra caracter( non readable). Is that a problem of encoding? Can some one help about this?
Upvotes: 1
Views: 1288
Reputation: 314
In a serial communication, there are two important things to be careful :
If it's not efficient, try to set up your other device with the same conf (no flow control, etc)
Upvotes: 1
Reputation: 48
You need to check the baud rate on the other hardware or make sure that the length of the received message = to the printed message.
Upvotes: 1