在 STM32f779ii 上设置双库模式 [英] Setting dual bank mode on STM32f779ii

查看:23
本文介绍了在 STM32f779ii 上设置双库模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 STM32F779II 设置双组模式,但根本没有设置.

I'm trying to set dual bank mode for STM32F779II, but it doesn't set at all.

所以我在做以下代码之前主要尝试了

So I tried in the main before doing anything the following code

  HAL_FLASH_Unlock();

  HAL_FLASH_OB_Unlock();

  FLASH->OPTCR |= FLASH_OPTCR_nDBANK_Msk;

  HAL_FLASH_OB_Lock();

  HAL_FLASH_Lock();

当我尝试检查内存是单模式还是双模式时:

And When I tried to check if the memory is in Single or Dual Mode:

if((OBInit.USERConfig & OB_NDBANK_SINGLE_BANK) == OB_NDBANK_DUAL_BANK){
     printf("Dual bank mode is set");
    }

但该声明从未设置为真.

but that statement is never set true.

推荐答案

参考手册中描述了该过程.

The process is described in the reference manual.

要修改用户选项值,请按照以下顺序操作:

To modify the user option value, follow the sequence below:

  1. 通过检查 BSY 位来检查没有正在进行的闪存操作FLASH_SR 寄存器
  2. 在 FLASH_OPTCR 寄存器中写入所需的选项值.
  3. 设置 FLASH_OPTCR 寄存器中的选项起始位 (OPTSTRT)
  4. 等待 BSY 位被清除.

您只实施了第 2 步.

You have implemented Step 2 only.

请注意,要设置双组模式,您必须清除该位.

Note that to set dual bank mode, you have to clear that bit.

Bit 29 nDBANK:非双银行模式

Bit 29 nDBANK: Not dual bank mode

1:Flash 用户区被视为具有 256 位读取访问权限的单个存储体.

1: The Flash user area is seen as a single bank with 256 bits read access.

0:Flash 用户区被视为具有 128 位读取访问权限的双存储区(双存储区模式功能有效)

0: The Flash user area is seen as a dual bank with 128 bits read access (dual bank mode feature active)

这篇关于在 STM32f779ii 上设置双库模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