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

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

< Rockpi4‎ | dev
(Requirement)
 
(8 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
ROCK Pi 4 exports a dedicated  serial console, which can access the low level debug message.
 
ROCK Pi 4 exports a dedicated  serial console, which can access the low level debug message.
  
== Requirement ==
+
=== Requirement ===
  
 
* ROCK Pi 4
 
* ROCK Pi 4
Line 15: Line 15:
 
[[File:usb2ttl-cable-definition.jpeg | 500px ]]
 
[[File:usb2ttl-cable-definition.jpeg | 500px ]]
  
=== Note ===
+
==== Note ====
  
 
* The default baudrate of ROCK Pi 4 is 1500000(1.5Mbps), please check if your USB to TTL cable support 1.5Mbps 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 baudrate of ROCK Pi 4 is 1500000(1.5Mbps), please check if your USB to TTL cable support 1.5Mbps 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.
Line 21: Line 21:
 
* It seems that the serial tool on macOS platform can not support custom baudrate such as 1.5Mbps due to driver restriction. If you know how to set custom baudrate on macOS, please add an item here to show your findings.
 
* It seems that the serial tool on macOS platform can not support custom baudrate such as 1.5Mbps 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. '''Don't connect the red wire.'''
Line 31: Line 31:
 
| RX(pin 10) || <---> || Green wire
 
| RX(pin 10) || <---> || Green wire
 
|-
 
|-
| TX(pin 8) || <---> || Whtie wire
+
| TX(pin 8) || <---> || White wire
 
|-
 
|-
 
| GND(pin 6) || <---> || Black wire
 
| GND(pin 6) || <---> || Black wire
Line 38: Line 38:
 
[[File:serial-connection.jpeg | 500px ]]
 
[[File:serial-connection.jpeg | 500px ]]
  
== Serial setting on host PC ==
+
=== Serial setting on host PC ===
  
 
The default serial setting for ROCK Pi 4 u-boot and kernel console is:
 
The default serial setting for ROCK Pi 4 u-boot and kernel console is:
Line 48: Line 48:
 
     flow control: none
 
     flow control: none
  
=== Linux ===
+
==== Linux ====
  
 
Minicom is the serial tool that supports wide range baud rate.
 
Minicom is the serial tool that supports wide range baud rate.
Line 70: Line 70:
 
'''/dev/ttyUSB0''' is our device here.
 
'''/dev/ttyUSB0''' is our device here.
  
==== Run minicom====
+
===== Setup minicom=====
  
Open an terminal and execute the following command:
+
First add current user to plugdev group to use minicom without sudo or root.
  
     sudo minicom -D /dev/ttyUSB0
+
     sudo usermod -a -G plugdev $USER
  
The terminal shows this:
+
Edit your '''~/.bashrc''' and add the following line with some default parameter
  
     Welcome to minicom 2.7
+
     alias minicom='minicom -w -t xterm -l -R UTF-8'
   
+
    OPTIONS: I18n
+
    Compiled on Nov 15 2018, 20:18:47.
+
    Port /dev/ttyUSB0, 08:13:38
+
   
+
    Press CTRL-A Z for help on special keys
+
   
+
            +-----[configuration]------+
+
            | Filenames and paths      |
+
            | File transfer protocols  |
+
            | Serial port setup        |
+
            | Modem and dialing        |
+
            | Screen and keyboard      |
+
            | Save setup as dfl        |
+
            | Save setup as..          |
+
            | Exit                    |
+
            +--------------------------+
+
   
+
   
+
   
+
    CTRL-A Z for help | 1500000 8N1 | NOR | Minicom 2.7 | VT102 | Offline | ttyUSB0
+
  
Press '''Ctrl+A''' and then '''O'''(press Ctrl key and A key at the same time and release, then press O key) to open the configuration menu. Choose '''Serial port setup''', and change the setting as following:
+
Login to a new terminal to take effect.
  
    Welcome to minicom 2.7
+
Create and edit file '''~/.minirc.rockpi4''', add the following content:
   
+
    OPTI+-----------------------------------------------------------------------+
+
    Comp| A -    Serial Device      : /dev/ttyUSB0                              |
+
    Port| B - Lockfile Location    : /var/lock                                |
+
        | C -  Callin Program      :                                          |
+
    Pres| D -  Callout Program      :                                          |
+
        | E -    Bps/Par/Bits      : 1500000 8N1                              |
+
        | F - Hardware Flow Control : No                                        |
+
        | G - Software Flow Control : No                                        |
+
        |                                                                      |
+
        |    Change which setting?                                              |
+
        +-----------------------------------------------------------------------+
+
                | Screen and keyboard      |
+
                | Save setup as dfl        |
+
                | Save setup as..         |
+
                | Exit                    |
+
                +--------------------------+
+
   
+
 
+
   
+
    CTRL-A Z for help | 1500000 8N1 | NOR | Minicom 2.7 | VT102 | Offline | ttyUSB0
+
  
 +
    pu port            /dev/ttyUSB0
 +
    pu baudrate        1500000
 +
    pu bits            8
 +
    pu parity          N
 +
    pu stopbits        1
 +
    pu rtscts          No
  
Please note the '''E - Bps/Par/Bits''' setting, you should use A and B key to find the right baud rate '''1500000'''.
+
Now run '''minicom rockpi4''' to use the config above and connects to the ROCK Pi 4 serial console.
  
Before exiting setting, don't forget to save them by select '''Save setup as dfl''' with Enter key on '''configuration''' menu.
+
==== Windows ====
 
+
=== Windows ===
+
  
 
Putty is also great serial tool that supports wide range baud rate.
 
Putty is also great serial tool that supports wide range baud rate.
Line 139: Line 101:
 
Launch the application Putty on your windows PC. And do the setting as follows:
 
Launch the application Putty on your windows PC. And do the setting as follows:
  
[[File:putty-setting.jpg | 500px ]]
+
For category '''Session''', set '''serial line''' as COM3, '''speed''' ad 1500000, '''connection type''' as Serial.
 +
 
 +
Write '''rockpi4''' in the '''Saved Sessions''' column and press '''Save'''.
 +
 
 +
[[File:putty-setting-session.jpg | 500px ]]
 +
 
 +
For category '''Connection---Serial''', do the setting:
 +
 
 +
[[File:putty-setting-serial.jpg | 500px ]]
 +
 
 +
Once finish the setting, press '''Open''' button to start.
 +
 
 +
==== macOS ====
 +
 
 +
* Download and install the [http://www.prolific.com.tw/UserFiles/files/PL2303HXD_G_Mac%20Driver_v2_1_0_20210311.zip PL2303 Mac OS X Driver](Universal Binary Driver)
 +
* Install [https://freeware.the-meiers.org/previous/CoolTermMacUniversal147.zip CoolTerm](Universal Binary)
 +
* Click the Option menu and set the following:
 +
** Port: select usbserial-xxx
 +
** Baud rate: choose custom and input 1500000
 +
** No flow control nor DTR/RTS
 +
 
 +
[[File:Coolterm_serialport_setting.png]]
 +
 
 +
* Click save icon to save the configuration as rockpi4 and click connect icon
 +
* Boot your ROCK Pi 4 and you will see the serial console ouput
 +
 
 +
[[File:Coolterm_output.png]]
 +
 
 +
 
 +
 
 +
 
 +
 
 +
=== FAQs ===
 +
 
 +
====1.While using debug console, there is system startup information on the screen, but the keyboard cannot be used to input text?====
 +
 
 +
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.
  
Once finish the setting, press Open button to start.
+
=== Troubleshooting ===
 +
* Post your issue at the forum: https://forum.radxa.com/c/dev

Latest revision as of 01:55, 26 May 2021

    ROCK Pi 4 >  Development >  Serial Console

ROCK Pi 4 exports a dedicated serial console, which can access the low level debug message.

Requirement

  • ROCK Pi 4
  • 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 baudrate of ROCK Pi 4 is 1500000(1.5Mbps), please check if your USB to TTL cable support 1.5Mbps baudrate. Some model of CP210X and 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 FT232RL based cable.
  • It seems that the serial tool on macOS platform can not support custom baudrate such as 1.5Mbps due to driver restriction. If you know how to set custom baudrate on macOS, please add an item here to show your findings.

Connection

Connect the USB to TTL serial cable as below. Don't connect the red wire.

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

Serial-connection.jpeg

Serial setting on host PC

The default serial setting for ROCK Pi 4 u-boot and kernel console is:

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

Linux

Minicom is the serial tool that supports wide range baud rate.

Install minicom:

   sudo apt-get update
   sudo apt-get install minicom

Plug in the USB to TTL cable, kernel `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 device here.

Setup minicom

First add current user to plugdev group to use minicom without sudo or root.

   sudo usermod -a -G plugdev $USER

Edit your ~/.bashrc and add the following line with some default parameter

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

Login to a new terminal to take effect.

Create and edit file ~/.minirc.rockpi4, add the following content:

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

Now run minicom rockpi4 to use the config above and connects to the ROCK Pi 4 serial console.

Windows

Putty is also great serial tool that supports 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.

Launch the application Putty on your windows PC. And do the setting as follows:

For category Session, set serial line as COM3, speed ad 1500000, connection type as Serial.

Write rockpi4 in the Saved Sessions column and press Save.

Putty-setting-session.jpg

For category Connection---Serial, do the setting:

Putty-setting-serial.jpg

Once finish the setting, press Open button to start.

macOS

  • Download and install the PL2303 Mac OS X Driver(Universal Binary Driver)
  • Install CoolTerm(Universal Binary)
  • Click the Option menu and set the following:
    • Port: select usbserial-xxx
    • Baud rate: choose custom and input 1500000
    • No flow control nor DTR/RTS

Coolterm serialport setting.png

  • Click save icon to save the configuration as rockpi4 and click connect icon
  • Boot your ROCK Pi 4 and you will see the serial console ouput

Coolterm output.png



FAQs

1.While using debug console, there is system startup information on the screen, but the keyboard cannot be used to input text?

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