My Pi3 serial console produces rubbish and fails to respond to the keyboard.
This answer is still correct, and explains in more detail the nature of the changes, but most users of current Raspbian should just run
Interfacing Options / Serialthen specify if you want a Serial console (probably no) then if you want the Serial Port hardware enabled (probably yes). Then use
/dev/serial0in any code which accesses the Serial Port.
The BCM2837 on the Raspberry Pi3 , Pi3B+, Pi3A+, PiZeroW has 2 UARTs (as did its predecessors), however to support the Bluetooth functionality the fully featured PL011 UART was moved from the header pins to the Bluetooth chip and the mini UART made available on header pins 8 & 10.
(The SOC on the Pi4 has additional UARTs, but the same 2 UARTs as BCM2837 are used for default serial on pins 8 & 10 and Bluetooth.)
This has a number of consequences for users of the serial interface.
/dev/ttyAMA0 previously used to access the UART now connects to Bluetooth.
The miniUART is now available on
In the latest operating system software there is a
/dev/serial0 which selects the appropriate device so you can replace
/dev/serial0 and use the same software on the Pi3 and earlier models.
Unfortunately there are a number of other consequences:-
The mini UART is a secondary low throughput UART intended to be used as a console. The mini Uart has the following features: • 7 or 8 bit operation. • 1 start and 1 stop bit. • No parities. • Break generation. • 8 symbols deep FIFOs for receive and transmit. • SW controlled RTS, SW readable CTS. • Auto flow control with programmable FIFO level. • 16550 like registers. • Baudrate derived from system clock.
There is no support for parity and the throughput is limited, but the latter should not affect most uses.
There is one killer feature "Baudrate derived from system clock" which makes the miniUART useless as the this clock can change dynamically e.g. if the system goes into reduced power or in low power mode.
/boot/config.txt removes this dependency by adding the following line at the end:-
This fixes the problem and appears to have little impact. The
SPI clock frequency and
ARM Timer are also dependent on the system clock.
For some bizarre reason the default for Pi3 using the latest 4.4.9 kernel is to DISABLE UART. To enable it you need to change
/boot/config.txt. (This also fixes the
core_freqso this is no longer necessary.)
Finally if you don't use Bluetooth (or have undemanding uses) it is possible to swap the ports back in Device Tree. There is a
disable-bt module which are described in
finally this got work for my pi3 (os: debian jessie)
please follow these 6 steps carefully.
Step 1 - Install Raspbian Jessie onto a SD card and boot the Pi when connected to a network Login via terminal or desktop and shell Configure the system with:
Expand filesystem and enable serial on advanced page, exit and reboot.
Step 2 -this won't necessary if you have jessie new release Update the system with:
sudo apt-get update sudo apt-get upgrade
Step 3 - Device Tree settings as below:
Add device tree to /boot/config.txt to disable the Raspberry Pi 3 bluetooth.
sudo nano /boot/config.txt
Add at the end of the file
*if you want to change the blutooth to miniuart port(bad)
*if you want to disable the blutooth(good)
Exit the editor saving your changes.
Step 4 - reboot the pi
step 5 -
a)to disable the Serial Console edit the file using
sudo nano /boot/cmdline.txt
remove the word phase "
console=serial0,115200" or "
Exit and save your changes
b)to Enable the Serial Console edit the file using
sudo nano /boot/cmdline.txt
Change the file to the following:
dwc_otg.lpm_enable=0 console=tty1 console=serial0(or ttyAMA0),115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
Exit and save your changes
Step 6 - reboot the pi
-----------------that's all,have fun-------------------------------
Naseer's answer is correct but a bit elaborate if you just flashed the latest rasbian. All I needed to do, is just to add the following line to my config.txt (from e.g. windows where you plug in the SD card on the fat32 partition):
Then plug it in, and the pi will directly print stuff on the console pins.
Raspberry Pi4 UART
The Pi4 has 4 additional UART (uart2-uart5) in addition to uart0/1 on the older Pi (only one of which can be used as they share GPIO).
Functionally these are equivalent to the fully featured PL011 UART on uart0 and can optionally be configured with CTS/RTS. See UART configuration for Foundation documentation.
These can be enabled (by editing
/boot/config.txt), but this requires careful consideration of the impact on GPIO functionality.
Activation of CTS/RTS functionality has additional impact
- uart2 uses GPIO0/1 which are reserved and possibly impact on normal Raspbian functionality.
- uart3 uses GPIO4/5 which is OK, although GPIO4 is commonly used for other purposes.
- uart4 uses GPIO8/9 which are used for SPI0.
- uart5 uses GPIO12/13 which conflict with the default pin allocation of gpio-fan (although this can be changed).
If additional UARTs are enabled they will appear as
The first will be
/dev/AMA1 and increment if additional UART are enabled.
Name: uart0 Info: Change the pin usage of uart0 Load: dtoverlay=uart0,<param>=<val> Params: txd0_pin GPIO pin for TXD0 (14, 32 or 36 - default 14) rxd0_pin GPIO pin for RXD0 (15, 33 or 37 - default 15) pin_func Alternative pin function - 4(Alt0) for 14&15, 7(Alt3) for 32&33, 6(Alt2) for 36&37 Name: uart1 Info: Change the pin usage of uart1 Load: dtoverlay=uart1,<param>=<val> Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) Name: uart2 Info: Enable uart 2 on GPIOs 0-3 Load: dtoverlay=uart2,<param> Params: ctsrts Enable CTS/RTS on GPIOs 2-3 (default off) Name: uart3 Info: Enable uart 3 on GPIOs 4-7 Load: dtoverlay=uart3,<param> Params: ctsrts Enable CTS/RTS on GPIOs 6-7 (default off) Name: uart4 Info: Enable uart 4 on GPIOs 8-11 Load: dtoverlay=uart4,<param> Params: ctsrts Enable CTS/RTS on GPIOs 10-11 (default off) Name: uart5 Info: Enable uart 5 on GPIOs 12-15 Load: dtoverlay=uart5,<param> Params: ctsrts Enable CTS/RTS on GPIOs 14-15 (default off)
The following summarises the pin usage:-
TXD RXD CTS RTS Board Pins uart0 14 15 8 10 uart1 14 15 8 10 uart2 0 1 2 3 27 28 (I2C) uart3 4 5 6 7 7 29 uart4 8 9 10 11 24 21 (SPI0) uart5 12 13 14 15 32 33 (gpio-fan)