烧录相关常见问题
SPI NOR 烧录出现 GUID Partition Table Header signature is wrong
日志:
[1130]fes begin commit:25ecf28f19-dirty
[1134]set pll start
[1136]set pll end
[1138]board init ok: use hosc 40M
[1141]beign to init dram
[1146]DRAM use internal ZQ!!
[1148]ZQ value = 0x2f
[1151][AUTO DEBUG] single rank and full DQ!
[1156][AUTO DEBUG] rank 0 row = 13
[1159][AUTO DEBUG] rank 0 bank = 4
[1162][AUTO DEBUG] rank 0 page size = 2 KB
[1166]DRAM BOOT DRIVE INFO: V1.00
[1169]DRAM CLK = 520 MHz
[1171]DRAM Type = 2 (2:DDR2,3:DDR3)
[1175]DRAMC read ODT off.
[1177]DRAM ODT off.
[1179]trefi: 7.8us
[1181]DRAM Size = 64 MB
[1194]DRAM simple test OK.
[1196]init dram ok
U-Boot 2018.07-g0021c54eea (Feb 14 2025 - 06:12:39 +0000) Allwinner Technology
[02.924]DRAM: 64 MiB
[02.962]Relocation Offset is: 01f29000, reloc addr is: 83f29000
[03.191]secure enable bit: 0
[03.204]CPU=614 MHz,PERI=3072 Mhz,AHB=192 Mhz, APB=96Mhz
[03.212]sunxi flash map init
SPI ALL: ready
[03.364]init_clocks:finish
[03.366]flash init start
[03.369]workmode = 16,storage type = 0
sunxi_get_spif_mode()227 - get dtr_mode_enable fail -13
sunxi_get_spif_mode()236 - get io_mode_enable fail -13
[03.827]spif sunxi_slave->max_hz:100000000
[04.350]spif update delay param error
[04.354]Sample mode:0 start:0 end:0 right_sample_delay:0xaaaaffff
SF: Detected XM25QH128C( ) with page size 256 Bytes, erase size 64 KiB, total 16 MiB
[04.565]Loading Environment from SUNXI_FLASH... OK
[04.591]try to burn key
[04.598]out of usb burn from boot: not boot mode
Hit any key to stop autoboot: 0
sunxi work mode=0x10
run usb efex
delay time 2500
usb init ok
set address 0x14
set address 0x14 ok
SUNXI_EFEX_ERASE_TAG
erase_flag = 0x0
origin_erase_flag = 0x1
FEX_CMD_fes_verify_status
FEX_CMD_fes_verify last err=0
the 0 mbr table is ok
*************MBR DUMP***************
total mbr part 6
part[0] name :env
part[0] classname :DISK
part[0] addrlo :0x20
part[0] lenlo :0x80
part[0] user_type :32768
part[0] keydata :0
part[0] ro :0
part[1] name :boot
part[1] classname :DISK
part[1] addrlo :0xa0
part[1] lenlo :0x1280
part[1] user_type :32768
part[1] keydata :0
part[1] ro :0
part[2] name :riscv0
part[2] classname :DISK
part[2] addrlo :0x1320
part[2] lenlo :0x480
part[2] user_type :32768
part[2] keydata :0
part[2] ro :0
part[3] name :rootfs
part[3] classname :DISK
part[3] addrlo :0x17a0
part[3] lenlo :0x1900
part[3] user_type :32768
part[3] keydata :0
part[3] ro :0
part[4] name :rootfs_data
part[4] classname :DISK
part[4] addrlo :0x30a0
part[4] lenlo :0x280
part[4] user_type :32768
part[4] keydata :0
part[4] ro :0
part[5] name :UDISK
part[5] classname :DISK
part[5] addrlo :0x3320
part[5] lenlo :0x0
part[5] user_type :0
part[5] keydata :0
part[5] ro :0
common1(partition3) need it, here is a weak func
total part: 7
mbr 0, 20, 8000
env 1, 80, 8000
boot 2, 1280, 8000
riscv0 3, 480, 8000
rootfs 4, 1900, 8000
rootfs_data 5, 280, 8000
UDISK 6, 0, 0
need erase flash: 0
[07.864]get secure storage map err
secure storage init err
no part need to protect user data
SUNXI_EFEX_MBR_TAG
mbr size = 0x4000
SF: write offset not multiple of erase size
write primary GPT success
spinor: skip backup GPT
[08.022]update partition map
GUID Partition Table Header signature is wrong: 0xCCEDDDCCCDDEECDC != 0x5452415020494645
part_get_info_efi: *** ERROR: Invalid GPT ***
ERROR: attempting read past flash size
*** ERROR: Can't read GPT header ***
part_get_info_efi: *** ERROR: Invalid Backup GPT ***
FEX_CMD_fes_verify_status
FEX_CMD_fes_verify last err=0
FEX_CMD_fes_verify_value, start 0x20, size high 0x0:low 0x10000
FEX_CMD_fes_verify_value 0x66662a00
问题原因:
根据以下两条打印可以看出是 SPIF 采样点获取失败
[04.350]spif update delay param error
[04.354]Sample mode:0 start:0 end:0 right_sample_delay:0xaaaaffff
一般 SPIF 采样失败可能的问题有:
- 主控或 SPI NOR 芯片虚焊
- SPI NOR 省引脚需要用单线或者双线模式,目前SDK默认四线
- SPI NOR 物料损坏
- 走线导致信号质量差
解决方法:
- 检查芯片焊接情况,包括主控和 SPI NOR 存储器,测量供电与纹波是否正常且符合要求。
- 尝试 依次 配置 [①关闭 DTR 模式]、[②降频]、[③配置双线 或 单线模式]。方法如下:
编译平台对应的 uboot-board.dts
,默认配置如下:
&spif {
clock-frequency = <100000000>;
pinctrl-0 = <&spif_pins_a &spif_pins_b>;
pinctrl-1 = <&spif_pins_c>;
pinctrl-names = "default", "sleep";
/*spi-supply = <®_dcdc1>;*/
status = "disabled";
spif-nor {
device_type = "spi_board0";
compatible = "spi-nor";
spif-max-frequency = <100000000>;
m25p,fast-read = <1>;
/*individual_lock;*/
reg = <0x0>;
spif-rx-bus-width=<0x04>;
spif-tx-bus-width=<0x04>;
dtr_mode_enabled=<1>; /* choose double edge trigger mode */
io_mode_enabled=<1>; /* 1_x_x && x_x_x mode */
status="disabled";
};
};
关闭 DTR 模式,注释配置即可
/* dtr_mode_enabled=<1>; */
/* io_mode_enabled=<1>; */
如下
&spif {
clock-frequency = <100000000>;
pinctrl-0 = <&spif_pins_a &spif_pins_b>;
pinctrl-1 = <&spif_pins_c>;
pinctrl-names = "default", "sleep";
/*spi-supply = <®_dcdc1>;*/
status = "disabled";
spif-nor {
device_type = "spi_board0";
compatible = "spi-nor";
spif-max-frequency = <100000000>;
m25p,fast-read = <1>;
/*individual_lock;*/
reg = <0x0>;
spif-rx-bus-width=<0x04>;
spif-tx-bus-width=<0x04>;
/* dtr_mode_enabled=<1>; */
/* io_mode_enabled=<1>; */
status="disabled";
};
};
降低 SPI 通讯频率,将 clock-frequency
减半
&spif {
clock-frequency = <50000000>;
pinctrl-0 = <&spif_pins_a &spif_pins_b>;
pinctrl-1 = <&spif_pins_c>;
pinctrl-names = "default", "sleep";
/*spi-supply = <®_dcdc1>;*/
status = "disabled";
spif-nor {
device_type = "spi_board0";
compatible = "spi-nor";
spif-max-frequency = <50000000>;
m25p,fast-read = <1>;
/*individual_lock;*/
reg = <0x0>;
spif-rx-bus-width=<0x04>;
spif-tx-bus-width=<0x04>;
dtr_mode_enabled=<1>;
io_mode_enabled=<1>;
status="disabled";
};
};
将 4 线模式改为 2 线或 1 线模式,修改 spif-rx-bus-width
和 spif-tx-bus-width
,这里修改 1 线模式:
&spif {
clock-frequency = <100000000>;
pinctrl-0 = <&spif_pins_a &spif_pins_b>;
pinctrl-1 = <&spif_pins_c>;
pinctrl-names = "default", "sleep";
/*spi-supply = <®_dcdc1>;*/
status = "disabled";
spif-nor {
device_type = "spi_board0";
compatible = "spi-nor";
spif-max-frequency = <100000000>;
m25p,fast-read = <1>;
/*individual_lock;*/
reg = <0x0>;
spif-rx-bus-width=<0x01>;
spif-tx-bus-width=<0x01>;
dtr_mode_enabled=<1>;
io_mode_enabled=<1>;
status="disabled";
};
};
内核设备树 board.dts
配置如下,默认配置为:
&spif0 {
clock-frequency = <100000000>;
pinctrl-0 = <&spif_pins_default &spif_pins_cs>;
pinctrl-1 = <&spif_pins_sleep>;
pinctrl-names = "default", "sleep";
spif-rx-bus-width = <0x4>;
spif-tx-bus-width = <0x4>;
//prefetch_read_mode_enabled; /* choose prefect read mode */
//dqs_mode_enabled; /* choose dqs mode(nand provide clk mode) */
dtr_mode_enabled; /* choose double edge trigger mode */
io_mode_enabled; /* 1_x_x && x_x_x mode */
status = "okay";
spif-nor {
device_type = "spi_board0";
compatible = "spif-nor";
spi-max-frequency = <0x5f5e100>;
reg = <0x0>;
status = "disabled";
};
};
关闭 DTR 模式,注释 dtr_mode_enabled
和 io_mode_enabled
&spif0 {
clock-frequency = <100000000>;
pinctrl-0 = <&spif_pins_default &spif_pins_cs>;
pinctrl-1 = <&spif_pins_sleep>;
pinctrl-names = "default", "sleep";
spif-rx-bus-width = <0x4>;
spif-tx-bus-width = <0x4>;
//prefetch_read_mode_enabled; /* choose prefect read mode */
//dqs_mode_enabled; /* choose dqs mode(nand provide clk mode) */
//dtr_mode_enabled; /* choose double edge trigger mode */
//io_mode_enabled; /* 1_x_x && x_x_x mode */
status = "okay";
spif-nor {
device_type = "spi_board0";
compatible = "spif-nor";
spi-max-frequency = <0x5f5e100>;
reg = <0x0>;
status = "disabled";
};
};
降低 SPI 通讯频率,将 clock-frequency
减半
&spif0 {
clock-frequency = <50000000>;
pinctrl-0 = <&spif_pins_default &spif_pins_cs>;
pinctrl-1 = <&spif_pins_sleep>;
pinctrl-names = "default", "sleep";
spif-rx-bus-width = <0x4>;
spif-tx-bus-width = <0x4>;
//prefetch_read_mode_enabled; /* choose prefect read mode */
//dqs_mode_enabled; /* choose dqs mode(nand provide clk mode) */
dtr_mode_enabled; /* choose double edge trigger mode */
io_mode_enabled; /* 1_x_x && x_x_x mode */
status = "okay";
spif-nor {
device_type = "spi_board0";
compatible = "spif-nor";
spi-max-frequency = <50000000>;
reg = <0x0>;
status = "disabled";
};
};
将 4 线模式改为 2 线或 1 线模式,修改 spif-rx-bus-width
和 spif-tx-bus-width
,这里修改 1 线模式:
&spif0 {
clock-frequency = <100000000>;
pinctrl-0 = <&spif_pins_default &spif_pins_cs>;
pinctrl-1 = <&spif_pins_sleep>;
pinctrl-names = "default", "sleep";
spif-rx-bus-width = <0x1>;
spif-tx-bus-width = <0x1>;
//prefetch_read_mode_enabled; /* choose prefect read mode */
//dqs_mode_enabled; /* choose dqs mode(nand provide clk mode) */
dtr_mode_enabled; /* choose double edge trigger mode */
io_mode_enabled; /* 1_x_x && x_x_x mode */
status = "okay";
spif-nor {
device_type = "spi_board0";
compatible = "spif-nor";
spi-max-frequency = <100000000>;
reg = <0x0>;
status = "disabled";
};
};
如果还是无法烧录,可以组合上面的方法,配置 [关闭 DTR 模式] + [降频 10M] + [单线模式] 的最小模式测试。如果还是无法烧录请检查硬件。