A simple JDM programmer for PIC microcontrollers - Microcontroller programmers - Microcontroller device circuits. The simplest JDM programmer for PIC on passive components Port and protocol settings when connecting the programmer

One day I decided to assemble a simple LC meter for pic16f628a and naturally it had to be flashed with something. I used to have a computer with a physical COM port, but now I only have USB and a pci-lpt-2com board. To begin with, I assembled a simple JDM programmer, but as it turned out, it did not want to work with either the pci-lpt-com board or the usb-com adapter (low voltage of RS-232 signals). Then I rushed to look for usb pic programmers, but there, as it turned out, everything was limited to the use of expensive pic18f2550/4550, which I naturally didn’t have, and it’s a pity to use such expensive MKs if I very rarely do anything at peaks (I prefer av- Yes, flashing them is not a problem, they are much cheaper, and it seems to me that it is easier to write programs on them). After delving for a long time on the Internet in one of the many articles about the EXTRA-PIC programmer and its various variants, one of the authors wrote that extrapic works with any com ports and even a usb-com adapter.

The circuit of this programmer uses a max232 logic level converter.

I thought that if you use a usb adapter, it would be very stupid to convert the usb to usart TTL, TTL to RS232, RS232 back to TTL levels twice, if you can just take the TTL signals of the RS232 port from the usb-usart converter chip.

So I did. I took the CH340G chip (which has all 8 com port signals) and connected it instead of max232. And this is what happened.

In my circuit there is a jumper jp1, which is not in the extra peak, I installed it because I didn’t know how the TX output would behave at the TTL level, so I made it possible to invert it on the remaining free NAND element and, as it turned out, it was right there is a logical one at the TX pin, and therefore there is 12 volts at the VPP pin when turned on, but nothing will happen during programming (although you can invert TX in software).

After assembling the board, it was time for testing. And here came the main disappointment. The programmer was identified immediately (with the ic-prog program) and started working, but very slowly! In principle - as expected. Then in the com port settings I set the maximum speed (128 kilobaud) and began testing all the found programs for JDM. As a result, PicPgm turned out to be the fastest. My pic16f628a was fully flashed (hex, eeprom and config) plus verification for about 4-6 minutes (reading is slower than writing). IcProg also works, but slower. There were no programming errors. I also tried to flash eeprom 24c08, the result is the same - everything sews, but very slowly.

Conclusions: the programmer is quite simple, it does not contain expensive parts (CH340 - 0.3-0.5 $, k1533la3 can generally be found among radio junk), works on any computer, laptop (and you can even use tablets on Windows 8/10). Cons: it is very slow. It also requires external power for the VPP signal. As a result, it seemed to me that for infrequent flashing of peaks, this is an easy to repeat and inexpensive option for those who do not have an ancient computer with the necessary ports at hand.

Here is a photo of the finished device:

As the song says, “I made him out of what was.” The set of parts is very diverse: both SMD and DIP.

For those who dare to repeat the circuit, almost any one will be suitable as a usb-uart converter (ft232, pl2303, cp2101, etc.), instead of k1533la3, k555 will be suitable, I think even k155 series or a foreign analogue 74als00, it may even work with logical NOT elements of the type k1533ln1. I am attaching my own printed circuit board, but anyone can redraw the wiring there for the elements that were available.

List of radioelements

Designation Type Denomination Quantity NoteShopMy notepad
IC1 ChipCH340G1 To notepad
IC2 ChipK1533LA31 To notepad
VR1 Linear regulator

LM7812

1 To notepad
VR2 Linear regulator

LM7805

1 To notepad
VT1 Bipolar transistor

KT502E

1 To notepad
VT2 Bipolar transistor

KT3102E

1 To notepad
VD1-VD3 Rectifier diode

1N4148

2 To notepad
C1, C2, C5-C7 Capacitor100 nF5 To notepad
C3, C4 Capacitor22 pF2 To notepad
HL1-HL4 Light-emitting diodeAny4 To notepad
R1, R3, R4 Resistor

1 kOhm

3

The proposed programmer is based on a publication from the magazine “Radio” No. 2, 2004, “Programming modern PIC16, PIC12 on PonyProg.” This is my first programmer that I used to flash PIC chips at home. The programmer is a simplified version of the JDM programmer, the original circuit has an RS-232 to TTL converter in the form of a MAX232 microcircuit, it is more universal, but you can’t assemble it “on your knees”. This circuit does not have a single active component at all, does not contain scarce parts and is very simple; it can be assembled without the use of a printed circuit board.

Rice. 1: Schematic diagram of the programmer.

