Performing Flash Erase From Flash Memory
Note that while executing program code from within flash memory, when a flash erase or write operation is
initiated the CPU stalls, and program execution resumes from the next instruction when the flash controller
has completed the operation.
The following code example of how to erase one flash page in the CC2530 is given for use with the IAR
compiler:
#include <ioCC2530.h>
unsigned char erase_page_num = 3; /* page number to erase, here: flash page #3 */
/* Erase one flash page */
EA = 0; /* disable interrupts */
while (FCTL & 0x80); /* poll FCTL.BUSY and wait until flash controller is ready */
FADDRH = erase_page_num << 1; /* select the flash page via FADDRH[7:1] bits */
FCTL |= 0x01; /* set FCTL.ERASE bit to start page erase */
while (FCTL & 0x80); /* optional: wait until flash write has completed (~20 ms) */
EA = 1; /* enable interrupts */
6.3.2 Different Flash Page Size on CC2533
The flash page size has been reduced from 2 KB (2048 bytes) on CC2530, CC2531, CC2540, and
CC2541 to 1 KB (1024 bytes) on CC2533. When performing page-erase operations on the flash memory,
the page to be erased is addressed with the register bits FADDRH[6:0] on CC2533 as opposed to
FADDRH[7:1] on CC2530, CC2531, CC2540, and CC2541. The page-lock bits are still placed in the
upper 16 bytes of the last accessible flash page.这个是在其他帖子看到的,可以吗
Performing Flash Erase From Flash Memory
Note that while executing program code from within flash memory, when a flash erase or write operation is
initiated the CPU stalls, and program execution resumes from the next instruction when the flash controller
has completed the operation.
The following code example of how to erase one flash page in the CC2530 is given for use with the IAR
compiler:
#include <ioCC2530.h>
unsigned char erase_page_num = 3; /* page number to erase, here: flash page #3 */
/* Erase one flash page */
EA = 0; /* disable interrupts */
while (FCTL & 0x80); /* poll FCTL.BUSY and wait until flash controller is ready */
FADDRH = erase_page_num << 1; /* select the flash page via FADDRH[7:1] bits */
FCTL |= 0x01; /* set FCTL.ERASE bit to start page erase */
while (FCTL & 0x80); /* optional: wait until flash write has completed (~20 ms) */
EA = 1; /* enable interrupts */
6.3.2 Different Flash Page Size on CC2533
The flash page size has been reduced from 2 KB (2048 bytes) on CC2530, CC2531, CC2540, and
CC2541 to 1 KB (1024 bytes) on CC2533. When performing page-erase operations on the flash memory,
the page to be erased is addressed with the register bits FADDRH[6:0] on CC2533 as opposed to
FADDRH[7:1] on CC2530, CC2531, CC2540, and CC2541. The page-lock bits are still placed in the
upper 16 bytes of the last accessible flash page.这个是在其他帖子看到的,可以吗
一周热门 更多>