ICSP of PIC microcontroller

Publisher:快乐的旅程Latest update time:2015-10-13 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
What I want to talk about today is ICSP. ICSP stands for In-Circuit Serial Programming. This line of English and the four letters ICSP are usually marked with TM, which means that this is a trademark of MICROCHIP. It is also unique to MC. Haha.

As the name suggests, ICSP is a programming method, that is, a burning method. This method can be burned online, that is, it can be burned on the board without removing the chip. And this burning method uses serial data. Online burning is actually not news. The TI DSP that everyone is familiar with can always be burned using the JTAG port, which is the standard online burning.

ICSP of MC is very convenient to use. To use ICSP for programming, you only need to use 5 pins on the chip, including VDD VSS. These two power supplies must be supplied. Then there is the VPP programming voltage. This is certain. To program FLASH, of course, a higher voltage is required. Then there are the two input data and clock pins. Generally, they are RB6 and RB7 of PORTB port. Of course, for those chips that do not distinguish PORT but only GPIO, please refer to DATASHEET to find the corresponding ICSP port. In other words, in fact, there are only two pins related to programming data. It is a standard serial style, haha.

The official MICROCHIP did not say much about the principle, but only gave a Programming Specification for each chip. The above details the specific forms of each instruction for operating the storage space in the chip when the chip is connected via ICSP. From those documents, we can simply assume that in the PIC chip, in the programming mode, there is a "processing interface" between the FLASHROM and the external interface. The interface receives commands from the outside in a serial manner, performs the operations required by the external device after shift decoding, and then outputs the results in a serial manner if the results are required. Of course, in fact, this so-called interface may be just a circuit. But what is certain is that FLASH is not exposed to the outside and directly connected to the outside world, but must first be connected to the ICSP module before it can be connected to the outside world.

This has an advantage, which is the issue of encryption security. Because FLASHROM is not directly connected to the outside world, if the outside world wants to read the contents inside FLASHROM, it must normally go through the ICSP module. If the ICSP module detects that the encryption bit is set, it will refuse to execute the corresponding external read command and return all 0 values. But in fact, the data is not encrypted inside the chip, so normal program access will not be interfered with.

Haha, but actually, I think all current chips should be encrypted in this principle. Otherwise, it would be a bit difficult to let the software realize soft decryption and then execute it. . Then there are several disadvantages of chips encrypted in this principle. The first is that the data is not encrypted in FLASHROM. In other words, the security of the data depends entirely on the security of the ICSP module. If there is any inconsideration in the design of the ICSP module, then the program is basically equivalent to not being encrypted. . In fact, the ICSP module design of some old MICROCHIP products has problems. I have a decrypted 16F73 chip in my hand, and it is said that it only uses some very simple techniques to bypass ICSP encryption. . . In addition, because the data is not encrypted, physical decryption is still undefendable. As long as others can reach your FLASHROM area, your program will be cracked. There is no way to solve this problem. At present, all microcontrollers will have this problem. But it seems that TI's DSP has done a very good job in this area. According to predecessors: TI's DSP kernel is two-layer, the upper layer is the application and processing layer, and the lower layer is the FLASHROM layer. In this way, even if the core is taken out by physical method, it will be impossible to remove the upper layer and expose the lower layer of FLASHROM because the core is two layers. This greatly enhances the security of the chip. Of course, it also greatly increases the cost.

Another point to add is that the ICSP method is extremely simple to implement externally, as long as it can provide signals that fully comply with the Programming Specification. Therefore, you can see many kinds of homemade programmers on the Internet. They are no different from the original PICSTART+ in use - in fact, there are also homemade PICSTART+. . . - And when a new chip comes out, the programmer can be easily upgraded, just rewrite the code of the chip inside the programmer and add the programming command code of the new chip. The internal chip of the programmer. . is generally PIC. . . It can be upgraded by ICSP. . . Hmm. . Use ICSP to upgrade the PIC to support the ICSP of the new PIC. . Doesn't it sound like a tongue twister? Haha. .

