在线时间23 小时
UID2001525
注册时间2013-4-15
NXP金币0
该用户从未签到
中级会员
 
- 积分
- 303
- 最后登录
- 2024-10-24
|
发表于 2013-7-3 14:18:44
|
显示全部楼层
回复:求MKL25擦写Flash的demo-(已解决)
其实在每个KL25的demo程序的cpu文件夹中都有一个start.c文件,里面有一个简单的Flash操作的函数,,代码如下:
void flash_identify (void)
{
/* Get the flash parameter version */
/* Write the flash FCCOB registers with the values for a read resource command */
FTFA_FCCOB0 = 0x03;
FTFA_FCCOB1 = 0x00;
FTFA_FCCOB2 = 0x00;
FTFA_FCCOB3 = 0x00;
FTFA_FCCOB8 = 0x01;
/* All required FCCOBx registers are written, so launch the command */
FTFA_FSTAT = FTFA_FSTAT_CCIF_MASK;
/* Wait for the command to complete */
while(!(FTFA_FSTAT & FTFA_FSTAT_CCIF_MASK));
printf("Flash parameter version %d ",FTFA_FCCOB4);
printf(" %d ",FTFA_FCCOB5);
printf(" %d ",FTFA_FCCOB6);
printf(" %d\n\r",FTFA_FCCOB7);
/* Get the flash version ID */
/* Write the flash FCCOB registers with the values for a read resource command */
FTFA_FCCOB0 = 0x03;
FTFA_FCCOB1 = 0x00;
FTFA_FCCOB2 = 0x00;
FTFA_FCCOB3 = 0x04;
FTFA_FCCOB8 = 0x01;
/* All required FCCOBx registers are written, so launch the command */
FTFA_FSTAT = FTFA_FSTAT_CCIF_MASK;
/* Wait for the command to complete */
while(!(FTFA_FSTAT & FTFA_FSTAT_CCIF_MASK));
printf("Flash version ID %d ",FTFA_FCCOB4);
printf(" %d",FTFA_FCCOB5);
printf(" %d ",FTFA_FCCOB6);
printf("%d\n\r",FTFA_FCCOB7);
} |
|