2024-07-29 10:19 AM
I am working with STM32G030K6T6 MCU. In some cases I write and erase to flash memory. While writing there is no problem, while erasing some of my GPIOs go from HIGH to LOW momentarily. I see LED blinking momentarily. Erase function works fine but my general purpose peripheral is affected. My write and erase functions are almost the same as STM32Cube->Repository example. No change is observed in MCU power supply. Can you help me? Thanks.
2024-07-29 10:46 AM
@FatihTaşt. wrote:My write and erase functions are almost the same as STM32Cube->Repository example.
"almost" ? :thinking_face:
So what, exactly, is different?
2024-07-29 12:02 PM
Probably going to need more detail here. Which pins are affected and at which point exactly within the code.
2024-07-29 01:06 PM - edited 2024-07-30 06:58 AM
This happens when I call the HAL_FLASHEx_Erase() function and I get the message "Target not responding, retrying......" from St-Link for a short while. The LED I control on port B resets briefly.Also the ST-link SWD pins are probably affected by this situation.
FLASH_EraseInitTypeDef erase_init;
uint32_t page_error = 0;
/* Set page erase initialization structure */
erase_init.TypeErase = FLASH_TYPEERASE_PAGES;
erase_init.PageAddress = page_address;
erase_init.NbPages = page_count;
HAL_FLASH_Unlock();
/* Flash erase initialization */
if (HAL_FLASHEx_Erase(&erase_init, &page_error) != HAL_OK)
{
/* Error condition handling */
// Error_Handler();
}
HAL_FLASH_Lock();
The error received is indicated;
2024-07-30 01:46 AM
Please see the posting tips for how to properly post source code: