0

I am running Raspbian Jessie 8 on Raspberry 3 and I followed the answer to the question Why my program won't communicate through ttyAMA0 on Raspbian(jessie)? But I still can't get my program to connect through serial GPIO pins.

I ran gpio readall command on the terminal and it said that PINS 15 and 16 (RX and TX) for serial is set to ALT5, but it needs to be ALT0. So, I ran the following command on the terminal.

gpio mode 15 ALT0; gpio mode 16 ALT0;

It changes the state of pins settings. However, my program keeps complaining that it can't connect to the serial port. I also noticed that once I reboot my PI, RX and TX pins changes back to ALT5. Am I missing something? or Any hints or clues will be greatly appreciated.

ThN
  • 1,042
  • 6
  • 19
  • 33
  • 1
    Possible duplicate of [How do I make serial work on the Raspberry Pi3 , Pi3B+, PiZeroW](https://raspberrypi.stackexchange.com/questions/45570/how-do-i-make-serial-work-on-the-raspberry-pi3-pi3b-pizerow) – Milliways Sep 28 '18 at 00:34

1 Answers1

2

The Pi hardware has a full-UART and a mini-UART internal peripheral which supply serial services.

If GPIO 14/15 are in mode ALT0 the full-UART is connected to pins 8/10 (serial TXD/RXD). If GPIO 14/15 are in mode ALT5 the mini-UART is connected to pins 8/10.

The full-UART is reserved for Bluetooth use in the Raspberry Pi3. Therefore on the Pi3 you must use the mini-UART, i.e. you must set GPIO 14/15 to mode ALT5.

Refer to the port as /dev/serial0 when using pins 8/10 as a serial link.

joan
  • 67,803
  • 5
  • 67
  • 102
  • Only for interesting: if I never need Bluetooth, can I then set to mode ALT0 and use the full-UART on pins 8/10? – Ingo Sep 28 '18 at 10:57
  • @Ingo I believe so, I think you have to disable bluetooth though. See the end of milliways [answer](https://raspberrypi.stackexchange.com/questions/45570/how-do-i-make-serial-work-on-the-raspberry-pi3-pi3b-pizerow) – joan Sep 28 '18 at 11:31