Translate

Wednesday, 6 January 2016

Hardware for powering on and programming ATmega

                    Alright, After the power supply  (refer here for power supply ) the next step is to build a board with the chip and the connectors for programming.
here is a simple board ready for programming.
.

                       As you can see the ISP (in system programming) pins are soldered on the board which means that reprogramming the board will be easy as we do not have to remove the chip. 

However you can also use something like this





Here the chips can be programmed separately (as shown above) and later be placed or soldered directly to a board.

The image of the board shown above has the following
  • 28 pin ZIF socket
  • 40 pin ZIF socket
  • 10 pin male socket
  • 16Mhz crystal
  • 2 X 0.33pf ceramic disc capacitors
Even though two ZIF (zero insertion force) sockets are present only one chip can be recognised at a time. If we put both the chips. None of them will be detected.

Here’s the back wiring of the board



Here is the circuit diagram of the board



                  

ok, now that the basic programming and power connections (refer here for power supply ) have been set out, a simple but important topic. 'Reset function in ATmega's. A reset basically means 'returning to defaults' , which in this case returns the controller register values to their defaults. The MCU also execute its code from the beginning.

The ATmega8 has four sources of Reset:
  • Power-on Reset. The MCU is reset when the supply voltage is below the Power-on
    Reset threshold
  • External Reset. The MCU is reset when a low level is present on the RESET pin for
    Longer than the minimum pulse length 
  • Watchdog Reset. The MCU is reset when the Watchdog Timer period expires and the
    Watchdog is enabled
  • Brown-out Reset. The MCU is reset when the supply voltage VCC is below the Brown-out Reset threshold (VBOT) and the Brown-out Detector is enabled
Ill briefly explain the first two as they are commonly used

Power on reset

Well this is the simplest form of resetting the chip. The name says it all ' The chip resets when it is powered on'. Every ATmega chip (at least the ones most commonly used) have a on-chip Power-on Reset (POR) circuit to generate a POR pulse. whenever the supply voltage (VCC) is below the detection level, the POR gets activated. The POR circuit can also be used to trigger a Start-up Reset, and also to detect a failure in supply voltage. A Power-on Reset (POR) circuit ensures that the device is reset from Power-on.

External reset

This function lets you use a pulse to reset the chip. The pulse can be a signal from a button or another microcontroller project. The only thing is that the reset pin (pin 9 in ATmega 16/32) should be grounded to trigger it.



Notice the resistor? (R). This is a pull up resistor. Which means the line in this case pin 9 of the MCU has a defined state. That is when the button SW1 is not pressed the line is pulled high (+5V) to prevent any accidental resets. This is very important. I have not used it on the board containing the ZIF sockets because the programmer has one on board. However to make a stand alone circuit the resistor is required.

If a rest button is not used. The reset pin must be pulled up by the resistor. So what about the value?

Well the best and safest method to use the values mentioned in the data sheet. However here are a few values which worked for me

8K2 to 15K @ 5V
4.7K to 8K2 @ 3.3V(only for ATmega 8L, 16L, 32L)
3K3 @ 1.8V(only for ATmega 8L, 16L, 32L)


   For that you will need an USB to ISP programmer.There are two pin configurations 10pin and 6 pin, both work the same way but the pinout is different.Even though 10 pin only 6 lines are generally used.
A 10 pin USB to ISP AVR programmer
A 6 pin USB to ISP AVR Programmer
 The default directory of the hex file is in my documents but you can change it any time. Any burning software available can be used. Just google it.


Here is a screen shot of what I use

Well guys the in the next post we will discuss on connecting the IO pins to an LED and a button......Ill provide a sample code too.

By the way This article was written with reference from the datasheet

No comments:

Post a Comment