0

I have a sensor which spits out information via serial and I am trying to receive that input on my Raspberry Pi 3 via the serial RX (BCM pin 15).

I'm using the wiringPi library in a C++ program to use the serial interface. I'm fairly certain that my code that reads from the serial device is correct because I was able to use USB serial devices fine.

I am trying to use /dev/ttyAMA0 in the openSerial function, which can be opened successfully. I just can't seem to get any data.

Basically:

  • I'm using the BCM pin numbers in wiringPi (wiringPiSetupGpio)
  • I have uart enabled in raspi-config
  • I have confirmed that I'm getting output from my sensor
  • I've double checked my wiring
  • I know my code works with USB serial devices

I know it could be something as simple as one wrong connection, but I've checked thoroughly and had some fresh sets of eyes look at it too, so I feel like there might be something else that I'm missing.

Not sure if related:

When I have the RX pin connected to my sensor for a few minutes, the Pi will eventually freeze. I'm not sure exactly what happens when it freezes. My ssh connection will freeze, but I can still see the ethernet light blink when I type.

I was thinking this might be caused by a short or overvoltage, but the behavior seems quite odd.

Edit: I have everything working now. I removed the console and kbdg sections from my cmdline.txt, and added dtoverlay=pi3-disable-bt to my config.txt. I have narrowed the freezing issue to the ethernet port.

sealj553
  • 3
  • 3

1 Answers1

0

Do NOT use /dev/ttyAMA0 which is connected to Bluetooth (by default).

Use /dev/serial0 which is connected to default serial port, even if you take any of the measures to modify behaviour.

Milliways
  • 62,573
  • 32
  • 113
  • 225