how to erase stm32f030k6t6 ? after I have program ic PA13 and PA14 set as input pin. now I can't erase or debug with stlink swd . please help thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-20 1:38 PM
how to erase or program using by st cube ide stm32f030k6t6 ? after I have program ic PA13 and PA14 set as input pin. now I can't erase or debug with stlink swd . please help thanks
- Labels:
-
DEBUG
-
GPIO-EXTI
-
STM32CubeIDE
-
STM32F0 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-28 6:07 PM
32 KB Flash, 32x 1 KB pages
Shrink the memory described to the linker from 32 KB to 31 KB
The sector will be at 0x08007C00 .. 0x08007FFF
uint32_t Address = 0x08007C00;
uint32_t Data;
/* Variable used for Erase procedure*/
FLASH_EraseInitTypeDef EraseInitStruct;
// Erase
/* Unlock the Flash to enable the flash control register access *************/
HAL_FLASH_Unlock();
/* Erase the user Flash area ***********/
/* Fill EraseInit structure*/
EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES;
EraseInitStruct.PageAddress = Address;
EraseInitStruct.NbPages = 1;
if (HAL_FLASHEx_Erase(&EraseInitStruct, &PageError) != HAL_OK)
{
/*
Error occurred while page erase.
User can add here some code to deal with this error.
PageError will contain the faulty page and then to know the code error on this page,
user can call function 'HAL_FLASH_GetError()'
*/
Error_Handler();
}
/* Lock the Flash to disable the flash control register access (recommended
to protect the FLASH memory against possible unwanted operation) *********/
HAL_FLASH_Lock();
// Write
/* Unlock the Flash to enable the flash control register access *************/
HAL_FLASH_Unlock();
if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, Address, Data) != HAL_OK)
{
/* Error occurred while writing data in Flash memory.
User can add here some code to deal with this error */
Error_Handler();
}
/* Lock the Flash to disable the flash control register access (recommended
to protect the FLASH memory against possible unwanted operation) *********/
HAL_FLASH_Lock();
// Reading
Data = *((uint32_t *)Address;
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-28 6:35 PM
many thanks
my dear Clive =)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-30 3:10 PM
dear Clive
I got 2 error
error (1).
error on line (if (HAL_FLASHEx_Erase(&EraseInitStruct, &PageError) != HAL_OK)
error (PageError' undeclared (first use in this function); did you mean 'perror'?)
error (2).line Data = *((uint32_t *)Address; Syntax error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-30 4:13 PM
uint32_t PageError = 0;
Data = *((uint32_t *)Address);
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-30 5:46 PM
Clive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-14 3:27 PM
dear Clive
firstly many thanks your help.
- now I want to know how I can erase and program only Address1 = 0x08007C00;
- and then how I can erase and program only Address2 = 0x08007D00;
- it mean I don't want to erase pages just I want to erase specific address line
- because I need to store different 8 to 12 variable it mean I have to use 8 to 12 pages and every page is 1k bytes .so please help me.
- thanking you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-14 3:41 PM
Collect ALL your configuration information into a structure, including a sequence number, manage the data in a RAM copy and then journal that across the flash pages, selecting the last one as being valid on the read side, and then writing to the next available slot. When you've consumed the whole page, then you can erase and recover one of them.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-14 3:58 PM
dear Clive
is there any erase function to erase specific address line ? or some easy way ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-14 4:07 PM
Minimum erase size is a 1KB page.
Journalling a structure isn't unduly complicated.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-14 4:30 PM
dear clive
I am very new just in this mcu programing field .start working with this just few month ago. so i don't know many .have to learn many thing .
now very small thing is complicated for some time.
if you will guid me how to start some code in ram. like last time very easy for me to understand everything erase function and program and read.
thanks
