-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 3665
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: Overlay to remap Pi 3 UART
Do you have a "console=..." in your config.txt? You should use "console=serial0,115200" - you can change the baudrate, but if you use serial0 then it will work in all flavours of Pi.
Re: Overlay to remap Pi 3 UART
Hello Phil,PhilE wrote:That's absolutely fine. I have a small correction though - please don't include the "-overlay" in the dtoverlay directive. It isn't guaranteed to work in the future.
Is there an "official" minimalistic guide how to revert Pi 3 to Pi 2 functionality regarding UART (I know all about the reasons why this needs to be done, most guides are very elaborate on this, but vague on implementation)? There also many variants how to do it, some don't work anymore, etc.
I don't need Bluetooth, but I need WiFi, I also read somewhere that the overlay trick disables wifi (I want Pi 2 like system, Pi 2 did not have bluetooth).
Perhaps you can just post a link to a blog or a page with the instructions you professionally judged to be correct?
Regards,
Janez.
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 3665
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: Overlay to remap Pi 3 UART
Code: Select all
dtoverlay=pi3-disable-bt
Code: Select all
enable_uart=1
Re: Overlay to remap Pi 3 UART
Good day Phil.
Can you please help me keep my sanity. I come on my knees !! I have the same problem as Janez above and I come with same minimalistic request.
What I want is WiFi (If possible) and just a plain simple 4800 connection to listen to a GPS from Python. I have done that on the Pi B so python is not a problem. I just need to get the Pi3 serial running !!!
I have made a new NOOBS_v1_9_1 SD card and installed Raspbian from scratch.
I re-booted the Pi, with Putty on my laptop connected to GPIO 14 & 15 @ 115200.
Everything is perfect with a Logon Prompt.
I ran sudo raspi-config and changed:-
Auto-Boot off.
Turned Serial Console off.
And re-booted, with no serial console info.
I executed :-
sudo apt-get update
sudo apt-get dist-upgrade
I installed Minicom
sudo apt-get install minicom
Then I run:-
sudo minicom -b 115200 -o -D /dev/ttyAMA0
If I press any key, it just hangs and I have to close the session.
PLEASE, just a short note, like put this in that file and do that. No overlays or remapping or BT.
Can you please help me keep my sanity. I come on my knees !! I have the same problem as Janez above and I come with same minimalistic request.
What I want is WiFi (If possible) and just a plain simple 4800 connection to listen to a GPS from Python. I have done that on the Pi B so python is not a problem. I just need to get the Pi3 serial running !!!
I have made a new NOOBS_v1_9_1 SD card and installed Raspbian from scratch.
I re-booted the Pi, with Putty on my laptop connected to GPIO 14 & 15 @ 115200.
Everything is perfect with a Logon Prompt.
I ran sudo raspi-config and changed:-
Auto-Boot off.
Turned Serial Console off.
And re-booted, with no serial console info.
I executed :-
sudo apt-get update
sudo apt-get dist-upgrade
I installed Minicom
sudo apt-get install minicom
Then I run:-
sudo minicom -b 115200 -o -D /dev/ttyAMA0
If I press any key, it just hangs and I have to close the session.
PLEASE, just a short note, like put this in that file and do that. No overlays or remapping or BT.
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 3665
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: Overlay to remap Pi 3 UART
You have a number of problems:
1) When raspi-config disables the serial console it also disables the serial port. You can re-enable the serial port by editing config.txt and changing enable_uart=0 to enable_uart=1.
2) On a Pi3, ttyAMA0 is used for the Bluetooth. Since you don't want to use overlays you are stuck with using ttyS0 instead, so change your minicom command to "sudo minicom -b 115200 -o -D /dev/ttyS0". Similar changes will be required to the Python code (or how you call it).
1) When raspi-config disables the serial console it also disables the serial port. You can re-enable the serial port by editing config.txt and changing enable_uart=0 to enable_uart=1.
2) On a Pi3, ttyAMA0 is used for the Bluetooth. Since you don't want to use overlays you are stuck with using ttyS0 instead, so change your minicom command to "sudo minicom -b 115200 -o -D /dev/ttyS0". Similar changes will be required to the Python code (or how you call it).
Re: Overlay to remap Pi 3 UART
I thank you very much sir.
Working 100%
That's all I wanted, plain and simple.

