Board with soldered parts. Only the microcontroller is inserted in the socket; the remaining chips will insert after programming the ATmega8.
We will flash the microcontroller in-circuit, without removing it from the target board. Such programming is possible due to the presence of the SPI interface ( in principle, this connector X2 ).
When programming the ATmega8, 6 pins are used: RESET (1), VCC +5V (7), GND (8), SCK (19), MISO (18) and MOSI (17).
Note: The programmer connects to the computer via the COM port. According to reviews on the Internet, this programmer will not work with the COM-port of the laptop and USB-to-COM adapter. Work only with computer COM-port.
For programming, you need a power supply of + 5V, it can be taken from an external power source, or from a USB charger, the main thing is to make sure that the power source produces a stabilized voltage of 5 volts, otherwise you can burn the microcontroller.
The microcontroller now is ready for the firmware. By turning off the computer, we connect the cable to the COM port and the power supply from the power supply. Turn on the computer.
For the firmware, we need a program, we will use the free UniProf from Mikhail Nikolaev.
When the program starts, a window pops up “ MK did not respond. Check port and connection . ” This is normal, when the programmer is connected with COM1, and in the program COM2 is set by default. Select the right port.
When choosing the correct COM port, the controller was defined as “ Mega8 ”. Let’s try to read, click on the button ” Read “. Only one dashes are considered, that’s right, because the controller is clean.
After flashing the microcontroller, you need to set the fusion bits correctly.
For the “Chance PI” metal detector, the fuses should be displayed as in the picture, Set the Fuses and click on the “ Write ” button in each column , thus the new configuration of the fuses will be written to the Atmega8.
To check the state of the fuses recording, you can close the program, then start it again and click on the “ FUSE ” button . In each column, click the “ Read ” button and make sure that the fuses are correct.
At this stage, the ATmega8 microcontroller firmware for the Chance PI metal detector is finished.
Download firmware for “Chance PI”, version 1.2.1: MEGA