Skip to content

Can I use platform::flash in stm32f030c8t6? #720

Answered by zhangzq71
zhangzq71 asked this question in Q&A
Discussion options

You must be logged in to vote

it can't directly use STM32G0 driver for STM32F0,

modm_ramcode uint32_t
Flash::erase(uint8_t index)
{
	FLASH->SR = FLASH_SR_ERR;
	FLASH->CR = FLASH_CR_STRT | FLASH_CR_PER |
			((index << FLASH_CR_PNB_Pos) & FLASH_CR_PNB_Msk);
	while(isBusy()) ;
	FLASH->CR = 0;

	return FLASH->SR & FLASH_SR_ERR;
}

STM32F0 FLASH_CR register doesn't have FLASH_CR_PNB_Pos bit.

Replies: 7 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by salkinium
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #514 on September 29, 2021 14:35.