Cart New Account Login

HomeAbout usProductsSupportForumsBlogCustomer Service


Please accept the use of cookies on our site

At PEmicro we use web browser cookies in order to provide you with an enhanced experience and in order to be able to do things like shopping cart processing and identify you when you login to our website.

Click here to accept



search inside this forum
search inside all forums
Flash Memory of STM32F030C8
rose l. May 17, 2017 at 05:00 AM (05:00 hours)
Staff: Juan S.

  • Good morning,
    Please look at the following code:
    [code]u8bit write_para_to_flash(u16bit wVal, u8bit bType)
    {
      FLASH_Status temp_stat;
      u32bit temp_addr = BASE_ADD;
      FLASH_Unlock();                                          // Flash½âËø£¬ÔÊÐí²Ù×÷Ïà¹ØµÄ¼Ä´æÆ÷
      temp_addr = temp_addr + (bType << 4);
      temp_stat = FLASH_ProgramHalfWord(temp_addr,wVal);
      FLASH_Lock();
      if(temp_stat != FLASH_COMPLETE)
        return FALSE;
      else
      {
        wParaArray[bType] = wVal;
        return TRUE;
      }
    }
    void mem_init(void)
    {
      u8bit  bIndex;
      for(bIndex = 0; bIndex < MAX_PARA_NUM; bIndex++)
      { 
        wParaArray[bIndex] = get_para_from_flash(bIndex);
      }
      if(wParaArray[MEM_WRITTEN] != WRITE_VAL)
      {
        wParaArray[BaudOffset] = DEFAULT_BAUD;
        wParaArray[NEG_Offset] = DEFAULT_NEG_VAL;
        wParaArray[POS_Offset] = DEFAULT_POS_VAL;
        wParaArray[MEM_WRITTEN] = WRITE_VAL;
        for(bIndex = 0; bIndex < MAX_PARA_NUM; bIndex++)
        { 
          write_para_to_flash(wParaArray[bIndex], bIndex);
        }
      }
    }[code]

    It's about Flash Memory of STM32F030C8. (this one: http://www.kynix.com/uploadfiles/pdf65976/STM32F030C8T6.pdf ) I don’t know why it can write afte erasing one time( I mean that writing initalized value in succesfully). But the dubugging was failed in the following program. Do you know how to solve it?
    Thanks a lot!




    Comments

Add comment


   Want to comment? Please login or create a new PEMicro account.







© 2018 P&E Microcomputer Systems Inc.
Website Terms of Use and Sales Agreement