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.

CC2530 flash读写问题 如何向未被占用的flash空间存数据



您好,

1、我想把很多温度数据存到flash中没被占用的空间里(flash的NV区上面应该是0x0090-0x3F7FF),目前我的hex文件里,存储器占用的地址是0x0000-0xAE90,这是主存占用的空间,我知道主存的0x8000-0xFFFF映射flash的256KB,那么我要如何知道对应的flash哪些地方可以写呢?

用这种方法写:void HalFlashWrite(uint16 addr, uint8 *buf, uint16 cnt)。

2、把一个32位的温度数据写到flash里去,下面这样写可以吗?

{

char TempValue[32];   //一共32bit, 4个byte

HalFlashErase(0x40);  //擦除flash中第64个page

while( FCTL & 0x80 ); // 等待擦除完成

HalFlashWrite(0x8000, TempValue, 1);  //(0x40 * 0x0800) / 4 = 0x8000,每个page 2KB大小,0x8000是第64个page的起始地址

HalFlashRead(0x40, 0x0000, TempValue, 4);  //把写进去的读出来

}