This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640R2F 使用NVS 读写FLASH

Other Parts Discussed in Thread: CC2640R2F

我在OFF-CHIP-OAD例程的基础上编写了我们的程序,由于项目需求,我们需要使用脱机烧录器往CC2640R2F的 FLASH 上烧写滚码,我在网上了解到,Ti有一个"NVS",可以在具体的flash 地址上读写数据.但是我又了解到了:"NVS例程是TI RTOS的驅動程序範例,一般是給沒有使用BLE Stack的場景使用,如果是使用TI BLE Stack,建議使用BLE Stack包裝的SNV API去做NV的讀寫,如果要使用NVS,你必須自行修改NVS访问的地址,不然確實会影响蓝牙协议栈的运行",

所以我的问题是,我在使用TI BLE Stack 的情况下,怎么确定哪块flash 地址可以使用NVS读写?

(SNV的地址是0x1D000 --- 0x1E000,我可以使用SNV的地址烧写滚码吗)

(我使用的NVS例程,基地址是0x1B000,使用CCS 的 Memory browser,查看flash地址,从0x1A000 --- 0x1E000 已经被使用了)

  • 你的理解是对的,一般SNV和协议栈一起使用

    NVS地址可以自己选(未使用的部分),可以用flash programmer2读取flash page查看没有使用的部分
  • NVS的地址可以随意选取吗(为使用的部分)?只要不占用SNV的位置,还是占用也无妨
  • 关于SNV的使用参考这里dev.ti.com/.../node
    NVS driver地址的选取是任意的,SNV未使用时可以占用其位置
    与协议栈一起使用的一些限制:
    The following limitations apply to those using NV alongside the BLE5-Stack.

    NV implementations (i.e. NVOCMP) should not be used directly; the application should access NV through OSAL SNV. See Using SNV Example Code
    The application must be careful to only use IDs in the range defined by Listing 30.
    The application cannot access the NV regions reserved by the stack directly or the internal structure may be corrupted.
    When using NVOCMP, the memory allocated for internal NVS access must be pages of contiguous memory.
    Since OSAL SNV exists on the stack side of ICall, an application that uses OSAL SNV must be ICall enabled.
    OSAL SNV operations must be called from a task context and not a Hwi or SWI context.
    Some care must be taken to not be close to 80% (or other compaction threshold) utilization of a sector. BLE stack uses at most 1.5-2kB with 10 bonds stored. Frequent compactions are costly in terms of power consumption and can cause resets and lost SNV content (NVOCMP) and will also wear out the flash.