PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1417
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Overlay to remap Pi 3 UART

Thu Apr 21, 2016 10:03 am

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.

jpers
Posts: 21
Joined: Mon May 23, 2016 6:06 am

Re: Overlay to remap Pi 3 UART

Thu May 26, 2016 4:52 pm

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.
Hello Phil,

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.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1417
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Overlay to remap Pi 3 UART

Thu May 26, 2016 6:45 pm

Code: Select all

dtoverlay=pi3-disable-bt
is all you really need. I would suggest you also add

Code: Select all

enable_uart=1
in case we change the default for ttyAMA0 in a future release.

OldCrock
Posts: 2
Joined: Thu Nov 19, 2015 2:15 pm
Location: South Africa

Re: Overlay to remap Pi 3 UART

Fri May 27, 2016 2:41 pm

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.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1417
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Overlay to remap Pi 3 UART

Fri May 27, 2016 3:21 pm

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).

OldCrock
Posts: 2
Joined: Thu Nov 19, 2015 2:15 pm
Location: South Africa

Re: Overlay to remap Pi 3 UART

Sat May 28, 2016 11:07 am

I thank you very much sir.
Working 100%
That's all I wanted, plain and simple.

:D

Edit
Sorry, just one more please. If I enable WiFi in raspi-config, will I smash anything on the serial ??

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1417
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Overlay to remap Pi 3 UART

Sat May 28, 2016 3:15 pm

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.

Centipede
Posts: 6
Joined: Tue Mar 15, 2016 1:35 am

Re: Overlay to remap Pi 3 UART

Sat Jun 04, 2016 9:19 am

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.
Thanks Phil,
------------------
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.

Centipede
Posts: 6
Joined: Tue Mar 15, 2016 1:35 am

Re: Overlay to remap Pi 3 UART

Sat Jun 04, 2016 10:01 am

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'

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1417
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Overlay to remap Pi 3 UART

Sat Jun 04, 2016 10:20 am

I'm glad you've got it sorted.

User avatar
karrika
Posts: 952
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: Overlay to remap Pi 3 UART

Sat Jun 04, 2016 4:06 pm

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.

Image

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.

User avatar
karrika
Posts: 952
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: Overlay to remap Pi 3 UART

Wed Jun 08, 2016 7:51 am

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.

Centipede
Posts: 6
Joined: Tue Mar 15, 2016 1:35 am

Re: Overlay to remap Pi 3 UART

Thu Jun 16, 2016 9:07 pm

PhilE wrote:I'll put together an overlay that disables Bluetooth and UART1 and maps UART0/ttyAMA0 to GPIOs 14 & 15.
Phil, thank you for the hardware tree, that worked for me. A related question, is it possible to reroute the stereo audio out from the
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

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1417
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Overlay to remap Pi 3 UART

Thu Jun 16, 2016 9:17 pm

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.

User avatar
karrika
Posts: 952
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: Overlay to remap Pi 3 UART

Fri Jun 17, 2016 8:14 am

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/

Centipede
Posts: 6
Joined: Tue Mar 15, 2016 1:35 am

Re: Overlay to remap Pi 3 UART

Sat Jun 18, 2016 9:05 pm

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.
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.
standing by,

Robert

figatk
Posts: 6
Joined: Wed Sep 07, 2016 1:01 pm

Re: Overlay to remap Pi 3 UART

Wed Sep 07, 2016 1:42 pm

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:

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
The python code given in the guide (simpletest.py) has the following line

Code: Select all

bno = BNO055.BNO055(serial_port='/dev/ttyAMA0', rst=18)
When run as it is it gives the following error:

Code: Select all

SerialException: could not open port /dev/ttyAMA0: [Errno 2] No such file or directory: '/dev/ttyAMA0'
I've tried changing the code to read:

Code: Select all

bno = BNO055.BNO055(serial_port='/dev/ttyS0', rst=18)
Which gives the following error:

Code: Select all

SerialException: Could not configure port: (5, 'Input/output 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.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1417
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Overlay to remap Pi 3 UART

Wed Sep 07, 2016 2:01 pm

/dev/ttyAMA0 should exist - what do you from "dmesg | grep tty"?

figatk
Posts: 6
Joined: Wed Sep 07, 2016 1:01 pm

Re: Overlay to remap Pi 3 UART

Wed Sep 07, 2016 2:17 pm

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
Not really sure what any of that means but hope it helps.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1417
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Overlay to remap Pi 3 UART

Wed Sep 07, 2016 2:22 pm

It ought to look like this:

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.
The absence of the "3f20100.uart" line is most significant.

Can you post the entire contents of your config.txt?

figatk
Posts: 6
Joined: Wed Sep 07, 2016 1:01 pm

Re: Overlay to remap Pi 3 UART

Wed Sep 07, 2016 2:27 pm

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

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1417
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Overlay to remap Pi 3 UART

Wed Sep 07, 2016 2:32 pm

The problem is that you said you didn't want a UART:

Code: Select all

enable_uart=0
Typo?

figatk
Posts: 6
Joined: Wed Sep 07, 2016 1:01 pm

Re: Overlay to remap Pi 3 UART

Wed Sep 07, 2016 2:37 pm

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?

figatk
Posts: 6
Joined: Wed Sep 07, 2016 1:01 pm

Re: Overlay to remap Pi 3 UART

Wed Sep 07, 2016 2:39 pm

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

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1417
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Overlay to remap Pi 3 UART

Wed Sep 07, 2016 2:45 pm

What do you get from "raspi-gpio get 14" and "raspi-gpio get 15"?

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
then the overlay has done its job and I think you have a wiring problem.

Return to “Device Tree”

Who is online

Users browsing this forum: No registered users and 2 guests