Re: PIC12F675 MCLR programming ERROR
|
||||
---|---|---|---|---|
中級會員
|
在美國微芯網站有流傳着一則KB:
Why does MPLAB warn me about using internal MCLR and internal RC oscillator mode when I'm using an MPLAB ICD2 programmer? Resolution: It is important to be very careful when using internal MCLR and internal RC oscillator mode on a device when using the ICD2. Since the ICD2 can not control the MCLR and it can not control the Vdd supply voltage of the part, a device programmed for internal MCLR and internal oscillator mode will often start running before the programming sequence begins. This can cause programming to fail, or in other cases, cause all manner of unusual behavior to be observed. For example, one customer was using a PIC16F688 with an ICD2 and programmed the configuration bits to set the part to internal MCLR and internal oscillator mode. They also had code configured to write to the EEPROM memory on startup. The result was the EEPROM was written before the ICD2 could verify the EEPROM, and the device would appear to fail verify for what seemed like a mysterious reason. Disabling either or both internal options (setting them for external mode) cleared up the issue. In other cases, a customer may find that the device can only be programmed with their code one time, and after that, the device will not respond to further programming attempts. Most likely they read an unusual target ID such as 0x0 or 0x3FF from the ICD2 unit. This is because when their code ran, it set the pins used for programming (usually GP0 and GP1 or RA0 and RA1) to outputs, and this conflicted with the programming sequence. The conflict occurs since the part start up faster than the programming sequence from the ICD2. The end result is the part can not be reprogrammed unless a different programmer, such as a PM3 is used. The other programmer is needed, since it can control Vdd directly and prevent the part from starting up before its programmed. As mentioned earlier, the ICD2 does not control Vdd directly, and even if it is programmed to supply Vdd, it does not control the time the Vdd appears to the device. A good workaround to this is to either not use both internal MCLR and internal RC oscillator mode. However, if that is not a reasonable solution, than another good option is to simply program a small delay into the code that the PIC will run on startup. The delay will prevent the I/O lines from becoming outputs too soon after power-up and that will allow the ICD2 to still be able to reprogram the device. Finally, if that is also not an option for your design, use a production programmer such as a PM3. You can find out more about the PM3 at: http://www.microchip.com/PM3
發表於: 2007/2/24 1:49
|
|||
|