This is the 22nd day of my participation in the August Wen Challenge.More challenges in August
Some time ago, I made a new batch of STM8 boards, but something went wrong when I burned the program for the first time. The program could not be burned. Not only one, but all the boards could not be burned. Is the drawing wrong? The drawing is just changed a little bit in the previous basically, but the change is not big. Besides, what is changed is only the peripheral circuit, and the SCM part is not changed? So is PCB processing a problem? Have you checked the PCB file and circuit board carefully and found no major problems?
So why didn’t the program burn into it? First use IAR online burning.
*.out file is missing, so delete all files generated by the project, and then recompile, download debugging, still the same error.
Then switch to STVP software download
The result indicates that the chip cannot be connected. Check that the writer-burner driver is normal.
Found a previous board can normally burn write, and then a new test board, is not connected to the microcontroller. Suspected that there is a problem with the single-chip microcomputer, so this batch of purchase of single-chip welding to the old board before, can be written normally. Replace the old board with a new board, still can not burn. So we can basically confirm that there is something wrong with this batch of circuit boards?
So what went wrong with the circuit board? The welding, through holes, pads and other problems that may occur in the device have been checked one by one, but no signs have been found. Then can not be connected to the single-chip, it is likely that there is a problem with write SWIM circuit, or when the single-chip does not work normally after power.
Therefore, the reset pin of the single chip microcomputer was measured, and it was found that the reset pin of the newly welded board single chip microcomputer was always low level, that is, after the single chip microcomputer was powered on, it was in the reset state and did not work. Check the capacitance and resistance of the reset pin, the values are normal, and the welding is normal. Then the MCU does not work, there is only one reason, that is, there is no vibration crystal. The board uses the internal crystal oscillator of STM8, and there is only one capacitor outside. Is there a problem with the capacity of the capacitor? Then changed several kinds of capacitance test, the writer still could not connect to the MCU.
Next chip manual, check information, after some STH over and over again, and finally found the reason, that’s the microcontroller pins VCAP capacitance at the time of PCB wiring, be sure to close to the MCU IO pin, otherwise the single chip microcomputer internal oscillation circuit cannot work normally, is the single chip microcomputer internal crystals have a shock.
Then manually fly the line to the MCU 8 pin capacitance to the pin direction to move a little, and then burn with a writer. Now you can write normally. It seems that the distance of the VCAP capacitor is too far.
This time when the new plate, in order to look a little more beautiful, the VCAP capacitor moved a position, the result leads to this result. Here is another big pit, it seems that in the future PCB layout, must pay attention to this point.
When the microcontroller works normally, the level change of power-on reset pin is shown in the figure below
Reset pin level increases from 0V to 4V
The VCAP pin level goes from 0V to 1.8V
The microcontroller can not be connected and can not write the program. The level of the two pins can be determined to determine whether the microcontroller works normally.