ICSP CableSoftware for NSDSP Source Code Supported Devices
ICSP Cable Requirements
ICSP cable consists of 6 lines - MCLR, VDD, VSS, PGD, PGC, and optional LVP. Of these lines, PGD and PGC are the most important because they carry high frequency signals. It is important to make sure that these signals are not disturbed. If the lines are connected with short straight PCB traces or with short 2-3 inch (5-7cm) length of cable, the interface should work without any problems. However, if a longer cable is required, extra care may be needed to ensure reliable operations.
ICSP programming and debugging algorithms are very unforgiving. If a programmer loses synchronization with the target device, the whole operation must be started over. Therefore, any noise on PGC or PGD lines may lead to very unreliable operations. Thus, it is important to keep PGC and PGD lines noise free. In noisy environment, the best defence is to keep the lines as short as possible.
In extreme cases, small capacitors may be installed on the lines to filter out high frequency noise. We recommend a small 20pF capacitor between PGC and VSS and a small 20pF capacitor between PGD and VDD. Do not install the capacitors unless they are absolutely necessary.
NSDSP can tolerate some small stray capacitance between PGC or PGD line and the ground, however such capacitance may make high frequency communications impossible. In this case, you may solve the problem by lowering the communication speed. By default, NSDSP uses 6MHz signaling speed. In case of failures, NSDSP software will lower the speed automatically. However, it may be beneficial to specify the desired speed manually.
PGC and PGD crosstalk
Crosstalk is the coupling of signal from one line to another. If the target device drives PGD line too fast it may produce a spike on PGC line. Such spike will be seen by the target device as an extra clock beat, which immediately leads to desynchronisation between a programmer and the target devices.
Most PIC devices do not produce any significant crosstalk even with relatively long cables, however, some of the devices produce strong crosstalk. Visit the supported devices section, find your device and read notes to see if your device is one of them.
The best way to eliminate crosstalk is to keep the cable length as short as possible. With longer cables, you can make one of the two adjustments described below.
Depending on the timing, crosstalk may not be harmful. The spike induces by PGD transition may coinsides with a clock edge or may be very close to it. In such case, it may not produce extra clock pulses. Therefore, at certain signaling speeds, crosstalk does not pose a problem. It may be possible to find programming speed which completely eliminates harmful crosstalk effects. Speeds from 3MHz to 6MHz are most tolerant to crosstalk. At lower speeds, harmful effects of crosstalk are much more pronounced.
You can also use the method proposed by Olin Lathrop. He suggests installing a small capacitor between PGC and VSS. Since NSDSP runs faster than Olin's programmer, the values of the capacitors must be lowered. This decreases the effectiveness of the method. Even though in most cases a small 20pF capacitor is enough, extreme scenarios may require bigger capacitors. You can install bigger capacitors, but you will need to decrease your communication speed as shown in the table below:
|Capacitor between PGC and VSS||Maximum achievable speed|
Longer cables make PGD and PGC lines more susceptible to noise and crosstalk. They also may introduce stray capacitance and wire inductance. Except for these effects, cable length itself doesn't pose a problem. Therefore, it is possible to use cables longer than is usually suggested for ICSP. However, if using longer cables, the harmful factors listed above must be controlled.
We have tested Dupont jumper wire cables of different length from one foot (30cm) to 7ft (2m) in low noise environment. We used six different PICs from different families from PIC16 to PIC32MZ.
Cables up to 2ft (60cm) long didn't cause any degradation. All PICs could be programmed at 6MHz without problems.
Longer cables didn't work at 6MHz any more. For such cables, the programming speed had to be reduced. In some cases, we had to install capacitors between PGC and VSS on the PIC side of the cable as explained above.
With 7ft (2m) cables, depending on the PIC, we were able to achieve programming speeds from 1MHz to 3MHz. It is likely that longer cables would work too, but at yet lower speeds. However, we haven't tested any cables longer than 7ft.
© 2007-2018 Northern Software Inc. All Rights Reserved.