cancel
Showing results for 
Search instead for 
Did you mean: 

Flash Self Write issues

mscaff
Associate II

Hi.

I'm having some difficulties with the flash self write. This is a 2 part question, they are related but most likely with different causes and solutions.

Background:

I'm using a STM32L476R6T6 (256Kb flash) and I have a bootloader that erases the uC memory, except for the first 12Kb were it resides. It works nice and I have at least 500 units running without problems.

All the bootoader code is based on an old release of the ST library (r1.5) but modified to avoid using interrupts for timeouts

1) I found 1 uC that is not working. It used to. It was my development unit, and after some temperature cycling (-10oc and 70oC) it started to behave like this.

The code was hanging after I tried to update to a new firmware using the bootloader. After some debugging I noticed that the BL is able to erase only the first 128Kb, but it just does nothing with the upper 128Kb.

Since I can write the initial firmware to the uC, i means that ST Link (or at least Mass Erase) works without problems.

Is there anything I can try? Is it possible that this part become defective? Still, it is odd that I can program the part via SWD.

I'm worried that it is some thing critical in my firmware but can't figure what it may be.

2) This happens in all units and at least is consistent. I just need to know if this is a normal behaviour or not.

My bootloader checks if the uC is code protected and if not, enabled Code Protect Level 1.

The problem is that after I call FLASH_OB_Launch, I was expecting the uC to reset and start executing the code again, but it gets stuck and the only way to start it again is thru a power cycle. Is that the expected behaviour?

So far I was able to deal with it, but in this new version of the product I'll have a 1F cap in the power supply, so, a a power cycle will be a little bit more of a challenge.

Thanks, Mauricio Scaff

4 REPLIES 4
Uwe Bonnes
Principal II

Regarding1: Flash can fail, but normally it takes a lot of flash/erase cycles. It that perhaps true for your development unit? Or do you by chance actually a lot more of those cycles than you expect? Or do you use flash as "EEPROM" parameter storage?

Reg 2. Do a real reset.

mscaff
Associate II

Hi, Uwe

Well, I already covered the basics.

About 1: I don't believe this part saw more than 100 erase cycles. 150 tops. And I do now write on the flash except for the Firmware upgrade which happens in most case just once in the life time of the equipment. Furthermore, as I told the flash erases and writes perfectly when done via ST-Link.

About2: As I told the only way I can recover after FLASH_OB_Launch is to do a REAL power cycle on the uC. Hard reset (pulling RST pin to 0V) does nothing at all.

Thanks, Mauricio

Uwe Bonnes
Principal II

Probably your power recovers very slow and you disabled or did not enable Brownout/POR.

mscaff
Associate II

Sorry, didn't get that.

BOR is enabled.

I think we're talking about the 2nd question.

If I do a power cycle, everything goes back to normal 100% of the times.

The problem is that I cannot recover from the Locked situation with a Hard Reset (and in this case, the power supply is stable all the time). That would some my problems. Maybe I missed the point, but I don't see how it could be Brownout related.