Bootloader and kernel console

The Bootloader console and Linux kernel console are configured to serial port UART2 (P8/UART_TXD2 and P9/UART_RXD2) at a baud rate of 57600. This applies to both LinkIt Smart 7688 and LinkIt Smart 7688 Duo.

Since LinkIt Smart 7688 and LinkIt Smart 7688 Duo work with 3.3V power, the converter also needs to run at 3.3V.

You can access the console with a Serial (UART) to USB converter. 

This console comes in handy when you want to

  • Debug the bootloader.
  • Debug Linux bootup flow.
  • Gain access to the system console when there is no Wi-Fi connection available.

Accessing bootloader and kernel console

You can connect to the system console of LinkIt Smart 7688 and LinkIt Smart 7688 Duo development boards by using a Serial (or UART) to USB converter.

  1. Connect the Serial to USB cable to LinkIt Smart 7688’s UART pins:
    • Converter's RX to P8.
    • Converter's TX to P9.
    • GND to GND.
  1. Connect to the COM port and set baud rate to 57600.
  2. Power up or reset the board, you should see output similar to the following:

DDR Calibration DQS reg = 0000898A      
U-Boot 1.1.3 (Sep 10 2015 - 05:56:31)    
Board: Ralink APSoC DRAM:  128 MB  
relocate_code Pointer at: 87f68000  
flash manufacture id: c2, device id 20 19  
find flash: MX25L25635E  
*** Warning - bad CRC, using default environment    
Ralink UBoot Version:  
ASIC 7628_MP (Port5<->None)  
DRAM component: 1024 Mbits DDR, width 16  
DRAM bus: 16 bit  
Total memory: 128 MBytes  
Flash component: SPI Flash  
Date:Sep 10 2015  Time:05:56:31  
icache: sets:512, ways:4, linesz:32 ,total:65536  
dcache: sets:256, ways:4, linesz:32 ,total:32768
##### The CPU freq = 580 MHZ ####   
estimate memory size =128 Mbytes  
RESET MT7628 PHY!!!!!!  
GPIOMODE --> 50054404
GPIOMODE2 --> 5540551    
Please choose the operation:     
1: Load system code to SDRAM via TFTP.     
2: Load system code then write to Flash via TFTP.     
3: Boot system code via Flash (default).     
4: Entr boot command line interface.     
7: Load Boot Loader code then write to Flash via Serial.     
9: Load Boot Loader code then write to Flash via TFTP.  

There is about 1 second for you to choose from the bootloader menu. If there is no user input, the bootloader continues into Linux kernel bootup:

3: System Boot system code via Flash.  
## Booting image at bc050000 ...     
   Image Name:   MIPS OpenWrt Linux-3.18.21     
   Image Type:   MIPS Linux Kernel Image (lzma compressed)     
   Data Size:    1118412 Bytes =  1.1 MB     
   Load Address: 80000000     Entry Point:  80000000     
   Verifying Checksum ... OK     
   Uncompressing Kernel Image ... OK  
No initrd  
## Transferring control to Linux (at address 80000000) ...  
## Giving linux memsize in MB, 128    
Starting kernel ...    
[    0.000000] Linux version 3.18.21 (root@builder1) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r47269) ) #7 Sat Nov 7 14:50:53 CET 2015  
[    0.000000] Board has DDR2  
[    0.000000] Analog PMU set to hw control  
[    0.000000] Digital PMU set to hw control  
[    0.000000] SoC Type: MediaTek MT7688 ver:1 eco:2  
[    0.000000] bootconsole [early0] enabled  
[    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)  
[    0.000000] MIPS: machine is MediaTek LinkIt Smart 7688  
[    0.000000] Determined physical RAM map:  
[    0.000000]  memory: 08000000 @ 00000000 (usable)  

At this point you can press ENTER to access to the Linux kernel console, as shown below:

BusyBox v1.23.2 (2015-10-27 13:23:36 CET) built-in shell (ash)
  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 CHAOS CALMER (15.05+linkit, r47390)
  * 1 1/2 oz Gin            Shake with a glassful
  * 1/4 oz Triple Sec       of broken ice and pour
  * 3/4 oz Lime Juice       unstrained into a goblet.
  * 1 1/2 oz Orange Juice
  * 1 tsp. Grenadine Syrup

Modifying the bootloader console

If you want to use another UART port for the bootloader console, you need to modify the bootloader.

Step 1 — Get bootloader source code

Clone the UBOOT source from GitHub repository

Step 2 — Modify the console configuration

Modify the file "board/rt2880/serial.h" by defining a different port for CFG_RT2880_CONSOLE.

 * UART registers
#if defined (MT7621_FPGA_BOARD) || defined (MT7621_ASIC_BOARD) || defined (MT7628_FPGA_BOARD) || defined (MT7628_ASIC_BOARD)
#define RT2880_UART1    0x0C00  /* UART Lite */
#define RT2880_UART2    0x0D00  /* UART Lite */
#define RT2880_UART3    0x0E00  /* UART Lite */
//#define CFG_RT2880_CONSOLE    RT2880_UART1
#define CFG_RT2880_CONSOLE    RT2880_UART3
#define RT2880_UART1    0x0500
#define RT2880_UART2    0x0C00  /* UART Lite */
#define CFG_RT2880_CONSOLE    RT2880_UART2

Note that in UART registers section, RT2880_UART1 refers to UART0 (UART_TXD0/UART_TXR0), the same applies to RT2880_UART2 and RT2880_UART3

Replace this:

//#define CFG_RT2880_CONSOLE    RT2880_UART1
#define CFG_RT2880_CONSOLE    RT2880_UART3

with this:

#define CFG_RT2880_CONSOLE    RT2880_UART1
//#define CFG_RT2880_CONSOLE    RT2880_UART3 

This modification changes the bootloader console port from UART2 to UART0.

To change the baud rate, modify the file "include/configs/rt2880.h":

#define CONFIG_BOOTDELAY        1       /* autoboot after 5 seconds     */
#define CONFIG_BAUDRATE         57600

Replace this:

#define CONFIG_BAUDRATE         57600

with this:

#define CONFIG_BAUDRATE         115200

This will then change the bootloader console baud rate from 57600 to 115200.

Step 3 — Build and upload the modified bootloader

Now build the bootloader and upload it to the board.

Modifying the kernel console

To use a different UART port for the kernel console, you can follow the steps below to adjust the configuration.

Step 1 — Get firmware source code

Follow the descriptions to get the source code of the firmware.

Step 2  — Modify the console configuration

Modify the file " target/linux/ramips/dts/LINKIT7688.dts", and replace this

chosen {
    bootargs = "console=ttyS2,57600";

with this:

chosen {
    bootargs = "console=ttyS0,115200";

This will then change the kernel console port from UART2 to UART0 and its baud rate from 57600 to 115200.

Step 3 — Build and upload the modified firmware

Now build the firmware and upload it to the board through the  Web UI  or the  USB drive .