[SOLVED]: Edge-V: Domain: u-boot - Discovered some u-boot/kbi quirks

Here a list of things I don’t understand:

BTW my kbi version is 00 01 and I switched bootmode to spi with kbi bootmode w spi and checked with kbi bootmode r, further I compiled u-boot two days ago, means a recent clone of your repository stuff.

  • Why there is no saveenv command in u-boot anymore to save the custom environment after adding own environment keys., that can survive a reboot.
    Why I am asking for is the need to modify the key boot_targets and save the changes persistently. Or want expand bootargs with cpu, cpuid, serial and board_type_name so that the boot kernel parameters gets into the operating system for further determination and discrimination.

  • kbi adc reports 0x0
    Is this correct?

  • kbi usid reports 000000
    Shouldn’t be the serial id?

  • kbi poweroff is not shutting down the system, it reboots again. Why?

  • kbi ethmac reports 00:00:00:00:00:00
    Is this correct?

Do I miss some i2C pointer or mcu info, should I try the mainline u-boot for that?

  • For what is kbi forcereset used for?

  • I flashed the u-boot-spi.bin image after reboot I am using version to validate the change and I got

U-Boot 2017.09 (Nov 15 2018 - 09:52:31 +0800)

aarch64-linux-gnu-gcc (Linaro GCC 6.3-2017.02) 6.3.1 20170109
GNU ld (Linaro_Binutils-2017.02) 2.27.0.20161019

is this correct? Why I don’t see actual build id’s?

Again my highest wish is to get back saveenv in the help list, how can I do that? :smiley:

@giminni

You can read the kbi version .It mean that I2C is fine.

This pin is used for other functions, so it is not used for ADC

We don’t set the serical id ,so zero is true.

The ethmac is written on the EMMC and may be erased. There is a two-dimensional code on the back of the board that can scan out the corresponding values.We have a burning tool, which we will give you later.

@Frank Thx for the reply, whats about activating saveenv and the other question I mentioned im my list?

@frank here my u-boot output

