-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SFUD会添加Block Protect功能支持吗? #44
Comments
暂不支持的,这块处理不同芯片差异很大的 |
发现驱动SST26VF016B 这玩意默认开启Block Protect,调用写成功,但数据始终不对,一直查硬件问题,后来仔细看手册才发现这个问题。。。 |
是的,所以这类芯片 SFUD 里都有特殊处理 Lines 351 to 362 in 4b41297
|
根据手册直接增加解锁函数,加入初始化最后面。 static sfud_err set_ULBPR(const sfud_flash *flash){
uint8_t cmd;
sfud_err result = SFUD_SUCCESS;
const sfud_spi *spi = &flash->spi;
SFUD_ASSERT(flash);
if (spi->lock) {
spi->lock(spi);
}
result = set_write_enabled(flash, true);
if (result != SFUD_SUCCESS) {
goto __exit;
}
cmd = 0x98;
result = flash->spi.wr(&flash->spi, &cmd, 1, NULL, 0);
__exit:
/* set the flash write disable */
set_write_enabled(flash, false);
/* unlock SPI */
if (spi->unlock) {
spi->unlock(spi);
}
return result;
} 放在sfud_device_init最后面 sfud_err sfud_device_init(sfud_flash *flash) {
sfud_err result = SFUD_SUCCESS;
/* hardware initialize */
result = hardware_init(flash);
if (result == SFUD_SUCCESS) {
result = software_init(flash);
}
if (result == SFUD_SUCCESS) {
flash->init_ok = true;
SFUD_INFO("%s flash device is initialize success.", flash->name);
} else {
flash->init_ok = false;
SFUD_INFO("Error: %s flash device is initialize fail.", flash->name);
}
result = set_ULBPR(flash); // 全局解锁block保护
return result;
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SFUD是否有计划支持Flash的Block Protect功能?
The text was updated successfully, but these errors were encountered: