What is a JTAG programmer?

There are quite a few configurations of various programmers that allow you to rewrite software developments into a microcontroller. They can be different, designed for professionals or, conversely, have a simplified interface. The latest programmers include the hero of this article. You will learn not only what it is, but also how to make a JTAG programmer with your own hands. You will find diagrams and photos of how the result should look.

What is a JTAG programmer?

jtag programmer
It is a simplified version of the professional AVR JTAG ICE, which, as you might guess from its name, is designed to program the microcontrollers of the AVR family. Its main difference is that even a layman can assemble it, and the final cost will be many times lower than when buying a factory one. In fact, the mechanism presented in the article is a Chinese replica, so this AVR programmer can also be bought. Therefore, it is possible to say without crookedness that there is also a purchase option. But assembly with your own hands will avoid possible negative consequences due to the cheapness and poor quality of purchased parts in production.

Why choose the JTAG programmer?

programmer avr
The main thing is its low cost and ease of assembly. The JTAG programmer can program all devices that have a JTAG interface. To work through a computer, the AVR Studio development environment is version 4 or higher. With them, this AVR programmer will be able to work.

Programmer shortcomings

The latest versions of the microcontroller families are not programmed without additional work. There are also significant problems with those representatives who have less than 40 legs and 16 KB of memory. As you can see, the circle of potential customers is rather limited. But several popular models just fall under him, so it will come in handy.

Scheme

do-it-yourself jtag programmer
The programmer circuit is simple, ATMega16 and a bit of additional electronics are required for operation. As an interface, MAX232 (for working with COM) and FT232RL (for working with USB) can be used. It is worth mentioning that when using the second option, connecting power via USB is not recommended. In such cases, due to an error or an oversight, protective diodes may receive voltage, and there will be high voltage at the terminals of the FT232RL . This is fraught with the failure of either the programmer or the programming object. This nuance is solved by supplying power through the board.

For simplicity, for those who do not have sufficient qualifications, the programmer is designed for MAX232, but for another option, you only need to install a different connector.

Customization

Given that there are necessary circuits, you should only etch the board. Then everything is neatly connected, soldered into place, and the programmer is checked by flashing the bootloader. Then, you should update the firmware for the JTAG programmer with AVR Studio to the latest version or as long as necessary. The programmer is connected to the adapter. If it works, then you can go to the next section, which outlines the nuances of work and programming. It should be noted that there are all the necessary wires, they are only non-standard located.

programmer circuit

In preparation for work, you should set Fuse bits. They depend on the notation in which the work is done. For a better understanding, here is a table like this:

Bit

Direct Notation (Datashit, UniProf)

Inverse Notation (AVR DUDE GUI, PonyProg)

Ocden

[]

[1]

Jtagen

[]

[1]

SPIEN

[]

[1]

Cktop

[1]

[]

EESAVE

[1]

[]

BOOTSZ1

[]

[1]

BOOTSZ0

[]

[1]

BOOTRST

[1]

[]

BODLEVEL

[1]

[]

Boden

[1]

[]

SUT1

[]

[1]

SUT0

[]

[1]

CKSEL3

[1]

[]

CKSEL2

[1]

[]

CKSEL1

[1]

[]

CKSEL0

[1]

[]

But how to understand which one to choose? The answer to the question is simple: you should connect to the microcontroller and start reading these very bits. Pay attention to SPIEN - if there is a checkmark opposite it, it means that the notation is inverse. If it is not there, then it is direct. If everything was done correctly, then the programmer is ready to flash microcontrollers. But if he subsequently fails to make the firmware - re-read and check again.

Work with the programmer

programmer instruction
For greater clarity, an example of programming LED flashing will be given. Initially, you should start the studio and create a new project. Then select a programming language (in this case, assembler) and set the project name. The program itself will be able to determine that you are using a JTAG programmer. As a platform, you should choose it, and in the window next to it is a microcontroller programmed by it. Further, everything is pretty usual - you just need to drive in the text for the program. So that readers can check the performance, we suggest testing the JTAG programmer with the code indicated in the article. You can see that the diodes began to flash very quickly, which is not surprising, because there is no delay. So, the programmer, instructions for its creation and use are. You just have to realize the flight of your imagination.

A bit about practice. To check, connect 3 LEDs to port A. Then it connects to the board: four interface wires (TCK, TDI, TMS, TDO) and 2 power Vccs go for plus, and GND connects to ground. Everything, there is food, you can go further. In the studio, you need to compile the code and run it. The project will compile quickly, it will immediately be flashed and will begin to work. To monitor the execution process, you can press F11, and then you can observe on which line of code the program is now. To do this, just move the cursor to the row, which turns on the LED, and it will light up. There are many more experiments. Remember that in order to do something, you must work. Let the promotion be slow, but over time you will be able to get exactly what you want, the main thing is not to give up and continue experimenting with an emphasis on the theoretical basis (without it in any way).

Source: https://habr.com/ru/post/G1922/


All Articles