cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L071CZT6: Code execution fails on a fixed Flash address after an occasional bit flip.

DN
Associate

Hi,

 

We produced a small batch (50 devices) with STM32L071CZT6, all identical with the same production firmware, and hardware, ... But one of these has an intermittent problem in that the code seems to be fetched from flash differently.
The problem does not manifest when stepping through it with the ST-LINK and KEIL IDE debugger, only when executing it normally. When using the KEIL debugger with ST-LINK3 we open a memory window on that flash region and set a hardware breakpoint on an assembly instruction we should never reach just after the failing instruction at 0x08017E70 and just let it run. When it breaks, we sometimes see that both the disassembly view and memory viewer show that from all the flash data, there are 4 bytes different.
At address 0x08017E6C the data changed from 0X2905 to 0x6905 and 0xD006 to 0xD406.

from
0x08017E6C 0x2905 CMP r1,#0x05
0x08017E6E 0xD006 BEQ 0x08017E7E
0x08017E70 This instruction should never be reached and at this address, we have set our breakpoint.
into
0x08017E6C 0x6905 LDR r5,[r0,#0x10]
0x08017E6E 0xD406 BMI 0x08017E7E
0x08017E70 This instruction should never be reached and at this address, we have set our breakpoint.

The code changed from a compare instruction into a load in register r5 instruction. And that is really the case, each time our breakpoint hits we can see that register r5 is updated, indicating that the cortex-m0 has indeed executed this faulty opcode.

When doing the above test multiple times (reset the device, set the breakpoints and start our program), we may have a series where it always functions properly. Or we may have a series where it's always failing.
The device is running on the HSI RC without the PLL at 16MHz and we have tried:
- lowering the freq to 8MHz
- adding a flash wait state. (set LATENCY bit in FLASH_ACR)
- Disable the prefetch, .. (set DISAB_BUF bit in FLASH_ACR)
- Force the prefetch, (this is the default)

If we add more debug, our code is compiled and linked to another location so we no longer have this problem.
Any suggestions on what we could try or change? Or if we can run a test program to find these issues.

0 REPLIES 0