Khadas VIM 3 SPI Flash

I want to use SPI Flash for boot and save in spi flash U-boot environment. When I try to save the environment in SPI Flash it is always completely erased with U-boot. What I should do?
Commands, which i write:
#setenv ipaddr 192.168.1.249
#saveenv
and the answer of khadas after saveenv command:
#Saving Environment to SPIFlash… Erasing SPI flash…Writing to SPI flash…done
OK

Hi, maybe your answer is here.

1 Like

again to use KBI its easy to access with Krescue :wink:

1 Like

Also when tried to save environment in SPI flash error the error occurs:
Erasing SPI flash…Failed (-22)

I solved the problem. U-Boot config have special variables for configure environment saving. The issue:
CONFIG_ENV_OFFSET must be aligned to an SPI Flash erase sector boundary and CONFIG_ENV_SECT_SIZE define the SPI flash’s sector size. For Khadas VIM 3 i used

CONFIG_ENV_OFFSET = 0x125000, because my U-boot starts from 0x0 and ends at 0x11BD70
CONFIG_ENV_SECT_SIZE = 0x1000, because this size indicated in SPI flash chip datasheet.

2 Likes