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掉电存储

Other Parts Discussed in Thread: CC2530

     我在测试CC2530的flash读写功能时,发现在debug模式下,flash能够正常的读写。生成hex文件后烧录到板子里,通过串口能观察到写入flash里的数据,但使板子掉电重新上电后,flash里的数据变成了oxFF.请问为什么flash不能够实现掉电存储???

HalFlashErase(0x40);
while( FCTL & 0x80 ); // wait for erase to complete

HalFlashWrite(0x8000, buff1, 1);
HalFlashRead(0x40, 0, buff2, 4);

  • 生成hex文件的时候,你需要在f8wCC2530.xcl文件中,把

    // Include these two lines when generating a .hex file for banked code model:
    -M(CODE)[(_CODEBANK_START+_FIRST_BANK_ADDR)-(_CODEBANK_END+_FIRST_BANK_ADDR)]*\
    _NR_OF_BANKS+_FIRST_BANK_ADDR=0x8000

  • 在f8wCC2530.xcl文件中,这些东西都是默认的(0x8000),无需修改.

          原因我已经找到了,之前我是将数据写在flash里的第64页,第64页是flash中间位置,工程的代码过大时该页就会被使用,导致flash读写无法使用。所以写在100页至125页比较稳妥。