View previous topic :: View next topic |
Author |
Message |
JerryR
Joined: 07 Feb 2008 Posts: 164
|
Debug problem with PIC18LF14K22 MPLAB-ICD3 |
Posted: Mon May 23, 2011 5:19 pm |
|
|
Hello:
Just upgraded to latest PCWH to start new project using a 18LF14K22. Using MPLAB with ICD3. Used PIC WIzard from PCWH to generate a starting point for h and c files.
MPLAB/ICD3 "see" the target, but get a ICD3Err0040: The target device is not ready for debugging." response when attempting to run. Programmed before attempting first run.
Using an internal oscillator on target selecting 8MHz. No other unusual hardware interfacing the PIC. Pretty simple.
Heres the source code:
Code: |
c file:
#include <main.h>
void main()
{
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
setup_oscillator(OSC_8MHZ|OSC_INTRC|OSC_31250|OSC_PLL_OFF);
}
Header file:
#include <18LF14K22.h>
#device ICD=TRUE
#device adc=16
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOPLLEN //4X HW PLL disabled, 4X PLL enabled in software
#FUSES NOFCMEN //Fail-safe clock monitor disabled
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#use delay(int=8000000)
#define Cal_Prompt PIN_A5
#use rs232(baud=1200,parity=N,xmit=PIN_B7,bits=8,stream=RF_Out)
#use i2c(Master,Fast,sda=PIN_B4,scl=PIN_B6,force_hw)
|
Power is good on target, debugger good with other project targets. Code compiles fine. Could this be an oscillator problem?
Anyone have known good fuse definitions for a 18LF14K22 with an internal oscillator? See anything wrong in my (Wizard's) fuses?
Thanks for the input! |
|
![](templates/subSilver/images/spacer.gif) |
JerryR
Joined: 07 Feb 2008 Posts: 164
|
Another hint |
Posted: Mon May 23, 2011 5:38 pm |
|
|
Here's something else I just noticed, the target will program and code runs fine...just can't debug. Sound familiar anyone? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon May 23, 2011 5:46 pm |
|
|
Have you set the Debug/Release drop-down box at the top of the MPLAB
IDE for "Debug" ? I never use "#device ICD=TRUE" with MPLAB.
Have you selected "18LF14K22" in the Configure/Select Device menu ?
In the Configure/ Configuration Bits menu, is the tickbox enabled for
"Configuration Bits set in code" ? It should be. Look at the Config bits
listed by MPLAB. Do they match your #fuses settings ? |
|
![](templates/subSilver/images/spacer.gif) |
JerryR
Joined: 07 Feb 2008 Posts: 164
|
|
Posted: Mon May 23, 2011 6:03 pm |
|
|
Thanks for the input PCM.
Yes, in Debug
Yes, 18LF14K22 selected
Yes, Configuration Bits set in code is ticked and fuses match code.
Any other leads? |
|
![](templates/subSilver/images/spacer.gif) |
|