Skip to main content
Explorer
January 4, 2024
Question

Putting array index in ccm cause IMPRECISERR Hard Fault

  • January 4, 2024
  • 3 replies
  • 1186 views

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?

 

 

    This topic has been closed for replies.

    3 replies

    Super User
    January 4, 2024

    > 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

    Technical Moderator
    January 4, 2024

    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?

    Graduate II
    January 4, 2024

    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.