Skip to main content
Associate II
August 9, 2023
Solved

stm32f407 Programming parallelism error firing for no reason

  • August 9, 2023
  • 5 replies
  • 3652 views

I am using the stm32f4 discovery board and writing bare-metal drivers for the embedded flash memory.

I am facing a strange problem when writing to flash memory, to save you time for reading code and when the error happens, here is the status:

Before Error:

FLASH_CR register:

abdosalm_0-1691609290197.png

 

FLASH_SR register:

abdosalm_1-1691609309480.png

 

 

 

 

as you can see, PSIZE if configured correctly, but when this line of code run:

 

 

*global_pu32MemWriteVar = *(uint32_t *)argConst_pu8WriteData;

 

 

or in assembly it will be:

 

 

 416 *global_pu32MemWriteVar = *(uint32_t *)argConst_pu8WriteData;
08000762: ldr r3, [pc, #216] ; (0x800083c <HAL_FLASH_Write+604>)
08000764: ldr r3, [r3, #0]
08000766: ldr r2, [r7, #4]
08000768: ldr r2, [r2, #0]
0800076a: str r2, [r3, #0]

 

 

I see PGPERR: Programming parallelism error get raised even though PSIZE is configured correctly and PG bit is set to 1.

After Error:

FLASH_CR register:

abdosalm_4-1691601763454.png

 

FLASH_SR register:

abdosalm_5-1691601825030.png

 

This topic has been closed for replies.
Best answer by TDK

What about r2 and r3? Specifically looking to check if r3 is word-aligned.

5 replies

TDK
August 9, 2023

What values are in r2 and r3 when that line executes?

One of your screenshots has PG=0. It needs to be PG=1.

TDK_0-1691608326328.png

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
abdosalmAuthor
Associate II
August 9, 2023

sorry, I posted the incorrect screenshot, it's just I have some problems dealing with the web editor of ST forums, anyways, it's 1 (I made sure it's 1), it was just incorrect screenshot

TDK
TDKBest answer
August 9, 2023

What about r2 and r3? Specifically looking to check if r3 is word-aligned.

"If you feel a post has answered your question, please click ""Accept as Solution""."