Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Difference between revisions of "Zero/dev/serial-console"

< Zero‎ | dev
 
Line 4: Line 4:
 
  [[Zero | Radxa Zero]] > [[zero/dev | Development Guide]] > [[zero/dev/serial-console | Serial Console]]
 
  [[Zero | Radxa Zero]] > [[zero/dev | Development Guide]] > [[zero/dev/serial-console | Serial Console]]
  
Radxa Zero exports a dedicated serial console, which can access the low level debug message.
+
Radxa Zero exports one dedicated debug serial console, which can be used to access the low level debug message.
 +
 
 
=== Requirement ===
 
=== Requirement ===
  
Line 17: Line 18:
 
==== Note ====
 
==== Note ====
  
* The default baudrate of Radxa Zero is 115200 , please check if your USB to TTL cable support 115200 bps baudrate. Some model of [https://www.silabs.com/products/interface/usb-bridges CP210X] and [http://www.prolific.com.tw/US/ShowProduct.aspx?pcid=41 PL2303x]  have baudrate limitation, please check the specified model. We also tested that some cheap PL2303x based cable does not work well. Make sure choose a high quality one. The instructions below use a [http://www.ftdichip.com/Products/ICs/FT232R.htm FT232RL] based cable.
+
* The default baud rate of Radxa Zero is 115200 , please check if your USB to TTL cable support 115200 bps baud rate. This is a well supported data rate, but please still make sure to have a high quality one, as counterfeit products are quite common. The instructions below uses a [https://ftdichip.com/products/ft232rl/ FT232RL] based cable.
 
+
* It seems that the serial tool on macOS platform can not support custom baudrate due to driver restriction. If you know how to set custom baudrate on macOS, please add an item here to show your findings.
+
  
 
=== Connection ===
 
=== Connection ===
  
Connect the USB to TTL serial cable as below. '''Don't connect the red wire.'''
+
Connect the USB to TTL serial cable as below. '''DO NOT connect the red wire.''' We will power Radxa Zero separately from a reliable power supply.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 40: Line 39:
 
=== Serial setting on host PC ===
 
=== Serial setting on host PC ===
  
The default serial setting for Radxa Zero u-boot and kernel console is:
+
The default serial setting for Radxa Zero U-Boot and kernel console is:
  
 
     baudrate: 115200
 
     baudrate: 115200
Line 50: Line 49:
 
==== Linux ====
 
==== Linux ====
  
Minicom is the serial tool that supports wide range baud rate.
+
minicom is a serial tool that supports a wide range of baud rate.
  
 
Install minicom:
 
Install minicom:
Line 57: Line 56:
 
     sudo apt-get install minicom
 
     sudo apt-get install minicom
  
Plug in the USB to TTL cable, kernel `dmesg | tail` should show the following device:
+
Plug in the USB to TTL cable, kernel <code>sudo dmesg | tail</code> should show the following device:
  
 
     [1036835.654076] usb 1-6.4.3: new full-speed USB device number 103 using xhci_hcd
 
     [1036835.654076] usb 1-6.4.3: new full-speed USB device number 103 using xhci_hcd
Line 68: Line 67:
 
     [1036835.757195] usb 1-6.4.3: FTDI USB Serial Device converter now attached to ttyUSB0
 
     [1036835.757195] usb 1-6.4.3: FTDI USB Serial Device converter now attached to ttyUSB0
  
'''/dev/ttyUSB0''' is our device here.
+
'''/dev/ttyUSB0''' is our serial device here.
  
 
===== Setup minicom=====
 
===== Setup minicom=====
  
First add current user to plugdev group to use minicom without sudo or root.
+
First let's add the current user to <code>plugdev</code> group so we can access serial device without root permission.
  
 
     sudo usermod -a -G plugdev $USER
 
     sudo usermod -a -G plugdev $USER
  
Edit your '''~/.bashrc''' and add the following line with some default parameter
+
Edit your '''~/.bashrc''' and add the following line so minicom will always be launched with the following default setting:
  
 
     alias minicom='minicom -w -t xterm -l -R UTF-8'
 
     alias minicom='minicom -w -t xterm -l -R UTF-8'
  
Login to a new terminal to take effect.
+
Login to a new terminal to for the change to take effect.
  
Create and edit file '''~/.minirc.zero''', add the following content:
+
Create and edit file '''~/.minirc.zero''' with the following content:
  
 
     pu port            /dev/ttyUSB0
 
     pu port            /dev/ttyUSB0
Line 91: Line 90:
 
     pu rtscts          No
 
     pu rtscts          No
  
Now run '''minicom zero''' to use the config above and connects to the Radxa Zero serial console.
+
Now executing '''minicom zero''' will use the config above, and connect to Radxa Zero's serial console.
  
 
==== Windows ====
 
==== Windows ====
  
Putty is also great serial tool that supports wide range baud rate.
+
Putty is also great serial tool that supports a wide range baud rate.
  
Plug in the USB to TTL cable to you windows PC. Viewing the '''device manager''' you can find the '''COM number'''. Here it is '''COM3'''.
+
Plug in the USB to TTL cable to you windows PC. In your '''Device Manager''' you can find the '''COMX''' under Serial Port section. In our example it is '''COM3'''.
  
Launch the application Putty on your windows PC. And do the setting as follows:
+
Launch Putty on your windows PC and configure it as follows:
  
For category '''Session''', set '''serial line''' as COM3, '''speed''' ad 115200, '''connection type''' as Serial.
+
Under '''Session''', set '''Serial line''' as COM3, '''Speed''' as 115200, and '''Connection type''' as Serial.
  
Write '''zero''' in the '''Saved Sessions''' column and press '''Save'''.
+
Put '''radxa zero''' in the '''Saved Sessions''' textbox and click '''Save''' button.
  
 
[[File:Putty-setting-session-zero.jpeg | 500px ]]
 
[[File:Putty-setting-session-zero.jpeg | 500px ]]
  
For category '''Connection---Serial''', do the setting:
+
Under '''Connection-Serial''', copy the following settings:
  
 
[[File:Putty-setting-serial-zero.jpg | 500px ]]
 
[[File:Putty-setting-serial-zero.jpg | 500px ]]
  
Once finish the setting, press '''Open''' button to start.
+
Once you are done, click '''Open''' button to start using serial console.
  
 
=== FAQs ===
 
=== FAQs ===
  
====1.While using debug console, there is system startup information on the screen, but the keyboard cannot be used to input text?====
+
====1. When I opened the debug console, there is system startup information on the screen, but I can't type anything?====
 
+
One of the reason would be the wrong setting of the serial tool, such as the Hardware Flow Control, etc. Here we should disable the Hardware Flow Control.
+
  
=== Troubleshooting ===
+
One possible reason is incorrect serial configuration, such as Hardware Flow Control. Make sure Hardware Flow Control is disabled and try again.
* Post your issue at the forum: https://forum.radxa.com/c/dev
+

Latest revision as of 02:24, 2 December 2021

 Radxa Zero >  Development Guide >  Serial Console

Radxa Zero exports one dedicated debug serial console, which can be used to access the low level debug message.

Requirement

  • Radxa Zero
  • USB Type-C power adapter and USB Type-C charging data cable
  • Host PC with Windows or Linux
  • USB to TTL serial cable
    • The definition of each pin of USB to TTL cable is showing like this:

Usb2ttl-cable-definition.jpeg

Note

  • The default baud rate of Radxa Zero is 115200 , please check if your USB to TTL cable support 115200 bps baud rate. This is a well supported data rate, but please still make sure to have a high quality one, as counterfeit products are quite common. The instructions below uses a FT232RL based cable.

Connection

Connect the USB to TTL serial cable as below. DO NOT connect the red wire. We will power Radxa Zero separately from a reliable power supply.

Radxa Zero <---> USB to TTL cable
RX(pin 10) <---> Green wire
TX(pin 8) <---> White wire
GND(pin 6) <---> Black wire

Zero-serial-connection.jpeg

Serial setting on host PC

The default serial setting for Radxa Zero U-Boot and kernel console is:

   baudrate: 115200
   data bit: 8
   stop bit: 1
   parity  : none
   flow control: none

Linux

minicom is a serial tool that supports a wide range of baud rate.

Install minicom:

   sudo apt-get update
   sudo apt-get install minicom

Plug in the USB to TTL cable, kernel sudo dmesg | tail should show the following device:

   [1036835.654076] usb 1-6.4.3: new full-speed USB device number 103 using xhci_hcd
   [1036835.755730] usb 1-6.4.3: New USB device found, idVendor=0403, idProduct=6001
   [1036835.755732] usb 1-6.4.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
   [1036835.755733] usb 1-6.4.3: Product: USB <-> Serial
   [1036835.755734] usb 1-6.4.3: Manufacturer: FTDI
   [1036835.756728] ftdi_sio 1-6.4.3:1.0: FTDI USB Serial Device converter detected
   [1036835.756750] usb 1-6.4.3: Detected FT232BM
   [1036835.757195] usb 1-6.4.3: FTDI USB Serial Device converter now attached to ttyUSB0

/dev/ttyUSB0 is our serial device here.

Setup minicom

First let's add the current user to plugdev group so we can access serial device without root permission.

   sudo usermod -a -G plugdev $USER

Edit your ~/.bashrc and add the following line so minicom will always be launched with the following default setting:

   alias minicom='minicom -w -t xterm -l -R UTF-8'

Login to a new terminal to for the change to take effect.

Create and edit file ~/.minirc.zero with the following content:

   pu port             /dev/ttyUSB0
   pu baudrate         115200
   pu bits             8
   pu parity           N
   pu stopbits         1
   pu rtscts           No

Now executing minicom zero will use the config above, and connect to Radxa Zero's serial console.

Windows

Putty is also great serial tool that supports a wide range baud rate.

Plug in the USB to TTL cable to you windows PC. In your Device Manager you can find the COMX under Serial Port section. In our example it is COM3.

Launch Putty on your windows PC and configure it as follows:

Under Session, set Serial line as COM3, Speed as 115200, and Connection type as Serial.

Put radxa zero in the Saved Sessions textbox and click Save button.

Putty-setting-session-zero.jpeg

Under Connection-Serial, copy the following settings:

Putty-setting-serial-zero.jpg

Once you are done, click Open button to start using serial console.

FAQs

1. When I opened the debug console, there is system startup information on the screen, but I can't type anything?

One possible reason is incorrect serial configuration, such as Hardware Flow Control. Make sure Hardware Flow Control is disabled and try again.