Edit
Sorry, just one more please. If I enable WiFi in raspi-config, will I smash anything on the serial ??
Working 100%
That's all I wanted, plain and simple.

Edit
Sorry, just one more please. If I enable WiFi in raspi-config, will I smash anything on the serial ??
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 3665
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: Overlay to remap Pi 3 UART
WiFi doesn't use the serial port - it is accessed via the other SD interface (the one known as 'mmc'). Enabling WiFi will have no effect at all on the serial ports.
Re: Overlay to remap Pi 3 UART
Thanks Phil,PhilE wrote:I've pushed the new overlay (pi3-disable-bt) to the rpi-4.1.y source tree. You can download a pre-built version here.
------------------
I placed this in /boot/config.txt:
#change ttyAMA0 back to original
dtoverlay=pi3-disable-bt
I also ran the command: sudo systemctl disable hciuart
----------------------------
I note the /boot/overlay directory has this file in it:
-rwxr-xr-x 1 root root 810 May 4 15:09 pi3-disable-bt.dtbo
-----------------------------
This creates the following devices:
lrwxrwxrwx 1 root root 5 Jun 4 03:08 serial1 -> ttyS0
crw-rw---- 1 root dialout 4, 64 Jun 4 03:08 ttyS0
no /dev/ttyAMA0, btw
------------------------------------
when running the python script below:
---------------------------------
#! /usr/bin/python
import serial
import time
port = serial.Serial("/dev/serial1")
port.baudrate=9600
while True:
port.write("Say something:\n")
time.sleep(0.10)
---------------------------
I get these results:
---------------------------
$ ./test.py
Traceback (most recent call last):
File "./test.py", line 7, in <module>
port = serial.Serial("/dev/serial1")
File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 261, in __init__
self.open()
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 282, in open
self._reconfigurePort()
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 311, in _reconfigurePort
raise SerialException("Could not configure port: %s" % msg)
serial.serialutil.SerialException: Could not configure port: (5, 'Input/output error')
--------------------------------------
removing the overlay, removes /dev/ttyS0 and creates /dev/ttyAMA0, with the /dev/serial pointing to it
running ./test.py now runs without an error, however the output does not appear on the GPIO pins.
--------------------------------------
I assume I am doing something wrong, but I have no clue, unfortunately.
Re: Overlay to remap Pi 3 UART
OK, I got it working now, I needed to change to: /dev/ttyAMA0 or /dev/serial0
and also adjust /boot/config.txt to: 'enable_uart=1'
and also adjust /boot/config.txt to: 'enable_uart=1'
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 3665
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: Overlay to remap Pi 3 UART
I'm glad you've got it sorted.
Re: Overlay to remap Pi 3 UART
Guys,
I have now been trying the whole morning to get the pins mapped correctly back to ttyAMA0.
Already had the oscilloscope connected and the data was stubbornly always flowing out as ttyS0.
Well, after hours of work I finally realized the "dtparam" was supposed to be "dtOVERLAY".
But yes. The UART works perfectly at 250k with DMX.

Thanks PhilE. Now I wonder if I should buy a bt speaker to feed out the sound through Bluetooth. Would the pi3-miniuart-bt overlay be fast enough for that? Not that I will use it, Just curious.
I have now been trying the whole morning to get the pins mapped correctly back to ttyAMA0.
Already had the oscilloscope connected and the data was stubbornly always flowing out as ttyS0.
Well, after hours of work I finally realized the "dtparam" was supposed to be "dtOVERLAY".
But yes. The UART works perfectly at 250k with DMX.

