RS485 Pi Not transmitting
The RS485 Pi is an RS485 interface for the Raspberry Pi
05/04/2019
Posted by:
chrisb
My target device need the letter "R" sent before sending a response. With the USB adapter connected, it works fine and I get the response as expected but with the RS485 Pi I get nothing.
I have connected the RS485 Pi via the FTDI USB adapter to a PC running TeraTerm. With this I am able to see anything typed into TeraTerm on the Pi, but the character sent by the Pi does not appear in TeraTerm. This is leading me to the conclusion that it's not transmitting, but receiving fine.
Code below:
#!/usr/bin/python
import time
import serial
ser = serial.Serial(
port='/dev/ttyAMA0',
baudrate = 19200,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
ser.reset_input_buffer()
ser.reset_output_buffer()
time.sleep(2)
def read():
while 1:
ser.write("R\n")
x=ser.readline()
print x
time.sleep(1)
read()
Any suggestions? I've tried it with and without the 120ohm termination resistor with no change.
Any help offered would be much appreciated.
05/04/2019
Posted by:
andrew
If the characters you type are echoed back to the screen then that will confirm that the Raspberry Pi is transmitting data on the UART port in which case there may be a fault with the RS485 board. If nothing appears on the screen then there may be a problem either with the Raspberry Pi UART port or the UART configuration in Linux.
05/04/2019
Posted by:
chrisb
minicom -b 115200 -o -D /dev/ttyAMA0
Typing in the mincom terminal window gives me no response. I've tried the same SD card in another Pi with the same response so I'm assuming I've configured the UART incorrectly. Any pointers on the best way to troubleshoot this?
05/04/2019
Posted by:
andrew
Try going through the steps in our Serial Pi tutorial to check that the UART port is configured correctly. For the Raspberry Pi, you will need this tutorial
If that does not work, if you have a spare SD card, try setting up a fresh install of Raspbian Linux and see if that fixes the problem.
08/04/2019
Posted by:
chrisb
I'm assuming this means the RS485 Pi board has a fault?
08/04/2019
Posted by:
andrew
23/03/2020
Posted by:
ClayHadi
So i have one pin GPIO17 which i do TX_EN (high) or RX_EN(low). The the IC is able to transmit or listen via the halfduplex RS485.
I actually do TX_EN , Send command to a device , quickly RX_EN, listening to the answer from the device. The answer is coming almost directly(ca.1 ms delay).The device answers directly after receiving last Byte. The problem i have is that i'm not able to change to RX_EN enough quickly all the time.
23/03/2020
Posted by:
andrew
One method to get around the problem of switching the RS485 transceiver between transmit and receive is to use a transistor connected to the TX pin to switch the direction when the UART port is transmitting.
We use this method on our RS485 Pi, you can find the schematic for the board here.
When transmitting the UART TX pin goes low causing the BSN20 transistor to switch off. This in turn sets the RE and DE pins on the RS485 transceiver high putting it into transmit mode. When the TX pin goes high the transistor switches on putting the RS485 transceiver into receive mode.
On the RS485 Pi, we also included the option to use a separate GPIO 17 pin to control the direction by moving the 0R resistor from R6 to R7 but for the speeds supported by the SN65HVD72 transceiver, we found that switching the direction directly from the TX pin works adequately.
16/10/2020
Posted by:
Andy
I've recently bought an RS485 Pi which doesn't seem to transmitting the data. I've checked Raspberry UART port by shorting the pins - it works fine. Is there any other possibility to check if the RS485 Pi works properly? I don't have any advanced equipement like an osciloskope - just a digital multimeter.
regards,
Andy
17/10/2020
Posted by:
andrew
You should be able to do a basic test to see if the RS485 Pi is transmitting using a digital multimeter and the program minicom.
First set your multimeter to measure DC voltage and connect your probes to the A and ground pins on the RS485 output pads. You should measure a voltage of approximately 1.3V.
Repeat the measurement between the B and ground pins, this should also show 1.3V.
A voltage of 1.3V on the A and B pins will indicate that the transceiver on the RS485 Pi is generating the correct voltages.
If your multimeter can measure in the millivolt range, 0 to 20mV you can check if the RS485 Pi is sending data by setting your multimeter to measure AC voltage, connecting your probes between the A and B pin and using a terminal program like minicom to send data through the RS485 bus.
Start minicom with the device set to /dev/ttyAMA0 and the baud rate at 115200.
sudo minicom -b 115200 -D /dev/ttyAMA0
With the multimeter connected to the A and B pins, it should show a voltage of 0V.
Next press and hold down a key on your keyboard so minicom keeps sending the same keypress down the RS485 bus. The multimeter should show a small voltage when the key is pressed. On my multimeter, it showed between 17 and 22mV depending on which key I pressed but your multimeter may show a different voltage depending on how it samples AC voltages.
If you get any voltage change that will indicate that the RS485 Pi is sending data down the bus. To do more advanced tests you will need some more advanced test equipment like an oscilloscope or logic analyser to probe the RS485 bus or an RS485 device to act as a receiver so you can try sending data between the two devices. You could use either a USB RS485 transceiver connected to your PC or a second RS485 Pi on another Raspberry Pi,
Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.