cancel
Showing results for 
Search instead for 
Did you mean: 

Putting array index in ccm cause IMPRECISERR Hard Fault

Hz Lin
Associate II

I have a code for the stm32f334 where I have an interrupt routine and a DMA transfer triggered by the same timer. In the interrupt routine the DMA rolling buffer is updated. Because this update is time consuming, I want to optimize the time spent in the routine. What I found out is that when placing any variable used as array index in .ccmram (for example "HRTIM_Buffer[buffer_index+i ]  = some data", with buffer_index being a global variable placed in .ccmram), the code result in IMPRECISERR Hard Fault. Is this expected behavior? Or am I doing something wrong?

 

 

3 REPLIES 3

> buffer_index being a global variable placed in .ccmram

There are too many unknowns in this description.

Place a breakpoint just before the instruction causing the issue, and observe all related variables content.

One often made error when placing variables to unusual sections is, that these variables are not implicitly zeroed/initialized in the startup code, even if they are global.

JW

FBL
ST Employee

Hello @Hz Lin 

I would suggest debugging the issue by first making it a precise error. It is possible the PC will advance before the actual data store completes. 

Have you checked Use STM32F3/STM32G4 CCM SRAM with IAR Embedded Workbench®, Keil®​MDK-ARM, STMicroelectronics STM32CubeIDE and other GNU-based toolchains - Application note?

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


I'm out of offce with limited access to my emails.
Happy New Year!

Imprecise just means the data was leaving via a Write Buffer, a pipelining mechanism, and the MCU can't attribute this to a specific instruction in the code, because there's not direct associativity carried forward.

BUT, it's going to be close, perhaps a couple of instructions earlier, and the address written too will be identified.

Dump the current registers, general and fault, disassemble the code several instructions prior to the reported PC.

Look at the code and what the intent was via a C / ASM side-by-side. Should be obvious as to the code/pointer involved.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..