Description of the circuit operation
The programmer circuit is shown in Fig. 1. Resistors in the CLK (clocking), DATA (information), Upp (programming voltage) circuits serve to limit the flow of current. PIC controllers are protected from breakdown by built-in zener diodes, so there is some compatibility between TTL and RS-232 logic. The presented circuit contains diodes VD1, VD2, which “take” the positive voltage from the COM port relative to pin 5 and transfer it to power the controller, thanks to which in some cases it is possible to get rid of an additional power source.

Setting up
In practice, it does not always happen that this programmer will work without adjustment, on the first try, because... The operation of this circuit is highly dependent on the parameters of the COM port. However, for me, on two motherboards Gigabyte 8IPE1000 and WinFast under XP, everything worked right away. If you are too lazy to deal with a broken, more complex programmer circuit, then you should try to assemble this one. Here are some things that may affect:

The newer the mat. board, the developers pay less attention to these ports, because these ports have long become obsolete. You can get rid of this by purchasing a USB-COM adapter, although again the purchased device may not be suitable. The necessary parameters are as follows: the variable voltage must change at least -10V to +10V (log. 0 and 1) relative to the 5th pin of the connector. The supplied current must be at least such that when a 2.7 kOhm resistor is connected between the 5th contact and the contact under test, the voltage does not drop below 10V (I have not seen such boards myself). Also, the port must correctly determine the voltages coming from the controller; at a voltage level close to 0V, but not more than 2V, zero is determined, and accordingly, at a voltage level above 2V, one is determined.

Problems may also arise due to software.
This is especially true for LINUX OS, because... Due to the presence of emulators such as wine, VirtualBox, ports may not work correctly, and a lot of capabilities are required from them. I will touch on these problems in more detail in another article.

Knowing these features, let's start setting it up.
For this, it is very desirable to have the ICProg 1.05D program.
In the program menu, you must first select the appropriate setting in the settings. port (COM1. COM2), select JDM programmer. Then open the “Hardware Check” window, in the “Settings” menu. In this menu, you need to check the boxes one by one and use a voltmeter to measure the voltage at the contacts of the connected connector. If the voltage parameters do not correspond to the norm, then, unfortunately, this may be the cause of inoperability, then you will have to assemble a circuit with an RS-232 TTL converter. Having checked all the boxes, you need to make sure that a supply voltage of about 5V is generated at the zener diode. If the voltages are normal and there are no installation errors, then everything should work. We put the controller in the socket, open the firmware, program it. There is no need to enable checkboxes like “Invert data out” (all are unchecked). Also, do not forget that some batches of controllers may have non-standard parameters, and it is not possible to flash them; in such cases, with this programmer, you can only try to reduce the supply voltage from 5V to 3-4V by connecting accordingly. zener diode, look at the controller for erroneous activation of the LVP (low-voltage programming) mode, how to prevent it, you can read on the Internet for a specific type of controller. It is probably possible to increase the programming voltage of the problematic controller only by complicating the circuit by introducing an amplification stage with a common emitter, powered from an additional power source.

Now let's talk more about the problem with the device's power supply. The programmer was tested with ICProg programs and console picprog under Linux, it should work with any that supports JDM if you connect an additional power source (it is connected through a 1 kOhm resistor to the zener diode, diodes with resistors in this case can be completely excluded). The fact is that the programmer control algorithms for individual software are different, the ICProg program is the most unpretentious. It was noticed that in Windows OS this program raised the required supply voltage on unused pin 2, the same program under the emulator in Linux to another mat. The board was no longer able to do this, but a way out was found by taking power from the programming voltage. In general, I think you can use this programmer with ICProg without additional power. With other software this can hardly be guaranteed, for example, the “native” picprog from the Ubuntu repositories without power simply does not detect the programmer, displaying the message “JDM hardware not found”. It probably either receives some data without applying the programming voltage, or does it too quickly, so that the filter capacitor does not yet have time to charge.

As a basic programmer, we suggest you assemble a JDM compatible programmer, which we called the NTV programmer, using the original design. Below is a diagram of the NTV programmer (using a DB9 socket; not to be confused with a plug).

The programmer assembled according to this scheme repeatedly and accurately flashed controllers (and a number of others) and can be recommended for repetition by novice radio amateurs.

This programmer DOES NOT WORK when connected to laptops, because... The signal levels of the RS-232 interface (COM port) in mobile systems are underestimated. It may also not work on modern PCs where the hardware saves current on the port. So don’t be judgmental, collect and test it on all the computers that come to hand.

Structurally, the programmer board is inserted between the contacts of the DB-9 connector, which are soldered to the contact pads of the printed circuit board. Below is a drawing of the board and a photograph of the assembled programmer.



To complete the information, it should be said that there is another similar programmer that I assembled for microcontrollers in an 8-pin package ( and ). The programmer also works great with these microcontrollers. Below is a drawing of the board and photographs.