DDR Version 1.19 20190305
In
soft reset
SRX
channel 0
CS = 0
MR0=0x19
MR4=0x3
MR5=0x6
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0xFF
CS = 1
MR0=0x19
MR4=0x3
MR5=0x6
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0xFF
channel 1
CS = 0
MR0=0x19
MR4=0x3
MR5=0x6
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0xFF
CS = 1
MR0=0x19
MR4=0x3
MR5=0x6
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0xFF
channel 0 training pass!
channel 1 training pass!
change freq to 400MHz 0,1
channel 0
CS = 0
MR0=0x19
MR4=0x3
MR5=0x6
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0xFF
CS = 1
MR0=0x19
MR4=0x3
MR5=0x6
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0xFF
channel 1
CS = 0
MR0=0x19
MR4=0x3
MR5=0x6
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0xFF
CS = 1
MR0=0x19
MR4=0x3
MR5=0x6
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0xFF
channel 0 training pass!
channel 1 training pass!
change freq to 800MHz 1,0
Channel 0: LPDDR4,800MHz
Bus Width=32 Col=10 Bank=8 Row=15/15 CS=2 Die Bus-Width=16 Size=2048MB
Channel 1: LPDDR4,800MHz
Bus Width=32 Col=10 Bank=8 Row=15/15 CS=2 Die Bus-Width=16 Size=2048MB
256B stride
ch 0 ddrconfig = 0x101, ddrsize = 0x2020
ch 1 ddrconfig = 0x101, ddrsize = 0x2020
pmugrf_os_reg[2] = 0x3AA1FAA1, stride = 0xD
OUT
Boot1: 2018-06-26, version: 1.14
CPUId = 0x0
ChipType = 0x10, 279
Spi_ChipId = ef6018
SpiBootInit:0
mmc0:cmd5,32
SdmmcInit=0 0
BootCapSize=0
UserCapSize=15193MB
FwPartOffset=2000 , 0
StorageInit ok = 31967
SecureMode = 0
SecureInit ret = 0, SecureMode = 0
GPT  signature is wrong
LoadTrust Addr:0x800
LoadTrust Addr:0xc00
LoadTrust Addr:0x1000
LoadTrust Addr:0x1400
LoadTrust Addr:0x1800
LoadTrust Addr:0x1c00
LoadTrust Addr:0x2000
No find bl30.bin
Load uboot, ReadLba = 2800
Load OK, addr=0x200000, size=0xe7f1c
RunBL31 0x10000
NOTICE:  BL31: v1.3(debug):4f4079b
NOTICE:  BL31: Built : 17:40:23, Oct 11 2018
NOTICE:  BL31: Rockchip release version: v1.1
INFO:    GICv3 with legacy support detected. ARM GICV3 driver initialized in EL3
INFO:    Using opteed sec cpu_context!
INFO:    boot cpu mask: 0
INFO:    plat_rockchip_pmu_init(1151): pd status 3e
INFO:    BL31: Initializing runtime services
INFO:    BL31: Initializing BL32
INF [0x0] TEE-CORE:init_primary_helper:337: Initializing (1.1.0-187-g3f0aafa6 #11 Wed Oct 31 06:55:31 UTC 2018 aarch64)

INF [0x0] TEE-CORE:init_primary_helper:338: Release version: 1.2

INF [0x0] TEE-CORE:init_teecore:83: teecore inits done
INFO:    BL31: Preparing for EL3 exit to normal world
INFO:    Entry point address = 0x200000
INFO:    SPSR = 0x3c9


U-Boot 2017.09 (Nov 15 2018 - 09:52:31 +0800)

Model: Khadas Edge
DRAM:  3.8 GiB
Relocation Offset is: f5be8000
PMIC:  RK808
vdd_center 900000 uV
vdd_cpu_l 900000 uV
pwm-regulator(vdd-log): init 950000 uV
vdd_log 950000 uV
regulator(vdd-log) init 950000 uV
MMC:   dwmmc@fe320000: 1, sdhci@fe330000: 0
Using default environment

Can't get mcu-pix-total
Warn: can't find phy driver
Can't get mcu-pix-total
Warn: can't find phy driver
In:    serial
Out:   serial
Err:   serial
Model: Khadas Edge
switch to partitions #0, OK
mmc1 is current device
do_rkimg_test found IDB in SDcard
Boot from SDcard
get part misc fail -1
init_resource_list: failed to get resource part, ret=-1
Can't find file:logo.bmp
failed to display uboot logo
init_resource_list: failed to get resource part, ret=-1
Can't find file:logo.bmp
failed to display uboot logo
Net:   eth0: ethernet@fe300000
Hit any key to stop autoboot:  0

… and here my i2c probe output

kedge# i2c probe
No I2C bus selected

@giminni I remember that you i2c driver worked fine last time.So I think there should be no problem on the hardware.Which version with firmware you used ? Did you used SD crad ? I think you firmware was damaged .

@Frank right, I saw the i2c output, now something happens and i don’t know why.

Here my steps

  • Compiled kernel and u-boot with fenix 0.7
  • Flashed u-boot-spi.bin into DDR
  • Copied the latest Ubuntu server Edge-V image into an sdHC Card
  • Entirely erased eMMC card with zeros
  • Created a fresh partition on eMMC starting at sector 32768 (+16MiB)
  • Changed kbi bootmode from emmc to spi
  • Booting from sdHC card

One error at the moment is I can’t enter the upgrade mode, board is always booting up even if no sdHC card is inserted and I am using an USB-C data cable.

What are the steps to recover properly to a functioning u-boot?

Flash to DDR? Is it a typo? Do you mean SPI Flash ?

Can you try TST mode to enter the upgrade mode?

Here what I have tried:

  1. Removed sdHC card
  2. Power-on Edge with an USB-C data cable inserted into a PC.
  3. Quickly press the Function key 3 times in 2 seconds, then release the key.
  4. You will see the Power-LED (Blue) blink for about 3 seconds. After the Power-LED (Blue) turns OFF, this indicates that the board is in Upgrade Mode (Maskrom Mode).

Result: Red led goes on, then off, Power-LED (Blue) blinked two times in one second, red goes on then went off, then steady blue

@giminni When it steady blue.Can you try to press the power key ?

@Frank If I press the power key the system starts

@frank solved my upgrade mode :smiley:

I can reliable enter the upgrade mode from the serial console entering run update

I tried the WNpctool without success, because I dont know where to get the loader file.

My goal is to try to write the MAC address into the protected area, so I am able to execute

kbi ethmacgetting the mac address at the moment it returns 000000000000

Event the kbi usidreturns zero, can I even inject my serialnumber and being able to get kbi usidwithout zeros?

… and being able to wol successfully!

1 Like

@giminni About how to write MAC address,Another colleague responded to you in this post

Can you try with this page ?

@Frank

I am in upgrade mode, but cannot get the LANMAC from the board.

What I have done so far:

  • Downloaded and installed WNpctool
  • Entered the upgrade mode on Edge-V from the serial console executing run update
  • Under WNpctool -> Settings -> Mode
    • On tab SN unchecked select & pressed apply
    • On tab WIFI MAC unchecked select & pressed apply
    • On tab LAN MAC checked select and
    • in Config selected Input/Scan option & pressed apply
    • On tab BT MAC unchecked select & pressed apply
    • On tab IMEI unchecked select & pressed apply
    • Pressed OK leaving the Mode panel

LANMAC entry field is empty, I think there should be displayed my own MAC address

  • Pressed Loader import choosing MiniLoaderAll.bin from my own fenix u-boot compilation
  • Added own MAC address inside the LAN MAC entry field
  • Pressed Write

Result is


I redacted my own MAC address on the LAN MAC and log output field

Here the log output of WNpctool:

14:14:45 959 ERROR:RK_WriteProvisioningData->RKU_WriteLBA failed,err=-8

Your version is different from mine. So use this tool.
RKDevInfoWriteTool


image

1 Like

@goenjoy

Thanks this tool could write back the MAC address. :smiley:

Now If I execute kbi ethmac I get my MAC address again.

Is this also feasible for usid, and is usid the serial number of the board?

BTW I’ll check if the WoL will work with the above change.

static void get_usid(void)
{
	char serial[64];
	char usid[USID_LENGHT] = {};
	int i, mode;
#ifdef CONFIG_USID_FROM_ETH_MAC
	mode = kbi_i2c_read(REG_MAC_SWITCH);

	if (mode == 1) {
		kbi_i2c_read_block(REG_MAC, MAC_LENGHT, usid);
	} else {
		run_command("efuse mac", 0);
		char *s = getenv("eth_mac");
		if ((s != NULL) && (strcmp(s, "00:00:00:00:00:00") != 0)) {
			for (i = 0; i < 6 && s[0] != '\0' && s[1] != '\0'; i++) {
			usid[i] = chartonum(s[0]) << 4 | chartonum(s[1]);
			s +=3;
			}
		} else {
			kbi_i2c_read_block(REG_MAC, MAC_LENGHT, usid);
		}
	}
#else
	kbi_i2c_read_block(REG_USID, USID_LENGHT, usid);
#endif
	printf("usid: ");
	for (i=0; i< USID_LENGHT; i++) {
		printf("%x",usid[i]);
	}
	printf("\n");
	sprintf(serial, "%02x%02x%02x%02x%02x%02x",usid[0],usid[1],usid[2],usid[3],usid[4],usid[5]);
	setenv("usid", serial);
}

At present, USID is not used, which is also reserved for the use of customers. Of course, you can also use it as a board serial number.

@goenjoy
Ok I thought it must be set.

Anyway kbi ethmac is now correct. Problem is solved.

Thanks for support

2 Likes