Thanks PhilE. Now I wonder if I should buy a bt speaker to feed out the sound through Bluetooth. Would the pi3-miniuart-bt overlay be fast enough for that? Not that I will use it, Just curious.
Re: Overlay to remap Pi 3 UART
Yesterday I was running the lights using Raspberry Pi 3 UART instead of Raspberry Pi 2 UART. With Raspberry Pi 2 DMX I noticed small flickering about once every 3-10 minutes on the halogen lights. With Raspberry Pi 3 UART there in no flickering at all for the whole evening.
So for reliable 250k UART (DMX) the Raspberry Pi 3 is better. Of course this is only my subjective opinion from the play yesterday. But in any case I will only be using Raspberry Pi 3's in the future for light control.
The software I use is QLC+ latest Massimos image.
So for reliable 250k UART (DMX) the Raspberry Pi 3 is better. Of course this is only my subjective opinion from the play yesterday. But in any case I will only be using Raspberry Pi 3's in the future for light control.
The software I use is QLC+ latest Massimos image.
Re: Overlay to remap Pi 3 UART
Phil, thank you for the hardware tree, that worked for me. A related question, is it possible to reroute the stereo audio out from thePhilE wrote:I'll put together an overlay that disables Bluetooth and UART1 and maps UART0/ttyAMA0 to GPIOs 14 & 15.
3.5mm jack to a couple of lines on the 40 pin connector using another hardware tree? Perhaps any 2 pins from this list: 11, 12, 13, 18, 22?
Thanks,
Robert
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 3665
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: Overlay to remap Pi 3 UART
That's a coincidence - this user has the same request. For some reason I haven't got it working yet, but in principle it's easy.
Re: Overlay to remap Pi 3 UART
I have a dt blob on the Miscap eeprom that maps the audio automatically to the pins 12, 13. Works like a charm and you do not need to put anything in config.txt. It just reads everything from the eeprom at startup. There is the sources and instructions for setting it up at the end of the Miscap page. http://discohat.com/miscap/
Re: Overlay to remap Pi 3 UART
If you can get it to work, it would be a big help to me, even if I need to provide a bit of audio amplification.PhilE wrote:That's a coincidence - this user has the same request. For some reason I haven't got it working yet, but in principle it's easy.
standing by,
Robert
Re: Overlay to remap Pi 3 UART
Hi,
I know this is fairly dated, but seemed like the best thread to ask for advice. I'm also very new to the Raspberry Pi world, so please bare with me.
I'm trying to connect a Pi 3 to a BNO055 Absolute Orientation Sensor mostly following this guide Adafruit BNO055 Guide. I've obviously discovered the issue with the Pi 3's bluetooth occupying the UART port needed for the device and have tried a variety of work around's for it - including what you've posted here. I've tried using NOOBs and a straight Rasbian Jessie OS. I've also tried with the serial both disabled and enabled (in raspi-config advanced options).
Last fresh install of Jessie I issued these commands, before following the Adafruit guide:
The python code given in the guide (simpletest.py) has the following line
When run as it is it gives the following error:
I've tried changing the code to read:
Which gives the following error:
What is infuriating is that I somehow had the device working when I first acquired it, but I didn't record the steps taken then and I knew nothing about the Pi/Python at the time so couldn't recall what I did. So I know the device can work how it is currently wired and with some relatively simple inputs. There is definitely a lot going on that I don't understand, but I really just need to get the sensor working so I can begin manipulating the code and getting some data output (this is for a thesis project, which I am very quickly running out of time on). So if anyone has any advice/ideas on how to get this to work that'd be hugely appreciated.
I know this is fairly dated, but seemed like the best thread to ask for advice. I'm also very new to the Raspberry Pi world, so please bare with me.
I'm trying to connect a Pi 3 to a BNO055 Absolute Orientation Sensor mostly following this guide Adafruit BNO055 Guide. I've obviously discovered the issue with the Pi 3's bluetooth occupying the UART port needed for the device and have tried a variety of work around's for it - including what you've posted here. I've tried using NOOBs and a straight Rasbian Jessie OS. I've also tried with the serial both disabled and enabled (in raspi-config advanced options).
Last fresh install of Jessie I issued these commands, before following the Adafruit guide:
Code: Select all
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo rpi-update
sudo nano /boot/config.txt
#added the following to the end of the file
dtoverlay=pi3-disable-bt
enable_uart=1
sudo systemctl disable hciuart
Code: Select all
bno = BNO055.BNO055(serial_port='/dev/ttyAMA0', rst=18)
Code: Select all
SerialException: could not open port /dev/ttyAMA0: [Errno 2] No such file or directory: '/dev/ttyAMA0'
Code: Select all
bno = BNO055.BNO055(serial_port='/dev/ttyS0', rst=18)
Code: Select all
SerialException: Could not configure port: (5, 'Input/output error')
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 3665
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: Overlay to remap Pi 3 UART
/dev/ttyAMA0 should exist - what do you from "dmesg | grep tty"?
Re: Overlay to remap Pi 3 UART
Code: Select all
pi@raspberrypi:~ $ dmesg | grep tty
[ 0.000000] Kernel command line: 8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=1824 bcm2708_fb.fbheight=984 bcm2709.boardrev=0xa22082 bcm2709.serial=0xee2de3d9 smsc95xx.macaddr=B8:27:EB:2D:E3:D9 bcm2708_fb.fbswap=1 bcm2709.uart_clock=48000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
[ 0.001337] console [tty1] enabled
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 3665
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: Overlay to remap Pi 3 UART
It ought to look like this:
The absence of the "3f20100.uart" line is most significant.
Can you post the entire contents of your config.txt?
Code: Select all
[ 0.000000] Kernel command line: 8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=1824 bcm2708_fb.fbheight=984 bcm2709.boardrev=0x2a02082 bcm2709.serial=0x8f6bc316 smsc95xx.macaddr=B8:27:EB:6B:C3:16 bcm2708_fb.fbswap=1 bcm2709.uart_clock=48000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
[ 0.001336] console [tty1] enabled
[ 1.933433] 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
[ 3.217510] console [ttyAMA0] enabled
[ 4.353071] systemd[1]: Expecting device dev-ttyAMA0.device...
[ 4.827865] systemd[1]: Starting system-getty.slice.
[ 4.843543] systemd[1]: Created slice system-getty.slice.
[ 4.853782] systemd[1]: Starting system-serial\x2dgetty.slice.
[ 4.870095] systemd[1]: Created slice system-serial\x2dgetty.slice.
Can you post the entire contents of your config.txt?
Re: Overlay to remap Pi 3 UART
Is this what you meant? The only changes I've made directly are on the last 2 lines.
Code: Select all
pi@raspberrypi:~ $ sudo nano /boot/config.txt
GNU nano 2.2.6 File: /boot/config.txt
#framebuffer_width=1280
#framebuffer_height=720
# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2
# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4
# uncomment for composite PAL
#sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi
# Additional overlays and parameters are documented /boot/overlays/README
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
enable_uart=0
dtoverlay=pi3-disable-bt
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 3665
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: Overlay to remap Pi 3 UART
The problem is that you said you didn't want a UART:
Typo?
Code: Select all
enable_uart=0
Re: Overlay to remap Pi 3 UART
Sorry, I have had that as enable_uart=1, I just changed it back when testing different possible combinations of solutions. With it set to 1, running the simpletest.py code produces the following error:
Code: Select all
RuntimeError: Timeout waiting for serial acknowledge, is the BNO055 connected?
Re: Overlay to remap Pi 3 UART
Also, now dmesg | grep tty gets this response:
Code: Select all
pi@raspberrypi:~/Adafruit_Python_BNO055/examples $ dmesg | grep tty
[ 0.000000] Kernel command line: 8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2709.boardrev=0xa22082 bcm2709.serial=0xee2de3d9 smsc95xx.macaddr=B8:27:EB:2D:E3:D9 bcm2708_fb.fbswap=1 bcm2709.uart_clock=48000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
[ 0.001337] console [tty1] enabled
[ 1.940966] 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 3665
- Joined: Mon Sep 29, 2014 1:07 pm
- Location: Cambridge
Re: Overlay to remap Pi 3 UART
What do you get from "raspi-gpio get 14" and "raspi-gpio get 15"?
If the answer is: then the overlay has done its job and I think you have a wiring problem.
If the answer is:
Code: Select all
pi@raspberrypi:~$ raspi-gpio get 14
GPIO 14: level=1 fsel=4 alt=0 func=TXD0
pi@raspberrypi:~$ raspi-gpio get 15
GPIO 15: level=1 fsel=4 alt=0 func=RXD0