AnsweredAssumed Answered

Phantom Flash Errors

Question asked by root.michael on Oct 31, 2014
Latest reply on Oct 31, 2014 by root.michael
Hi all.

I'm working on a project on an STM32L151CBT6 uC, and getting occasional, unexplained error bits WRPERR and SIZERR set in the flash controller.  I set up the flash error interrupt to use the highest priority group so as to preempt other interrupts, and found that it is happening on the same line of code every time:

dma_config->p_stream->CMAR = (uint32_t)dma_config->mem_addr;

If it matters, ^ this line is in an ISR also.

    687B        ldr r3, [r7, #4]
    6A1B        ldr r3, [r3, #32]
    687A        ldr r2, [r7, #4]
    68D2        ldr r2, [r2, #12]
    60DA        str r2, [r3, #12]
    BF00        nop
    BF00        nop
    BF00        nop
    BF00        nop   <-----------

This ^ is the assembly for that line.  I added the nops so as not to destroy the evidence.  The arrow indicates where the PC is when I step out of the error ISR.  r2 is the mem_addr and r3 is the address of CMAR.  Everything to me looks correct and works correctly when I step through it.

The strange part is that this code is being called once every 50 ms, but the flash errors only get set occasionally.  Maybe 10 times per minute.  So I'm stumped.

Any ideas?