Quickly assembling a circuit you like on a microcontroller is not a problem for many radio amateurs. But many people starting to work with microcontrollers are faced with the question of how to program it. One of the simplest programmer options is the JDM programmer.

Programmer ProgCode v 1.0

This program runs on WindowsXP. Allows programming PIC controllers of the middle family (PIC16Fxxx) via the COM port of the computer. The programmer connection indicator (in the upper right corner of the window) turns red if there is no programmer on the port selected in the settings. If the programmer is connected, the program detects it and the indicator in the upper right corner takes the form shown in Figure 1.

On the left side of the program window there is a control panel. This panel can be minimized by clicking on the button in the toolbar or by clicking on the left edge of the window (this is convenient when the program window is maximized to full screen).

Figure (screenshot of the ProgCode v1.0 program)


If a HEX file is loaded into the program, then it is advisable to first select in the list of controllers the MK for which the loaded firmware is designed. If this is not done, then the file designed for a microcontroller with a memory larger than that selected in the list will be cut off and parts of the program will be lost - with this option for loading the file, a warning is displayed.

If this does not happen, then you can select the desired controller after loading the file into the program.

SFR File Format

The ProgCode programmer supports working with its own file format. These files have the extension .SFR and allow you to store additional information about the program intended for the microcontroller. This file stores information about the type of microcontroller. This allows you to not worry about pre-selecting the MK type in the settings when loading an SFR file.

Port and protocol settings when connecting a programmer

After installing the program, by default all the settings that are necessary for the programmer to work with the JDM circuit given on this page are set.
Signal inversion in the above circuit is needed only for the OutData output, since in this circuit the signal is inverted by the matching transistor. On all other pins, inversion is disabled.



The pulse delay can be equal to 0. Its adjustment is provided for “particularly difficult” controller instances that cannot be flashed. The same applies to the recording pause allowance - it is zero by default. If you increase these settings, the controller programming time will increase significantly.

The “check on write” checkbox should be checked if you need to “on the fly” check everything that is written to the microcontroller for correctness and compliance with the source file. If you uncheck this box, the check will not be performed at all and there will be no error messages, even if such errors actually exist.
Select port speed - the speed can be any. For a JDM programmer this parameter has no meaning.

WindowsXP uses buffering of information transmitted through COM ports. These are so-called FIFO buffers. To avoid errors when programming via JDM, this mechanism must be disabled. You can do this in Windows Device Manager.

Go to the control panel, then:
Administration - Computer Management - Device Manager

Then select the port to which the JDM programmer is connected (for example COM1) - look at the properties - port parameters tab - additional. And uncheck the box "Use FIFO buffers"

Figure - Setting up a COM port to work with a JDM programmer



After this, restart the computer.


Local Project Explorer

In addition to directly programming the controllers, the program provides a convenient browser for projects on the MK, located both on local computer folders and on the Internet. This was done for ease of use. Often the necessary projects are located in different folders, and you have to spend time getting to the right directory in order to view the project. Here you can easily add the necessary folders to the list of folders and view any project with two or three mouse clicks.

When you double-click on it in the browser panel, any file will open in the program itself - this applies to pictures, html files, doc, rtf, djvu (with plugins installed), pdf, txt, asm. The file can also be opened by double-clicking in a browser using an external program installed on the computer. To do this, the extension of the desired file type must be entered in the "File Associations" list. If you do not specify the path to the opening program, Windows will open the file in the program by default (this is convenient for opening archives that are not always clearly opened). If the path to the opening program is specified in the list, the file will open in the specified program. It is convenient to view files like SPL, LAY, DSN in this way.

Figure (screenshot of the ProgCode v1.0 program browser)



This is what the file association settings window looks like:




Internet Project Browser

The project browser on the Internet, just like the local project browser, allows you to quickly go to the desired site on the Internet with a couple of clicks, view the project and, if necessary, immediately flash the program in MK.



When reviewing projects on the Internet, if on the project page there is a link to a file with the SFR extension (this is the file format of the ProgCode program), then when you click on it, such a file will open in a new program tab and is immediately ready for flashing into the microcontroller.
The list of links can be edited using the "Edit" button. This will open a window for editing the list of links:





Description of the chip programming process

Most modern ICs contain flash memory that is programmed using I2C or similar protocols.
Rewritable memory is found in PIC, AVR and other controllers, memory chips such as 24Cxx, and similar ones, various memory cards such as MMC and SD, ordinary USB flash cards that are connected to the computer via a USB connector.

Let's consider writing information to the flash memory of the microcontroller PIC 16 F 628 A

There are 2 lines DATA and CLOCK , through which it is transmittedinformation. Line CLOCK serves to supply clock pulses, and the line DATA to transmit information.

