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.

problem debugging pic18f4550

Status
Not open for further replies.

eanema

Member level 2
Joined
Sep 30, 2009
Messages
43
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,740
I am have having problems entering into debug mode. I am using a test application (shown below) to simply turn on a few LEDs. I am using the linker script '18F4550i.lkr'

The 18F4550 is on a bread board with a minimal configuration.
-It is powered from the ICD2 unit
-It has a 4 MHz crystal configured (i know the osc is good because it works fine when its program with stand alone code)
-It has a 10k pull up resistor on MCLR
-it has MCLR, PGM, and PGC connected to the IDC2 header

The problem is this:
When I configure the device to use the internal oscillator (#pragma config FOSC = INTOSC_HS) every thing works fine, but when I change the configuration to the high speed oscillator (#pragma config FOSC = HSPLL_HS) I get the error:

Programming Target...
...Validating configuration fields
...Erasing Part
...Programming EEPROM Memory
...Programming Program Memory (0x0 - 0x13F)
...Loading DebugExecutive
...Programming DebugExecutive
...Programming Debug Vector
...Programming RSBUG
Verifying...
...Program Memory
...EEPROM
...Debug Executive
...Debug Vector
...Verify Succeeded
Programming Configuration Bits
.. Config Memory
Verifying configuration memory...
...Verify Succeeded
Connecting to debug executive
ICD0083: Debug: Unable to enter debug mode. Please double click this message for more information.


This doesn't make a whole lot of sense to me, so any advise would be helpful. I've spent the past 8 hours trying to figure this out.



#pragma config PLLDIV = 1 // 4MHz crystal
#pragma config CPUDIV = OSC1_PLL2
#pragma config USBDIV = 2 // Clock source from 96MHz PLL/2
#pragma config FOSC = INTOSC_HS // HSPLL_HS
#pragma config FCMEN = OFF
#pragma config IESO = OFF
#pragma config PWRT = OFF
#pragma config BOR = ON
#pragma config BORV = 3
#pragma config VREGEN = OFF //USB Voltage Regulator
#pragma config WDT = OFF
#pragma config WDTPS = 32768
#pragma config MCLRE = ON
#pragma config LPT1OSC = OFF
#pragma config PBADEN = OFF
#pragma config CCP2MX = OFF
#pragma config STVREN = ON
#pragma config LVP = OFF
#pragma config ICPRT = OFF // Dedicated In-Circuit Debug/Programming
#pragma config XINST = OFF // Extended Instruction Set
#pragma config CP0 = OFF
#pragma config CP1 = OFF
#pragma config CP2 = OFF
#pragma config CP3 = OFF
#pragma config CPB = OFF
#pragma config CPD = OFF
#pragma config WRT0 = OFF
#pragma config WRT1 = OFF
#pragma config WRT2 = OFF
#pragma config WRT3 = OFF
#pragma config WRTB = OFF // Boot Block Write Protection
#pragma config WRTC = OFF
#pragma config WRTD = OFF
#pragma config EBTR0 = OFF
#pragma config EBTR1 = OFF
#pragma config EBTR2 = OFF
#pragma config EBTR3 = OFF
#pragma config EBTRB = OFF




#include <p18cxxx.h>

void main (void) {

TRISD=0x00; //turn on some LEDs
PORTD=0xff;

Nop();
Nop();

while (1);

}
 

Hi,

Just a guess - not familiar with C or ICD2 but being as it looks like its trying to involke Debugger why not ensure the debug bits in the config are off _DEBUG_OFF_4L and ICPRT = OFF
 

Thanks for the input. I changed the relevant #pragma config statements to read:

#pragma config ICPRT = ON // Dedicated In-Circuit Debug/Programming
#pragma config DEBUG = ON // Enable Debug Mode

(and of course verifying that the config bits were actually written as expected)
Under these conditions, neither the internal oscillator nor the 4 MHz crystal could enter the debug mode. When I changed the config bits to:

#pragma config ICPRT = OFF // Dedicated In-Circuit Debug/Programming
#pragma config DEBUG = ON // Enable Debug Mode

Only the internal oscillator worked. When configured with the 4 MHz crystal, it could not enter debug mode. Same error as above.

Any and all help would be appreciated.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top