cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f407 Programming parallelism error firing for no reason

abdosalm
Associate II

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

 

1 ACCEPTED SOLUTION

Accepted Solutions

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".

View solution in original post

5 REPLIES 5
TDK
Guru

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".

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

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".

sure,

this is the content of R3 before STR command:

abdosalm_3-1691639172200.png

 

 

and this is the content of R2 before STR command:

abdosalm_4-1691639195455.png

 

 

thanks, a lot.

I discovered that the address I was trying to write to isn't word aligned