• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Using MPLAB/Junebug ICSP to Debug

Status
Not open for further replies.

SPDCHK

Member
Excuse my ignorance but...

This will be my first attempt at using the Debug function of MPLAB via Junebug. I design all my circuits to be programmed via the ICSP, but I never considered incorporating RB6 and RB7 in such a manner that they can be used during debugging



According to this diagram, I must allow for isolation of RB6 and RB7, and according to the "In Circuit Serial Programming guide" DS30277D, I must assign RB6 as being input only, but from what I understand, RB7 can be either Input or Output.



My questions are...

  1. What do they mean with "ISOLATION"? Is this just a resistor or a diode?
  2. Can I still use RB6/RB7 for normal I/O but just follow the rules as identified above
  3. What do I need to setup in MPLAB V8.10 to make full user of the debugging functionality?

Thank you
 

blueroomelectronics

Well-Known Member
It boils down to loading the pins. ICP is very fast hence the short cable length.
I often use PGC & PGD as pushbutton inputs if I just have to use every single io pin. Of course the pins are disabled by the debug mode.
 

SPDCHK

Member
Of course the pins are disabled by the debug mode.
So when I use debug, I/O Pins RB6 and RB7 will not operate as per normal? Only once debugging is stopped? Do I understand you correctly?
 

3v0

Coop Build Coordinator
Forum Supporter
If you only connect RB6 and 7 to the ICSP there is nothing else to do. Pick the PICkit2 as the debugger (instead of programmer) in MPLAB and you are up and running.

With In Circuit Programming it is possible to use these pins for IO if you follow the rules. During debug these pins are used for run control and sending debug info only.

That is the short of it. Read the datasheet for more accurate info.

3v0
 

SPDCHK

Member
I thought I might first try debugging on one of the smaller PIC's 12F675. In this case GP1 = PGC, GP0 = PGD and GP3 = Vpp(MCLR).

I've selected MPLAB Debugger tool for PicKit2.

My fuses are set for __CONFIG 0x31F4, (InternalRC, No WDT, MCLR Pin Enabled, Code protect off, Data protect off)

When programming the PIC normally, it operates 100% (simple flashing LED),
But when I try to access degug mode, I get the following error message ...

Programming Target (14-Apr-2009 21:32:13)
Erasing Target
Programming Program Memory (0x0 - 0x29)
Verifying Program Memory (0x0 - 0x29)
Programming User ID Memory
Verifying User ID Memory
Programming Debug Executive (0x-300 - 0x3FF)
Verifying Debug Executive (0x300 - 0x3FF)
Programming Debug Vector
Verifying Debug Vector
Programming Configuration Memory
Verifying Configuration Memory
PK2Error0028: Unable to enter debug mode
NOTE: This device requires an ICD Header for debug. See "Header Specification" DS51292.
PICkit 2 Ready
By Googling "12F675 "Header Specification" DS51292", I managed to come to this site, "EDABOARD" where I read this little bit of text

* These devices require a header board to be able to debug the device. See the Header Board Specification (DS51292) for more information. This document is available in the “Downloads” section of the PICkit 2 web page.
NOTE: To connect PICkit 2 to a debug header board requires the AC164110 RJ-11 to ICSP Adapter.
Do I seriously need this AC164110 adaptor?

Seems like its more troublesome than useful this debugging business :mad:

I'd rather stick with normal simulation as I've been doing for the past 5 years :confused:
 

SPDCHK

Member
... and PIC's 16F628A & 16F877. Will they work?

Let me rephrase the question...

Can you possibly give a link or a list of all the PIC's the Junbebug will support debugging via MPLAB?
 
Last edited:

3v0

Coop Build Coordinator
Forum Supporter
There are huge number of chips. It looks like you can not debug with the 18 pin 16F628A (as per datasheet) but you can with the 16F88 and all 18F chips that I have used. 18F1320 and 18F1330. I expect all 18F chips and all newer 16F 18 pin and greater have debug.
 
Last edited:

SPDCHK

Member
... like I said in the very first post, excuse my ignorance, but then, there's no excuse for not doing the "RTFM" thing :D (RTFM = Read The F.... Manual)

Each PIC's datasheet clearly states if it does or does not support debugging. You just need to know where to look for that information in the datasheet (like I do now)

Thanks for the replies.
 

Pommie

Well-Known Member
Most Helpful Member
The 877 has debug built in however the 628A doesn't and requires a header. To check which chips need headers go into MPLAB, select the chip in question and it will tell you if a header is required. The newer 16F88 is an 18 pin device that does have the debugger built in.

Mike.
 

SPDCHK

Member
The 877 has debug built in however the 628A doesn't and requires a header. To check which chips need headers go into MPLAB, select the chip in question and it will tell you if a header is required. The newer 16F88 is an 18 pin device that does have the debugger built in.
Mike.
The AC164110 header adaptor uses an RJ-11 connection, (something the Junebug does not allow for). Is there something else available that can be used i.s.o. aforementioned header adaptor that can be used with Junebug?

Yes, I noticed in the 16F628A datasheet that it does not support debugging without the header adaptor.
 

blueroomelectronics

Well-Known Member
I pulled the debug PIC from the header and built a small PCB with a 2x5 header to play with the 12F675.
You could also use a 16F88 and connect similar I/O to the target. It's a kludge but I've done that too.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top