So, how should ICSP be used specifically? Haha, this is a good question. First of all, we have to explain that, except for some very old products such as the 16C5X series, almost all MICROCHIP chips use ICSP technology. Moreover, as long as ICSP technology is used, ICSP must be used when burning. In other words: when burning the chip, although it seems that all 28pins or 40pins of the chip are placed on the chip holder of the burner, in fact, only those 5 pins are in effect. . . It's surprising, haha. Sometimes some things are so magical. Take a look at the schematic diagram of the homemade burner and you will understand~

Then, if we really use it on the board, we just need to bring out the 5 pins we need, and then we can use ICSP. However, there are of course some things that need to be paid attention to: First, the VPP pin, which is the MCLR pin of the chip, is usually pin 1, and there will be a voltage of about 13V during programming. Since this pin is generally connected to a 5V power supply circuit during design, it is necessary to ensure that the 13V voltage of the programming will not flow back to the 5V power supply circuit to cause damage. Moreover, according to the Programming Specification, the timing of adding voltage to VDD and VPP during programming needs to be guaranteed, so there should not be too much capacitive load on VPP to avoid causing the voltage rise time to be too slow and thus affecting the programming. On the other hand, the programmer will supply the chip with 5V power, so generally there is no need to power it externally. However, the power supply capacity of general programmers is limited, which is said to be at the level of a few mA. Even industrial-grade programmers such as PROMATE II that have their own dedicated ICSP port have an output current of only a few dozen mA. Therefore, if your board has a high working current, you need to power it yourself, or design the chip's power supply circuit to be isolable. When programming, disconnect the chip's VDD from the external power supply, and only supply the chip with power from the programmer. Then, as the ICSP data path, RB6 and RB7 should also be isolated from the external circuit when programming, to ensure that the clock and data transmitted on them are not distorted by external circuit interference. In addition, when using, you must ensure that your ICSP connection line and chip are directly connected, and there must be no one-way path components such as diodes, otherwise it will cause abnormal phenomena such as chip recognition.

On the other hand, for the connection of the programmer, a professional-grade programmer will provide an ICSP interface, which should be a 5-core cable that can be connected to the target board. If there is no such expensive professional programmer, and only a simple one, you can consider making a conversion cable yourself, which is a double-row pin connector with 28 or 40 pins on one end (for example, a 28pin or 40pin chip holder is a good choice), and then connect the corresponding pins of these pins to make a 5-core cable for use. This type of adapter cable should be especially noted: First, do not insert the double-row pin connector on the programmer in reverse when using it. . If it is inserted in reverse, it will definitely have no effect. . . Second, due to limited load capacity, it is recommended that the line length should not exceed 20cm.

Regarding the ICSP line, I may do some experiments in the near future, because the company's programmer is PICSTART, and I plan to use a SMD PIC, so ICSP is necessary. So a conversion line is necessary... If it is successfully realized, I will try to write down the production method and precautions. Hehe

Actually, ICSP feels like an integrated BOOTLOADER. It's just that ICSP is not needed in normal use, unlike BOOTLOADER, which needs to load external code into memory in normal use. And ICSP is still a little good for encryption. But it still seems a little fragile. Haha. But the newer the chip, the safer its ICSP module should be. You may also pay attention to it when choosing.

Finally, by the way, if you really think that ICSP is very fragile and can be cracked by non-physical means, then we can use a ruthless trick: the soul of ICSP lies in RB6 and RB7, so when designing a program, do not use these two pins in the program. Then, after the programming is completed, use methods such as increasing the current on these two pins to directly scrap the internal circuit, that is, burn these two pins directly. Then, congratulations, the FLASHROM of your chip should no longer be accessible using software methods, including you yourself can no longer burn it. This chip is currently a chip that cannot be accessed by the outside world and can only work on its own ~ hehe...

Reference address:ICSP of PIC microcontroller

Previous article:PIC's program counter PC
Next article:Software and hardware design of an intrusion detection device

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号