Note
- VIM1 V12 doesn’t support KBI
- This document uses VIM2 as an example, VIM3 and Edge are similar.
KBI is an abbreviation for Khadas Bootloader Instructions, which is developed to fulfill the following purposes:
Manage the programmable MCU
Carry out low level hardware management
Let developers utilise all the features of Khadas VIM1V14/VIM2/VIM3/VIM4/Edge
This document describes how to setup, configure and use the KBI. As KBI is one of the U-Boot commands, to get started you have to setup a Serial Debugging Tool.
Before continuing, make sure you have booted into U-Boot:
1 | normal power off |
Get Help
You can get help information by typing kbi
:
1 | kvim2# kbi |
Command Usage
- Get the MCU firmware version:
1 | kvim2# kbi version |
- Initialize the KBI:
1 | kvim2# kbi init |
- Get the device serial number:
1 | kvim2# kbi usid |
- Get ADC value:
1 | kvim2# kbi adc |
The ADC value can be used to distinguish different hardware modules.
- Power off device:
1 | kvim2# kbi poweroff |
- Get the Ethernet MAC address:
1 | kvim2# kbi ethmac |
- Setup the blue LED:
The blue LED has different working modes: Always Off
, Always on
, Breathe
and Heartbeat
. These indicate different VIM status-modes.
The blue LED is controlled by the MCU, and the MCU is in charge of system power management.
The white LED is controlled by the CPU; therefore the blue LED still works even after you have powered off your VIM2.
The KBI can be used to program the blue LED for two different status-modes:
- system off / idle: power off status, the CPU is powered down.
- system on / working: power on status, the CPU is in working mode.
Examples:
To check the blue LED’s setting for “system off / idle status”:
1 | kvim2# kbi led systemoff r |
To check the blue LED’s setting for “system on / working status”:
1 | kvim2# kbi led systemon r |
The terminal printout above says that the blue LED is to remain Always off
when you power on the VIM2. You could instead change it to the breathe
mode:
1 | kvim2# kbi led systemon w breathe |
You can also change the setting for “system on / working status”:
1 | kvim2# kbi led systemon w breathe |
VIM4 is white LED
- Boot Mode
VIM2 comes with both SPI flash and eMMC Storage. The KBI can be used to setup one of these as the default boot media.
To set the default boot media as SPI flash:
1 | kvim2# kbi bootmode w spi |
For more information about the SPI flash boot mode, see How to boot from SPI Flash(VIM2/VIM3/Edge).
To set the default boot media as eMMC storage:
1 | kvim2# kbi bootmode w emmc |
You can check the default boot media by running:
1 | kvim2# kbi bootmode r |
- Boot Trigger Events
VIM2 supports different events for triggering boot-up:
- WOL: Wake on Lan
- RTC: RTC timer
- IR: IR remote controller
- DCIN: Plug in the DC adapter
- Key: Power Key/Button
- GPIO: External GPIO events
This means that when your VIM2 is powered-off, any of the above events can trigger it to power-on; when that trigger event has been set to the “enabled” status.
Examples:
Get the status for a WOL trigger event:
1 | kvim2# kbi trigger wol r |
By default, WOL is disabled for the preinstalled ROM, you can enable it by writing a new value:
1 | kvim2# kbi trigger wol w 1 |
Of course, for security reasons, you might want to disable the WOL:
1 | kvim2# kbi trigger wol w 0 |
See Also
WOL
Edge-V MCU Register Map
VIM2 MCU Register Map
VIM3 MCU Register Map