Part Number:CC2642R-Q1
1. NVS 驱动配置如上图
2. NVS 的读取值如上图
3. NVS 的 ExtFlash regionBase 返回值总是 0xFFFFFFF 是正常现象吗?
Lease:
在 project_zero 工程中使用 内部 NVS
,
Kevin Qiu1:
这是正常的,配置 NVS Internal配置的是片上flash, ExtFlash是外部SPI flash,二者没有关系
,
Lease:
是的我使用的是片上flash
,
Lease:
我以经把 NVS_OPEN的索引改成了 内部flash ,返回结果还是这样?
,
Kevin Qiu1:
看起来是代码命名上有一些歧义,你用nvsinternal例程单独测试NVS Internal试试
,
Lease:
我需要在project_zero例程中测试NVS区的实际储存大小。结果如下:
1.我在project_zero 例程中最大,只能申请NVS 申请的大小为 0x6000 字节。
2. 当在nvs中写入超过1024 个字节时程序会死机,死机现象为终端没有任何输出,memory browser。
3.而我在nvsinternal例程 可以写入8192字节数据。
我想知道project_zero例程是否NVS 是否只能储存1k 字节数据,并且与实际申请大小不相符?为什么memory browser后面的NVS区域无法使用,一使用就死机?
proect_zero 情况如下图:
1. NVS 配置
2. NVS 写入
3. 终端打印
4. memory broswer 结果
,
Kevin Qiu1:
我没有看到project_zero对NVS的限制,唯一的不同是project_zero比NVS例程占用的flash更多,许多区域不能使用,可查看cmd和map文件查看具体分配情况
在project_zero中0x56000后的地址被分配给bim,因此NVS分配不能超过0x56000,要分配更多空间应该在0x56000之前未使用的空间分配
Lease 说:为什么memory browser后面的NVS区域无法使用,一使用就死机?
我不能复现这个问题,也可以使用flash programmer2查看内存地址值
,
Lease:
死机是一次性写入2048个字节造成的,这是什么原因?
,
Kevin Qiu1:
写入2048个字节时NVS_write返回值是什么,写入成功了吗
,
Lease:
1.NVS_write 没有返回 根据代码追踪卡在了SemaphoreP_pend
2.也没有写入成功,用memory browser查看
,
Kevin Qiu1:
NVS_write 一定会有返回值,无论是否写入成功
查看下面的定义:
int_fast16_t NVS_write ( NVS_Handlehandle, size_toffset, void *buffer, size_tbufferSize, uint_fast16_tflags)Write data to the NVS region associated with the NVS_Handle.Warning Writing to internal flash on most devices can introduce significant interrupt latencies while the write operation is in in progress. The user may want to surround certain real-time critical code sections with NVS_lock() and NVS_unlock() calls in order to prevent uncoordinated flash write operations from negatively impacting performance. Parameters handle A handle returned from NVS_open() offset The byte offset into the NVS region to start writing. buffer A buffer containing data to write to the NVS region. bufferSize The size of the buffer (number of bytes to write). flags Write flags (NVS_WRITE_ERASE, NVS_WRITE_PRE_VERIFY, NVS_WRITE_POST_VERIFY). Return values NVS_STATUS_SUCCESS Success. NVS_STATUS_ERROR If the internal flash write operation failed, or if NVS_WRITE_POST_VERIFY was requested and the destination flash range does not match the source data. buffer NVS_STATUS_INV_OFFSET If + exceed the size of the region. offsetsize NVS_STATUS_INV_WRITE If NVS_WRITE_PRE_VERIFY is requested and the destination flash address range cannot be change to the values desired. NVS_STATUS_INV_ALIGNMENT If NVS_WRITE_ERASE is requested and is not aligned on a sector boundary offset NVS_STATUS_VERIFYBUFFER If NVS_WRITE_PRE_VERIFY or NVS_WRITE_POST_VERIFY is requested but the verification buffer has not been configured. Remarks This call may lock a region to ensure atomic access to the region.