Menu

#350 stm32f07/9x wrong flash sector size

0.11.0
new
nobody
None
2022-05-05
2022-05-05
No

While trying to enable and disable write protect the problem arises that on a stm32f071 only the first 16 sectors can be enabled/disabled the latter 16 sectors cannot be changed.

Furthermore, "flash info 0" shows a sector size of 8KB (which is wrong, it should be 4KB according to the stm32f0x reference manual - see https://www.st.com/resource/en/reference_manual/dm00031936-stm32f0x1stm32f0x2stm32f0x8-advanced-armbased-32bit-mcus-stmicroelectronics.pdf page 54)

The root cause is the wrongly configured ppage_size (1 sector is 2 pages for stmf07/9x)
The following patch solves the issue for me, but I only have stm32f072 to test.
@@ -863,7 +863,7 @@ static int stm32x_probe(struct flash_bank bank)
break;
case 0x448: /
stm32f07x /
page_size = 2048;
- stm32x_info->ppage_size = 4;
+ stm32x_info->ppage_size = 2;
max_flash_size_in_kb = 128;
stm32x_info->user_data_offset = 16;
stm32x_info->option_offset = 6;
@@ -872,7 +872,7 @@ static int stm32x_probe(struct flash_bank
bank)
break;
case 0x442: / stm32f09x /
page_size = 2048;
- stm32x_info->ppage_size = 4;
+ stm32x_info->ppage_size = 2;
max_flash_size_in_kb = 256;
stm32x_info->user_data_offset = 16;
stm32x_info->option_offset = 6;

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.