How to connect Raspberry Pi UART to a computer - EmbeddedForU

several issues like kernel panics, device driver issues, device tree issues, bootloader is- sues, etc… So to debug entire system, we need an interface that can ...
654KB taille 192 téléchargements 416 vues
How to connect Raspberry Pi UART to a computer By Minion | June 8, 2015

0 Comment

The raspberry pi has a UART interface, with which it can send debug information to a serial console. As a basic step of Embedded Linux Development, let’s see the procedure to connect the Raspberry Pi UART to a computer. Signi!cance of UART in embedded Linux development Linux porting is a di!cult task. We can’t simply boot a Linux board by building u-boot, kernel, and root "le system images. This type of approach never works. It will end up with several issues like kernel panics, device driver issues, device tree issues, bootloader issues, etc… So to debug entire system, we need an interface that can send debug information from Linux hardware (raspberry pi) to a computer. There are three possible ways 1.

Network

2.

Video

3.

UART

Network and Video interfaces are not so popular in terms of system debugging. They need special hardware and initializations. Much custom Linux hardware doesn’t come with and video and network interface. In fact, network and video interface are not available during "rst a bootloader stage. But UART is considered to be a basic peripheral for all SOCs. UART does not require any

special hardware. Transmitter (Tx) and receiver (Rx) lines are enough to debug entire system. Raspberry PI UART pins ***** Download Raspberry Pi B+ schematics here ***** For any board, "rst of all you need to "nd the ‘tx’ and ‘rx’ lines of the UART. For this, you need board schematics. Download raspberry pi schematics from the above link. For raspberry, UART ‘tx’ and ‘rx’ pins are available on GPIO header (J8 connector). Refer “GPIO EXPANSION“ section in the schematics.

On GPIO header, pin-8 and pin-10 are UART ‘tx’ and ‘rx’ pins. PIN8 – TXD PIN9 – RXD Raspberry Pi board ‘tx’, ‘rx’ pin identi"cation has shown below. You can use PIN6 as common ground between raspberry Pi and a computer.

RPi UART to a computer Two ways you can connect the UART to a computer 1.

Via a USB to UART converter

2.

Via a standard RS232 port

USB to serial converter You can connect Raspberry pi to a computer using a USB to UART converter. In fact, it is the easiest way and also less risk involved.

Note that, the TTL logic levels of Broadcom SOC are Logic0-0v and Logic1-3.3v. So, before purchasing a USB to UART converter, make sure that it supports UART with 3.3v TTL logic levels. Required hardware: USB to UART with 3v3 TTL logic levels Three female-to-female cables If you have a USB to UART converter with 3v3 TTL logic levels, then connections are as

simple as shown below.

TXD and RXD pins of the USB to UART converter and Raspberry Pi should connect as shown below.

Warning: If you have a USB to UART converter with 5V TTL logic levels, then don’t dare to connect to raspberry Pi. It de"antly damages your pi’s UART controller. In such cases, better buy a Logic Level Converter that converts 3.3V to 5V, vice versa.

Via standard RS232 port

Raspberry pi can connect to an RS232 port using MAX3232. You already know about MAX 232, it is a level converter that converts UART TTL-5V logic levels to RS232 logic levels. Similarly MAX3232 converts UART TTL 3v3 logic levels to RS232 levels.

You can purchase max3232 PCB online. You can also design your own MAX3232 board using below links. Download Max2323 datasheet here In datasheet, refer 10.2 section for circuit diagram. as per data sheet, For 3.3v Vcc, use 100nF (0.1 uF) capacitors. You can also refer this link for max2323 circuit Warning:Try at your own risk Thanks Category: Embedded linux