在线时间13 小时
UID3505159
注册时间2018-9-4
NXP金币0
该用户从未签到
注册会员

- 积分
- 100
- 最后登录
- 2019-1-23
|

楼主 |
发表于 2018-9-13 11:23:25
|
显示全部楼层
我又改了,现在没有先除以1000了,但是还是有问题
- void flash_text(void)
- {
- uint32_t status;
- status=FLASHIAP_PrepareSectorForWrite(15, 15);
- if(status==kStatus_FLASHIAP_Success)
- {
- printf("1Api was executed successfully\r\n");
- }
- else if(status==kStatus_FLASHIAP_NoPower)
- {
- printf("1Flash memory block is powered down\r\n");
- }
- else if(status==kStatus_FLASHIAP_NoClock)
- {
- printf("1Flash memory block or controller is not clocked\r\n");
- }
- else if(status==kStatus_FLASHIAP_InvalidSector)
- {
- printf("1Sector number is invalid or end sector number is greater than start sector number\r\n");
- }
- else
- {
- printf("1Flash programming hardware interface is busy\r\n");
- }
- status=FLASHIAP_EraseSector(15, 15, SystemCoreClock);
- if(status==kStatus_FLASHIAP_Success)
- {
- printf("2Api was executed successfully\r\n");
- }
- else if(status==kStatus_FLASHIAP_NoPower)
- {
- printf("2Flash memory block is powered down\r\n");
- }
- else if(status==kStatus_FLASHIAP_NoClock)
- {
- printf("2Flash memory block or controller is not clocked\r\n");
- }
- else if(status==kStatus_FLASHIAP_InvalidSector)
- {
- printf("2Sector number is invalid or end sector number is greater than start sector number\r\n");
- }
- else if(status==kStatus_FLASHIAP_NotPrepared)
- {
- printf("2Command to prepare sector for write operation was not executed\r\n");
- }
- else
- {
- printf("2Flash programming hardware interface is busy\r\n");
- }
- status = FLASHIAP_BlankCheckSector(15, 15);
- if(status==kStatus_FLASHIAP_Success)
- {
- printf("3Api was executed successfully\r\n");
- }
- else if(status==kStatus_FLASHIAP_NoPower)
- {
- printf("3Flash memory block is powered down\r\n");
- }
- else if(status==kStatus_FLASHIAP_NoClock)
- {
- printf("3Flash memory block or controller is not clocked\r\n");
- }
- else
- {
- printf("3One or more sectors are not blank\r\n");
- }
- FLASHIAP_PrepareSectorForWrite(15, 15);
- if(status==kStatus_FLASHIAP_Success)
- {
- printf("4Api was executed successfully\r\n");
- }
- else if(status==kStatus_FLASHIAP_NoPower)
- {
- printf("4Flash memory block is powered down\r\n");
- }
- else if(status==kStatus_FLASHIAP_NoClock)
- {
- printf("4Flash memory block or controller is not clocked\r\n");
- }
- else if(status==kStatus_FLASHIAP_InvalidSector)
- {
- printf("4Sector number is invalid or end sector number is greater than start sector number\r\n");
- }
- else
- {
- printf("4Flash programming hardware interface is busy\r\n");
- }
- FLASHIAP_CopyRamToFlash(SECTOR_15_ADDR,&TEXT_Buffer[0], 256, SystemCoreClock);
- if(status==kStatus_FLASHIAP_Success)
- {
- printf("5Api was executed successfully\r\n");
- }
- else if(status==kStatus_FLASHIAP_NoPower)
- {
- printf("5Flash memory block is powered down\r\n");
- }
- else if(status==kStatus_FLASHIAP_NoClock)
- {
- printf("5Flash memory block or controller is not clocked\r\n");
- }
- else if(status==kStatus_FLASHIAP_SrcAddrError)
- {
- printf("5Source address is not on word boundary\r\n");
- }
- else if(status==kStatus_FLASHIAP_DstAddrError)
- {
- printf("5Destination address is not on a correct boundary\r\n");
- }
- else if(status==kStatus_FLASHIAP_SrcAddrNotMapped)
- {
- printf("5Source address is not mapped in the memory map\r\n");
- }
- else if(status==kStatus_FLASHIAP_DstAddrNotMapped)
- {
- printf("5Destination address is not mapped in the memory map\r\n");
- }
- else if(status==kStatus_FLASHIAP_CountError)
- {
- printf("5Byte count is not multiple of 4 or is not a permitted value\r\n");
- }
- else if(status==kStatus_FLASHIAP_NotPrepared)
- {
- printf("5Command to prepare sector for write operation was not executed\r\n");
- }
- else
- {
- printf("5Flash programming hardware interface is busy\r\n");
- }
- status = FLASHIAP_Compare(SECTOR_15_ADDR,&TEXT_Buffer[0],256);
- if(status==kStatus_FLASHIAP_Success)
- {
- printf("6Api was executed successfully\r\n");
- }
- else if(status==kStatus_FLASHIAP_NoPower)
- {
- printf("6Flash memory block is powered down\r\n");
- }
- else if(status==kStatus_FLASHIAP_NoClock)
- {
- printf("6Flash memory block or controller is not clocked\r\n");
- }
- else if(status==kStatus_FLASHIAP_AddrError)
- {
- printf("6Address is not on word boundary.\r\n");
- }
- else if(status==kStatus_FLASHIAP_AddrNotMapped)
- {
- printf("6Address is not mapped in the memory map\r\n");
- }
- else if(status==kStatus_FLASHIAP_CountError)
- {
- printf("6Byte count is not multiple of 4 or is not a permitted value\r\n");
- }
- else if(status==kStatus_FLASHIAP_CompareError)
- {
- printf("6Destination and source memory contents do not match\r\n");
- }
- else
- {
- printf("6 I dont know\r\n");
- }
- }
复制代码
调试后
- 1Api was executed successfully
- 2Api was executed successfully
- 3Api was executed successfully
- 4Api was executed successfully
- 5Api was executed successfully
- 6Destination and source memory contents do not match
复制代码
不清楚咋回事,请问这个会不会被锁住了,不让写。 |
|