Community Forum Share your projects and post your questions

Register or Sign In

RS485 Pi Not transmitting

44 Views - Created 19 days ago

19 days ago

Posted by:
chrisb

Users Avatar

I have an RS485 Pi which doesn't seem to be transmitting. I'm using it to replace a USB FTDI RS485 adapter.

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.

19 days ago

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Can you try connecting the TXD (pin 8) and RXD (pin 10) on the Raspberry Pi GPIO header together and then try typing some characters into TeraTerm on the Pi? 

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.

AB Electronics UK Tech Support

19 days ago

Posted by:
chrisb

Users Avatar

Thanks for the response. I have tried bridging these pins and then using minicom (as I'm only using SSH to the pi) with the following parameters: 

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?

19 days ago

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

If the same problem is happening on two Raspberry Pis then that would suggest it is a configuration issue with Linux on the SD card.

Try going through the steps in our Serial Pi tutorial to check that the UART port is configured correctly.  For the Raspberry Pi 3 or Zero W you will need this tutorial, for all other models use 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.

AB Electronics UK Tech Support

16 days ago

Posted by:
chrisb

Users Avatar

I've doubled checked with a fresh install of Raspbian and after reconfiguring the UART I'm getting my keystrokes echoed back in minicom but still the same behaviour as before with the RS485 Pi connected. If I connect it to the USB FTDI adapter I see characters typed into Tera Term on the PC appear on the Pi but not vice versa.

I'm assuming this means the RS485 Pi board has a fault? 

16 days ago

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

It does look like there could be a fault with the RS485 Pi.  I have sent you an email regarding the problem.

AB Electronics UK Tech Support

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.