下面是我的code
- unsigned char
- Flash_SectorErase(uint_32 *FlashPointer)
- {
- unsigned char Return = Flash_OK;
- uint_32 FlashPtr = (uint_32)FlashPointer;
- /* Allocate space on stack to run flash command out of SRAM */
- /* wait till CCIF is set*/
- while (!(FTFL_FSTAT & FTFL_FSTAT_CCIF_MASK))
- {;}
-
- /* Write command to FCCOB registers */
- FTFL_FCCOB0 = FlashCmd_SectorErase;
- FTFL_FCCOB1 = (uint_8)(FlashPtr >> 16);
- FTFL_FCCOB2 = (uint_8)((FlashPtr >> 8) & 0xFF);
- FTFL_FCCOB3 = (uint_8)(FlashPtr & 0xFF);
- FTFL_FSTAT |= 0x80;
- /* wait for command completion */
- while (!(FTFL_FSTAT & FTFL_FSTAT_CCIF_MASK)) {};
- }
复制代码每次运行到:FTFL_FSTAT |= 0x80;
不管我给的的参数是多少都没用,MCU肯定 复位,求高手指导!!
一周热门 更多>