This is the 21st day of my participation in the August Text Challenge.More challenges in August

At the beginning of the use of IAR software debugging STM8 microcontroller, often pop up the following errors.

According to the error prompt, the *. Out file is missing in the project, and the. Out file is found after opening the project to check. In order to ensure the generated file is normal, delete all the files temporarily generated in the project, and then compile again, and click the debug download button in IAR, the same error will still pop up. Reinstalling the simulator driver, reinstalling the IAR software, and so on, all kinds of methods have been tried, but the error still exists, is it the chip broken? Everything worked fine with a new chip. Always thought it was the chip that broke. Later, there was a dozen product repair, appeared this error. And several products are used less than a week, the quality of STM8 microcontroller is so? So I suspect it’s not the chip, but something else.

So began a long search bug time, has been no breakthrough progress. One day, when I saw the offline burner that burned the code in batches, I suddenly thought that the chip was encrypted after the offline burner burned the program. Forbid other software to set read and write to the chip.

So I found a brand new chip, and then burned programs to the chip with the offline writer, and then used IAR to download programs to the chip, sure enough, the error in the picture above popped up. The culprit was finally found. It seems that the off-line writer encrypts the chip, and the first step must be to erase the encrypted information in the chip in order to normally use IAR software to simulate the chip.

Use STVP software to erase the chip directly

This will prompt chip write protection, cannot be erased. So began the second round of exploration, how to erase chip write protection. Function pays off, finally found a way.

The OPTION BYTE OPTION is first selected on the STVP software.

Then select the option after ROP in the first line as Read Out Protetion ON

Click the second burn button in the toolbar

At this time, a dialog box will pop up, indicating that the chip protection function has been turned on, close the dialog box.

Then reset the ROP option back to Read Out Protetion OFF.

Next click on the second burn button in the toolbar.

Miraculously, the chip can write normally. That means the chip protection has been removed.

Next, IAR software was used to simulate and debug the chip

At this point, IAR can also be simulated and debugged normally, and the cause of this error has finally been completely solved. The cause of this error went back and forth for several months. Fortunately, we found the root cause, otherwise we had to keep changing chips as before.

STM8 microcontroller is very powerful, but in the process of using there will be a lot of pits, need to step on their own slowly, maybe the technical personnel is in the process of stepping on pits to grow up.