- UART Port ใช้ไฟ 3.3V logic level
- PL011 คือ ตัวประมวลผลหลักที่ใช้
- Linux directory path -> /dev/ttyAMA0 for the PL011 UART.
- Maximum speed = 921600 bps refer PrimeCell UART (PL011) Technical Reference Manual
setting -> refer https://www.raspberrypi.org/forums/viewtopic.php?t=73673
-> refer document in attach file UART at Raspberry Pi GPIO Pinout.pdf
Refer: Content from https://www.raspberrypi.org/documentation/configuration/uart.md
In Linux device terms, by default, /dev/ttyS0 refers to the mini UART, and /dev/ttyAMA0 refers to the PL011.
Refer: Content from https://www.teachmemicro.com/raspberry-pi-serial-uart-tutorial/
The Raspberry Pi UART transmit (TXD) and Receive (RXD) pins are assigned to GPIO14 and GPIO15 respectively:
Note that these pins use 3.3V logic levels so you can’t connect them directly to devices that uses 5V like an Arduino UNO or a PC.
Technically, the Raspberry Pi has two UARTs: PL011 UART and mini UART. However, you only have one pair of TXD and RXD pins to work with.
The PL011 UART is the main UART for models without Bluetooth feature and is tied directly to the Linux console output. This means you can send Linux commands from your PC to the Raspberry Pi on this UART.
On the other hand, the mini UART becomes the Linux console UART for models with Bluetooth like the Raspberry Pi 3 and Raspberry Pi Zero W. For these models, the PL011 UART is tied directly to the Bluetooth module.
Whichever UART is assigned to the Linux console is accessible through /dev/serial0. Each UART can be accessed individually via /dev/ttyS0 for the mini UART and /dev/ttyAMA0 for the PL011 UART.
Connecting a Raspberry Pi to PC using UART
To connect the Raspberry Pi to a PC via UART, you will need a USB Serial Cable that supports 3.3V.
Refer to BCM2835-ARM-Peripherals.pdf
The BCM2835 device has two UARTS. On mini UART and PL011 UART. This section describes the PL011 UART. For details of the mini UART see 2.2 Mini UART. The PL011 UART is a Universal Asynchronous Receiver/Transmitter. This is the ARM UART (PL011) implementation. The UART performs serial-to-parallel conversion on data characters received from an external peripheral device or modem, and parallel-to-serial
conversion on data characters received from the Advanced Peripheral Bus (APB).
PrimeCell UART (PL011) Technical Reference Manual
Overview The UART performs:
• serial-to-parallel conversion on data received from a peripheral device
• parallel-to-serial conversion on data transmitted to the peripheral device. The CPU reads and writes data and control/status information through the AMBA APB interface. The transmit and receive paths are buffered with internal FIFO memories enabling up to 32-bytes to be stored independently in both transmit and receive modes. The UART:
• includes a programmable baud rate generator that generates a common transmit and receive internal clock from the UART internal reference clock input, UARTCLK
• offers similar functionality to the industry-standard 16C650 UART device
• Supports the following maximum baud rates:
— 921600 bps, in UART mode
— 460800 bps, in IrDA mode
— 115200 bps, in low-power IrDA mode.
The UART operation and baud rate values are controlled by the Line Control Register, UARTLCR_H on page 3-12 and the baud rate divisor registers (Integer Baud Rate Register, UARTIBRD on page 3-9 and Fractional Baud Rate Register, UARTFBRD on page 3-10).
I have the UART on my RPi working just fine at 115,200 bps talking to another micro. I released the UART from getty by commenting out the line in /etc/inittab and I know the uart is working just fine.
But I'd like it to go faster - ideally 921600 which is the top speed of my micro.
But when I run
minicom -b 921600 -D /dev/ttyAMA0
and then look at the signals using a scope they are still at 115200 baud.
I can set it lower like 9600 baud and that works fine.
I also tried the python miniterm but it also appears to only run at 115200 even when set for higher baud rates. It also works when setting lower baud rates but appears to max at 115200.
Is there a way to get the UART to go faster than 115200 or is that the maximum on the RPi?
Add the following line to /boot/config.txt
or 16X whatever the max baud rate you want.
That totally worked right out of the box! I'm now running at 10X (well almost) what I was running before. Much better !
So the solution is that the clock to the UART has to be at least 16X faster than the setting for init_uart_clock in /boot/config.txt. The default is only 3MHz which results in just a little over 115200. So at the default setting, the max UART baud rate is 115200.
Adding the following line to /boot/config.txt
allows the baud rate to be as high as 921600 which is all the speed I need for my application.
Set it even higher for higher baud rates if the other side can handle it.