0

I am trying to connect a Raspberry Pi to a OSDP card reader. The reader communicates via RS485, and is powered by 9-27V DC.

Unfortunately, I have not been able to succeed with a serial connection in any way. I have disabled serial debugging in Raspbian.

Seeing as I get no feedback from the software, I am looking to exclude the hardware as the issue. Can anyone see any flaws in the below solution? (I apologize for the child-like schematic)

If you can think if a better solution or think of any common pitfalls or ways to debug this, I'm all ears.

Schematic

I power the system with a 12V DC power supply, and use a lm2596s buck converter to supply 5V to the Raspberry. I use a RS485 shield from AB Electronics to convert UART to RS485.

EDIT

I tried what Andrew Malcolm suggested, and connected the UART pins for debugging. I do indeed receive an answer back, and it stops when disconnecting the pins. I conclude that the serial is setup correctly from this.

2

If you completely remove the shield, and connect pin 8 to pin 10 on the Pi, can you get characters echoed back? How are you writing to the port? Through /dev/ttyX ? Which terminal emulator? Minicom? Make sure it is not in local echo mode and that whatever you type comes back. Then disconnect the link from 8 to 10 and confirm the echo stops. Until you can pass that test, there's no point messing with extra hardware, you need to get the Pi configured for serial I/O. Hope this helps. If you more assistance, post back here. Good luck!

  • That is a very good idea. I've tried with Windows 10 IoT Core and from Rasbian with python3 on /dev/ttyAMA0. I will definitely try this. Had no idea I could look it back, thanks! – Troels Larsen Nov 3 '18 at 12:30
  • I tried your suggestion today, and it appears that the rpi is configured correctly. But I don't receive exactly what I send, which concerns me. I've updated my answer. – Troels Larsen Nov 3 '18 at 21:08
  • Scratch that. It was a mistake on my part. The read values match the sent ones. – Troels Larsen Nov 3 '18 at 21:24
  • Ok, so I got everything working now. I have absolutely no idea why though. I disconnected the A/B wires leading to the reader, and tried to reverse them. When that didn't work, I put them back. And now it works. There must have been a short or a loose connection somewhere. – Troels Larsen Nov 3 '18 at 21:55
1

I tested on my Pi:

This is what I had to do

sudo nano /boot/cmdline.txt

REMOVE "console=serial0,115200" and/or "console=ttyAMA0,115200"

sudo nano /boot/config.txt

ADD: dtoverlay=pi3-miniuart-bt

REBOOT

RUN sudo minicom --setup

set port to /dev/ttyAMA0

characters typed are echoed to the screen until the loopback jumper is removed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.