To transfer 1 bit of information to the microcontroller, you need to set 0 or 1 (depending on the value of the bit) on the data line (DATA) and create a voltage drop (transition from 1 to 0) on the clock line (CLOCK).
One bit for a controller is not enough. He waits for five more in order to perceive this 6-bit message as a command. The controller really likes commands, and they must consist of 6 bits - such is the nature of the PIC 16.
Here is the list and meaning of commands that PIC is able to understand. There are not so many commands - the vocabulary of this controller is small, but don’t think that it is completely stupid - there are devices with fewer commands

"LoadConfiguration" 000000 - Loading configuration

"LoadDataForDataMemory" - 000011 - Loading data into data memory (EEPROM)
"IncrementAddress" 000110 - Increase the address of the PC MK
"ReadDataFromProgramMemory" 000100 - Reading data from program memory
"ReadDataFromDataMemory" 000101 - Reading data from data memory (EEPROM)
"BeginProgrammingOnlyCycle" 011000 - Start programming cycle
"BulkEraseProgramMemory" 001001 - Complete erase of program memory
"BulkEraseDataMemory" 001011 - Complete erase of data memory (EEPROM)

The controller reacts to these commands in different ways. In different ways, after issuing the command, you need to continue the conversation with him.
In order to begin a full-fledged programming process, you must also apply a voltage of 12 volts to the MCLR pin of the controller, and then apply a supply voltage to it. It is in this sequence of voltage supply that there is a certain meaning. After power is applied, if the PIC is configured to operate from the internal RC oscillator, it may begin executing its own program, which is not allowed when programming, as failure is inevitable.
Preliminary supply of 12 volts to the MCLR allows you to avoid such a development.
When writing information to the flash memory of MK programs after the command

"LoadDataForProgramMemory" 000010 - Loading data into program memory

it is necessary to send the data itself to the controller - 16 bits,
which look like this:

“0xxxxxxxxxxxxxx 0.”

The crosses in this word are the data itself, and the zeros at the edges are sent as a frame - this is the standard for PIC 16. There are only 14 significant bits in a word. This series of controllers has a 14-bit command representation format.
After the data word transmission has finished, the PIC waits for the next command.
Since our goal is to write a word into the program memory of the MK, the next command should be the command

"BeginEraseProgrammingCycle" 001000 - Begin a programming cycle

Having received it, the controller disconnects from the outside world for 6 milliseconds, which it needs to complete the recording process.

The signals at the microcontroller pins are generated by a computer using special programs - programmers. COM, LPT or USB ports can be used for signal transmission. Programs such as PonyProg, IsProg, WinPic800 work with the JDM programmer.


JDM programmer circuit

A very simple programmer circuit is shown in the figure. Although this circuit does not implement control of the voltage supply sequence, it is very simple and it is possible to assemble such a circuit very quickly, using a minimum of parts.
Figure (JDM programmer circuit)


One of the questions when connecting a programmer to a computer is how to ensure selective isolation. To avoid damage to the COM port in the event of a malfunction in the circuit. Some designs use the MAX232 IC, which provides selective isolation and signal level matching. In this scheme, the issue is solved more simply - by using battery power. The signal level coming from the computer is limited by zener diodes VD1, VD2, and VD3. Despite the simplicity of the JDM programmer circuit, it can be used to program most types of PIC microcontrollers.

The jumper between pins COM6(DSR) and COM7(RTS) is designed so that the program can determine that the programmer is connected to the computer.

The connection of the programmer outputs to a specific MK depends on the type of MK. Often, several panels are mounted on the programmer board, which are designed for a specific type of controller.

The table shows the purpose of the legs of some types of MK during programming.

The PIC16F84 and PIC16F84A MCUs have the same arrangement of pins intended for programming.



The assignment of pins for microcontrollers of the PIC16Fxxx series, depending on the type of case, is in most cases standard, but if there is any doubt about this, then it is most reliable to check the datasheet for a specific instance of the MK. Some of the documentation is available on the Russian website http://microchip.ru A complete collection of datasheets and other documentation is located on the website of the PIC microcontroller manufacturer: http://microchip.com

Projects index

The program allows you to directly go to the index page, view the description of the desired project in a couple of clicks, and immediately flash the program into the controller.



If you need to flash the controller with the selected firmware, click on the SFR file, for example Timer_a.sfr
The program downloads the file from the server to a new tab.



After this, all that remains is to insert the MK into the programmer socket, if this has not already been done, and click on the “Write all” button.
The program is recorded in MK. After this, the controller is inserted into the device board and the device is ready for operation.
Continuing the topic:
Solutions

Registration in VKontakte is simple, however, many of my colleagues, at an advanced age, think that it is difficult. I’m showing you how to register on VKontakte for free, right now....