Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Pic Kit3 Debugging Problem with PIC18F4550???

Status
Not open for further replies.

xpress_embedo

Advanced Member level 4
Joined
Jul 5, 2011
Messages
1,154
Helped
161
Reputation
396
Reaction score
189
Trophy points
1,353
Location
India
Activity points
10,591
Hello!! i just purchased Pic Kit 3 and programming is working perfectly...

But i had purchased it for debugging application...

And i don't know how to solve this problem..

Its giving Error 40... Check your Configuration bits so on....like that...

Here is my Code:-

Code:
#include <p18f4550.h>
#include <delays.h>

/*******Configuration Settings********/
#pragma config PLLDIV = 5		//To be changed when different value crystal is used
#pragma config USBDIV = 2
#pragma config CPUDIV = OSC1_PLL2
#pragma config FOSC = HSPLL_HS	//To be changed when different value crystal is used
#pragma config FCMEN = OFF
#pragma config PWRT = OFF
#pragma config BOR = OFF
#pragma config WDT = OFF
#pragma config PBADEN = OFF
#pragma config LVP = OFF
#pragma config DEBUG = ON
#pragma config MCLRE = ON
#pragma config ICPRT = ON
/*************************************/

void Delay_ms(unsigned int time);


void main()
{
	TRISB = 0x00;
	TRISC = 0x00;
	LATB = 0x00;
	while(1)
	{
		LATC = 0x55;
		LATB = 0x55;
		Delay_ms(1000);
		LATB = 0xAA;
		LATC = 0xAA;
		Delay_ms(1000);
	}
}

void Delay_ms(unsigned int time)
{
	unsigned int i;
	unsigned int t;
	for(i=0;i<time;i++)
	{
		for(t=0;t<650;t++)
			Delay1TCY();
	}	
}


But its not working for debugging...
how to use debugging feature
 

Couple of quick questions:

1. Are you compiling the code with the Build Configuration selected as Debug? Or Release?


2. Could there be any connection conflicts with RB6 and RB7? Can you provide a schematic?


3. What version of MPLAB and C18 compiler are you currently using?


4. Is the PICkit genuine or a clone?


BigDog
 
Couple of quick questions:

1. Are you compiling the code with the Build Configuration selected as Debug? Or Release?


2. Could there be any connection conflicts with RB6 and RB7? Can you provide a schematic?


3. What version of MPLAB and C18 compiler are you currently using?


BigDog


I am using Debug Build Configuration not release one...
i am using mplab v3.40

and yes RB6 is connected with MAX232

I have use RB6 as Transmit Pin for Software UART...

Is there any problem in doing so...
Snap.PNG

Schematic is present above, sorry i have not connected max232 in the above diagram..
Pls help
 

Can I ask, are the programming pins part of PORTB?
if so
Code:
TRISB = 0x00;
TRISC = 0x00;

Would make the PORTB6&7 (PGD and PGC) "move" and screw up debugging.... Just to test, try { TRISB=0xC0; } and see if it'll debug... I've not got one to hand to test it... I always try and leave the pgm/debug lines clear of anything if it's going to be debugged, but could be wrong (BD ;-))
NEAL
 
i am using mplab v3.40


1. You need to upgrade the MPLAB IDE to a more recent version, I'm not sure v3.40 even supports the PICkit3. I'm currently at MPLAB v8.70.

I would also recommend upgrading the Microchip C18 to the latest revision as well.


and yes RB6 is connected with MAX232

I have use RB6 as Transmit Pin for Software UART...

Is there any problem in doing so...
View attachment 78989

Schematic is present above, sorry i have not connected max232 in the above diagram..


2. Essential both RB6/PGC and RB7/PGD must be kept free during either ICSP (Programming) or ICD (Debugging).

Therefore, you will need to free both RB6 and RB7 from other tasks and remove/reassign any connections to external components which could interfere with the ICSP or ICD tasks.


Reference: PIC18F2455/2550/4455/4550 Data Sheet, Section: 10.2 PORTB, TRISB and LATB Registers, Table: TABLE 10-3: PORTB I/O SUMMARY, Page: 118

Note 3: All other pin functions are disabled when ICSP™ or ICD operation is enabled.


BigDog
 
1. You need to upgrade the MPLAB IDE to a more recent version, I'm not sure v3.40 even supports the PICkit3. I'm currently at MPLAB v8.70.

I would also recommend upgrading the Microchip C18 to the latest revision as well.





2. Essential both RB6/PGC and RB7/PGD must be kept free during either ICSP (Programming) or ICD (Debugging).

Therefore, you will need to free both RB6 and RB7 from other tasks and remove/reassign any connections to external components which could interfere with the ICSP or ICD tasks.


Reference: PIC18F2455/2550/4455/4550 Data Sheet, Section: 10.2 PORTB, TRISB and LATB Registers, Table: TABLE 10-3: PORTB I/O SUMMARY, Page: 118




BigDog

Sorry BigDog i forget to tell MPLAB Version its 8.83 much newer(not that much old)
While my MPLAB C18 Compiler version is 3.40 and now 3.43 is in market so i think i having that too new....

From the above discussion it looks like that, its the issue due to the Programming and Debugging pins RB6 and RB7 i will try to change these pins..


I will report soon if it works.....
Thanks for your help

- - - Updated - - -

Can I ask, are the programming pins part of PORTB?
if so
Code:
TRISB = 0x00;
TRISC = 0x00;

Would make the PORTB6&7 (PGD and PGC) "move" and screw up debugging.... Just to test, try { TRISB=0xC0; } and see if it'll debug... I've not got one to hand to test it... I always try and leave the pgm/debug lines clear of anything if it's going to be debugged, but could be wrong (BD ;-))
NEAL

Thanks ..

I will try to implement this sooon and will report back at this thread
 

:) We'll get you there mate, don't worry, you're in the best of places!!
I found all sorts of strange things can screw up debugging sessions, changing the OSCCon value on a 16f723 is one example that foxed me for a while... :-| If I'm using the whole of PORTB I normally put 2 jumpers in for the programming pins for isolating them from their loads while its programming... SMD-DIP-switches would be ideal, but I've not scrapped any printers recently and haven't come accross them....

I'm just discovering the release MPLABX isn't going to work with my MCD2 so looks like a PK3 is my next choice...
And I've got a BIG LOAD of sample PICs (A BIG THANKS "MICROCHIP.Com's Sample", I AM YOUR BIGGEST FAN!), 16F88's, 24FJ & HJ, DSPIC33's and 32Mx's to "play with" so if we get you working on this I'll "vow" to get one :)

Cool matey
NEAL
 

Thanks for your help....

My Problem gets solved....

I changed two config settings

#pragma config DEBUG = OFF
#pragma config MCLRE = ON

My Debugger is working now

Strange thing is that
DEBUG = OFF not ON

setting it to ON doesn't works

only OFF is working perfectly
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top