Chance PI programming

We continue to build “Chance”, after all the parts are soldered to the board, it’s time to start programming the microcontroller. In this article we will show how to program ATmega8 in-circuit. The material will be useful for all who need to program ATmega8, in any of their designs.

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).

For the burning of the firmware, it is necessary to assemble a simple programmer, on the Internet it is called as “ AVR serial Programmer ”.

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.

For the Micro-controller firmware, click on the ” HEX ” button and select the firmware file.  The contents of the firmware will be displayed in the program window (buffer). Press the ” Prog ” button and monitor the programming process, as the process indicator.

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 UniProf : MEGA , Yandex-Disk. 

Download firmware for “Chance PI”, version 1.2.1: MEGA

Leave a Reply