This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
products:sbc:common:development:kbi [2022/07/07 23:37] hyphop [Khadas Bootloader Instructions - KBI] |
products:sbc:common:development:kbi [2024/12/27 04:30] (current) hyphop [Read for reference] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== KBI - Khadas Bootloader Instructions ====== | ====== KBI - Khadas Bootloader Instructions ====== | ||
- | ===== Introduction ===== | + | This page introduces |
- | + | ||
- | This document mainly | + | |
<WRAP important > | <WRAP important > | ||
- | KBI is an abbreviation for Khadas Bootloader Instructions, which is developed | + | Khadas Bootloader Instructions(KBI) can be used to: |
* Manage the programmable MCU | * Manage the programmable MCU | ||
* Carry out low level hardware management | * Carry out low level hardware management | ||
- | * Let developers utilise all the features of Khadas | + | * Let developers utilise all the features of Khadas |
</ | </ | ||
<WRAP info > | <WRAP info > | ||
- | This document uses VIM2 as an example, other SBCs are similar. | + | This page takes VIM2 as an example. |
</ | </ | ||
- | ==== Get help ==== | + | ===== Uboot usage ===== |
- | Before continuing, make sure you have booted into U-Boot: | + | To get started, make sure you have booted into U-Boot: |
- | ```sh | + | ```shell |
normal power off | normal power off | ||
boot wol: enable | boot wol: enable | ||
Hit Enter or space or Ctrl+C key to stop autoboot -- : 0 | Hit Enter or space or Ctrl+C key to stop autoboot -- : 0 | ||
- | kvim2# | + | kvim2# |
``` | ``` | ||
+ | |||
+ | ==== Help information ===== | ||
You can get help information by typing '' | You can get help information by typing '' | ||
- | ```sh | + | ```shell |
kvim2# kbi | kvim2# kbi | ||
kbi - Khadas Bootloader Instructions sub-system | kbi - Khadas Bootloader Instructions sub-system | ||
Line 53: | Line 53: | ||
``` | ``` | ||
- | ==== KBI Command ==== | + | ==== MCU Verison |
- | + | ||
- | === MCU Verison === | + | |
Get the MCU firmware version: | Get the MCU firmware version: | ||
- | ```sh | + | ```shell |
kvim2# kbi version | kvim2# kbi version | ||
version: 03 | version: 03 | ||
``` | ``` | ||
- | === Initialize === | + | ==== Initialize |
Initialize the KBI: | Initialize the KBI: | ||
- | ```sh | + | ```shell |
kvim2# kbi init | kvim2# kbi init | ||
``` | ``` | ||
- | === Serial number === | + | ==== Serial number |
Get the device serial number: | Get the device serial number: | ||
- | ```sh | + | ```shell |
kvim2# kbi usid | kvim2# kbi usid | ||
usid: 000000 | usid: 000000 | ||
``` | ``` | ||
- | === ADC === | + | ==== ADC ==== |
Get ADC value: | Get ADC value: | ||
- | ```sh | + | ```shell |
kvim2# kbi adc | kvim2# kbi adc | ||
adc: 0x236 | adc: 0x236 | ||
``` | ``` | ||
- | The ADC value can be used to distinguish | + | The ADC value can distinguish |
- | === Power Off === | + | ==== Power Off ==== |
- | Power off device: | + | Power off the device: |
- | ```sh | + | ```shell |
kvim2# kbi poweroff | kvim2# kbi poweroff | ||
``` | ``` | ||
- | === MAC Address === | + | ==== MAC Address |
Get the Ethernet MAC address: | Get the Ethernet MAC address: | ||
- | ```sh | + | ```shell |
kvim2# kbi ethmac | kvim2# kbi ethmac | ||
mac address: 98: | mac address: 98: | ||
``` | ``` | ||
- | === LED Control === | + | ==== LED Control |
Setup the blue LED: | Setup the blue LED: | ||
- | The blue LED has different | + | The blue LED has 4 working 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 MCU,in charge of system power management, controls the blue LED. The CPU controls the white LED. |
+ | In this case, the blue LED still work even VIM2 was powered off. | ||
- | The KBI can be used to program the blue LED for two different status-modes: | + | The KBI can be used to program the blue LED for two working |
- | * system off / idle: power off status, the CPU is powered | + | * system off / idle: power off status, the CPU is in power-down mode. |
* system on / working: power on status, the CPU is in working mode. | * system on / working: power on status, the CPU is in working mode. | ||
- | Examples: | + | For example: |
To check the blue LED’s setting for '' | To check the blue LED’s setting for '' | ||
- | ```sh | + | ```shell |
kvim2# kbi led systemoff r | kvim2# kbi led systemoff r | ||
led mode: breathe | led mode: breathe | ||
Line 130: | Line 129: | ||
To check the blue LED’s setting for '' | To check the blue LED’s setting for '' | ||
- | ```sh | + | ```shell |
kvim2# kbi led systemon r | kvim2# kbi led systemon r | ||
led mode: off [systemon] | led mode: off [systemon] | ||
``` | ``` | ||
+ | When VIM2 is powered on,the blue LED is '' | ||
- | The terminal printout above says that the blue LED is to remain '' | + | You can also reset it to '' |
- | + | ```shell | |
- | ```sh | + | |
kvim2# kbi led systemon w breathe | kvim2# kbi led systemon w breathe | ||
``` | ``` | ||
Line 143: | Line 142: | ||
You can also change the setting for '' | You can also change the setting for '' | ||
- | ```sh | + | ```shell |
kvim2# kbi led systemon w Heartbeat | kvim2# kbi led systemon w Heartbeat | ||
``` | ``` | ||
- | === Boot Mode === | + | ==== 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. | + | You can flash the images |
- | To set the default boot media as SPI flash: | + | Set the default boot media as the SPI: |
- | ```sh | + | ```shell |
kvim2# kbi bootmode w spi | kvim2# kbi bootmode w spi | ||
``` | ``` | ||
- | To set the default boot media as eMMC storage: | + | Set default boot media as eMMC storage: |
- | ```sh | + | ```shell |
kvim2# kbi bootmode w emmc | kvim2# kbi bootmode w emmc | ||
``` | ``` | ||
- | You can check the default boot media by running: | + | You can take a review on the default boot media by running: |
- | ```sh | + | ```shell |
kvim2# kbi bootmode r | kvim2# kbi bootmode r | ||
bootmode: emmc | bootmode: emmc | ||
``` | ``` | ||
- | === Boot Trigger Events === | + | ==== Boot Trigger Events |
VIM2 supports different events for triggering boot-up: | VIM2 supports different events for triggering boot-up: | ||
Line 179: | Line 178: | ||
* Key: Power Key/Button | * Key: Power Key/Button | ||
* GPIO: External GPIO events | * GPIO: External GPIO events | ||
- | This means that when your VIM2 is powered-off, | + | It means any of the above events can trigger |
- | Examples: | + | For example: |
- | * Get the status | + | * Get the status |
kvim2# kbi trigger wol r | kvim2# kbi trigger wol r | ||
boot wol: disable | boot wol: disable | ||
``` | ``` | ||
- | * By default, | + | * WOL is disabled for the pre-installed |
kvim2# kbi trigger wol w 1 | kvim2# kbi trigger wol w 1 | ||
set_wol: 1 | set_wol: 1 | ||
``` | ``` | ||
- | * Of course, for security reasons, you might want to disable the WOL: \\ ```sh | + | * In general, you will disable the WOL for security reasons. |
kvim2# kbi trigger wol w 0 | kvim2# kbi trigger wol w 0 | ||
set_wol: 0 | set_wol: 0 | ||
``` | ``` | ||
- | ===== See Also ===== | + | ====== Read for reference ====== |
- | * [[https://dl.khadas.com/Hardware/Edge/MCU/Edge-V_MCU_REG_EN.pdf|Edge-V MCU Register Map]] | + | * [[dl> |
- | * [[https://dl.khadas.com/Hardware/VIM2/MCU/VIM2_MCU_REG_EN.pdf|VIM2 MCU Register Map]] | + | * [[dl> |
- | * [[https://dl.khadas.com/Hardware/VIM3/MCU/VIM3_MCU_REG_EN.pdf|VIM3 MCU Register Map]] | + | * [[dl> |