Posts: 79
Registered: ‎10-12-2003
Accepted Solution

Cause of Flash Error Reset

Hello, All!


I've been working with C8051F MCU since about 2000, but the first time I encountered this phenomenon!

Therefore, I want to ask the respected community of experts, whether they have encountered similar problems and what could be their reason?!!


The phenomenon is observed on the C8051F340. About a month ago, the HW was written and successfully worked in the debugging process. Programming and debugging of board passed normally without any surprises. On the other board there are 3 buttons (except for power amplifiers outputs and optocouplers inputs). Each of buttons is pulled up through a resistor 5K1 to +5V and shunted by a capacitor to the ground! 

The problem arose after replacing this second board!

The controller board is still programmable and runs without problems!

However, after 5-10 clicks on one of the randomly selected buttons, the MС freezes and after a few seconds there is a reboot with the error "Flash Error". 

The supply voltage +5V is OK! Noises and pulsations on power supply - no more than 3mV.

No input signals are received to the board - the connectors are disconnected!

I will repeat! The program remained the same (which previously worked fine)!

Replacing the microcontroller with a new one did not give anything - the problem remained!


Can someone tell me the reason?


Oleg Nicolaiciuc
Posts: 371
Registered: ‎09-04-2013

Re: Cause of Flash Error Reset

Based on the datasheet, there are several cases that may cause a Flash error reset.

  • A Flash write/erase/read target an illegal address, above user code space, including Reserved area.
  • Accessing locked pages from program executing on an unlocked page.
  • VDD monitor is not enabled during Flash write/erase.

Not sure if the Lock Byte is used in your application or not, if so, recommend checking the Flash security  options and lock byte setting.


Posts: 79
Registered: ‎10-12-2003

Re: Cause of Flash Error Reset


Thanks for the answer!


But the reason I just found! So the problem is solved!
The reason was as follows:
The developers of the power subsystem have made some miscalculation!

After DC-DC, from input voltages into +5V they installed a large electrolytic capacitors  and a serial choke 220mH, and then again large electrolytic capacitors.

After several pressing of the buttons at the time of release it, on the power supply due to a rather large choke, narrow pulses (about 1 ms) were generated, which were superimposed on the + 5V supply.

At the same time, the total amplitude was about +5.6V, which actually caused Flash reading errors.

After reducing the value of the chokes to 220uH, all began to work like a clock!

The problem has disappeared!


Here's an unusual case!



Oleg Nicolaiciuc
Posts: 8,132
Registered: ‎08-13-2003

Re: Cause of Flash Error Reset

electrolytic, not tantalum and a choke


have not seen that for ages what is the reason?

Posts: 79
Registered: ‎10-12-2003

Re: Cause of Flash Error Reset

That's how it worked, "experts"! Uff!


Oleg Nicolaiciuc