Tuesday, 16 December 2014

Disabling JTAG for Atmega16

JTAG stands for Joint Test Action Group. Atmega16 has one JTAG port which shares four pins with PORTC. To use these pins one must disable JTAG port.
There are two methods to disable the JTAG port:

  1. To do it temporarily.If you use this method you need to write this in your code every time.
    Include the following lines in your code
    MCUCSR = (1<<JTD); MCUCSR = (1<<JTD);  Add these lines just after main() fuction.
  2. To do it permanently, you need to change the hfuse and lfuse of your atmega16. Open avrdude-gui and select the target device as atmega16, programmer as usbasp and  go to fuse bits first select lfuse and write 11111111 and program

 Next select hfuse and write 10001001 and program

No comments:

Post a Comment