View previous topic :: View next topic |
Author |
Message |
future
Joined: 14 May 2004 Posts: 330
|
ICD and CCS, No NOP at address 0 |
Posted: Mon Aug 21, 2006 11:56 am |
|
|
Hi,
I have just spent a day fighting with this icd
I think I should see a NOP at address 0, but there is a goto main.
#device ICD=TRUE is there and also #fuses DEBUG.
It is PCH 249 and a 18f452.
Am I missing something?
Thank you. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Aug 21, 2006 3:14 pm |
|
|
I did a test with vs. 3.249 and I notice the compiler only puts in a NOP
for the 16F series.
The ICD2 help file in MPLAB says this:
Quote: |
Also, if you are using PIC16F87X device, the first program memory
location (address 0x0000) must be a NOP instruction or you will not be
able to single step past location zero. |
It doesn't mention that it's needed for the 18F series.
Why do you want a NOP at address 0x0000 ? Is it just because you
think it's required, or is it for this reason:
Quote: |
Q: When setting a breakpoint at the first location in my program, why
does it stop at address 0001 rather than 0000?
A: MPLAB ICD 2 stops at the instruction after the breakpoint. This means
that a breakpoint at address 0000 will be executed, then the program
counter will be pointing at address 0001 when it gets a breakpoint. If a
user needs to stop at the first instruction in their code, they must put a
NOP at address 0000. |
If so, see these threads:
http://www.ccsinfo.com/forum/viewtopic.php?t=25850&highlight=nop
http://www.ccsinfo.com/forum/viewtopic.php?t=18479&highlight=nop |
|
|
future
Joined: 14 May 2004 Posts: 330
|
|
Posted: Mon Aug 21, 2006 8:22 pm |
|
|
It is because sice I bought the ICD2, I have used it only for programming... warranty is over now, and I can't debug.
It programs, reads and verify perfectly, it even program as a debugger, but refuses to debug giving me an error like Device is not in debug mode. |
|
|
future
Joined: 14 May 2004 Posts: 330
|
|
Posted: Thu Aug 24, 2006 12:48 pm |
|
|
Really interesting... the icd2 does not need the NOP thing.
The source of my problem is that I can not have a filter capacitor for the PIC, really weird.
I built a simple test circuit, a pic18/crystal/22pF caps... all powered by the icd. It debugs right until I connect a 47uF cap in parallel with the 5V source. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Aug 24, 2006 1:13 pm |
|
|
Do you have the ICD (from CCS) or the ICD2 (from Microchip) ?
You're using the two names in the same post, but they are different units.
Quote: |
I built a simple test circuit, a pic18/crystal/22pF caps... all powered by
the icd. It debugs right until I connect a 47uF cap in parallel with the 5V
source |
The reason is because you're using the debugger to supply the Vdd.
The 18F452 programming specification shows that there must be a
minimum setup time of 100ns for Vdd going high before Vpp goes high.
The 47uf capacitor on Vdd probably slows down the rise of the Vdd power
supply by too much. It violates the spec. |
|
|
future
Joined: 14 May 2004 Posts: 330
|
|
Posted: Thu Aug 24, 2006 2:59 pm |
|
|
I have the ICD2 from microchip.
The reason is because you're using the debugger to supply the Vdd. Quote: |
Even if I connect the cap while mplab is stepping through the code? |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Aug 24, 2006 3:48 pm |
|
|
I have never used the ICD2 to supply power to the target board.
My target boards always have their own power. So I have no
experience with the possible limitations of the ICD2 when used this way.
It's possible that people on the ICD2 forum can help:
http://forum.microchip.com/tt.aspx?forumid=49
1. Tell them the amount of current (in milli-amps) that your target board
is using.
2. Tell them if you are using the external power supply for the ICD2,
or is power coming only from the USB connector.
3. Also, tell them where the host USB connector is located.
Is it on a laptop, or a PC, or an add-on hub attached to PC ?
4. Tell them the revision of your ICD2. It's on a sticker on the back
side. Mine says "R15" (after the part number).
5. Tell them your version of MPLAB.
They will need all this information to answer the problem.
But before you do that, read this thread on the ICD2 forum.
They talk about how certain versions of MPLAB and ICD2 don't work
properly together in debug mode.
http://forum.microchip.com/tm.aspx?m=133910&mpage=1&key=R15𠼱
Also, I believe I have read on that forum that sometimes Microchip
tech support will just agree to fix hardware or replace it, without
regard to warranty. For example, if an older revision doesn't work
with the current MPLAB, they might fix it for free. I think I have seen
this happen on that forum. |
|
|
future
Joined: 14 May 2004 Posts: 330
|
|
Posted: Fri Aug 25, 2006 8:16 pm |
|
|
Problem found. A logic level FET was still connected to RB6. Only debugging was affected.
I thougth that a high impedance load would not affect the communication.
Thank you very much. |
|
|
MGP
Joined: 11 Sep 2003 Posts: 57
|
|
Posted: Sat Aug 26, 2006 9:33 am |
|
|
You are saying you had the gate of a logic level FET tied to RB6 and it stopped the ICD from communicating with the PIC?
If so, it certainly wasn't the input impedance of the FET. The FET will have an almost infinite (for all practical purposes) input impedance. Depending on the FET, it was more likely the gate capacitance that caused your problem.
A really large Id capable FET will have several thousand pF of gate capacitance where a smaller FET may only be a few 100 pF.
The ICDs can drive a fairly low impedance -- my current PIC design has 10K pulldowns (for a keypad) on RB6 and RB7 and it causes the ICD no problems for programming or debugging. There is no additional capacitance on the signals except for about 10 pF from a TVS device used for transient protection on the keyboard lines. |
|
|
future
Joined: 14 May 2004 Posts: 330
|
|
Posted: Sat Aug 26, 2006 3:24 pm |
|
|
MGP wrote: | You are saying you had the gate of a logic level FET tied to RB6 and it stopped the ICD from communicating with the PIC?
|
Yes, it is a 7 amp logic level FET. It affected only debugging, programming and verifying was working fine. |
|
|
|