KL25Z128的Flash擦写操作

2019-07-15 17:51发布

下面是我的code
  1. unsigned char
  2. Flash_SectorErase(uint_32 *FlashPointer)
  3. {
  4.     unsigned char Return = Flash_OK;
  5.     uint_32 FlashPtr = (uint_32)FlashPointer;
  6.     /* Allocate space on stack to run flash command out of SRAM */
  7.     /* wait till CCIF is set*/
  8.     while (!(FTFL_FSTAT & FTFL_FSTAT_CCIF_MASK))
  9.     {;}
  10.    
  11.     /* Write command to FCCOB registers */
  12.     FTFL_FCCOB0 = FlashCmd_SectorErase;
  13.     FTFL_FCCOB1 = (uint_8)(FlashPtr >> 16);
  14.     FTFL_FCCOB2 = (uint_8)((FlashPtr >> 8) & 0xFF);
  15.     FTFL_FCCOB3 = (uint_8)(FlashPtr & 0xFF);
  16. FTFL_FSTAT |= 0x80;   
  17.     /* wait for command completion */
  18. while (!(FTFL_FSTAT & FTFL_FSTAT_CCIF_MASK)) {};
  19. }
复制代码每次运行到:FTFL_FSTAT |= 0x80;
   不管我给的的参数是多少都没用,MCU肯定 复位,求高手指导!!
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。