CONFIG issues with 18F26K22


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    May 2009
    Location
    Saint-Quentin-en-Yvelines, FRANCE
    Posts
    80

    Default CONFIG issues with 18F26K22

    Hi everybody,

    I am trying to replace a 18F2685 by an 18F26K22 on an old design.
    Everything should be compatible providing a correct configuration of my new PIC.
    But the new CONFIG is more complex than with the old one.

    Moreover I need to use a PicKit3 instead of a PicKit2 but this should not be a problem.

    I am using an external 8 MHz xtal and I do not need any BOR reset, stack overflow reset, watch dog, etc..
    I do not care about code protection

    I have built my CONFIG accordingly with the help of the .INFO file.

    I can program my device, but the program does not work.
    When I try to debug, MPLAB IDE slows, sometime hangs, and after a few seconds displays a message :

    PK3Err0040: The target device is not ready for debugging.
    Please check your configuration bit settings and program
    the device before proceeding.
    I suspect that my CONFIG is not appropriate. Please see the attached file.

    I am surprised by at least two things :
    IESO is OFF by default. Am I right if I set it ON ?
    What about DEBUG. ON, OFF, managed by the debug program ?

    I have tryied several combinations but no way.

    Can you see any obvious issue in my CONFIG file ?

    Thank you for your help.

    MikeBZH
    Attached Files Attached Files

  2. #2
    Join Date
    Aug 2011
    Posts
    412


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    I'd try changing these to start with:
    Code:
      CONFIG PLLCFG = OFF       ; Oscillator used directly
      CONFIG IESO = OFF         ; Oscillator Switchover mode disabled
      CONFIG DEBUG = OFF        ; Disabled
    DEBUG is controlled from within MPLAB when you program it for debugging.

    Usually "The target device is not ready for debugging" is an osc issue.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    FWIW if you want to use your Pickit2, heres a modified PK2DeviceFile which can programme 18F26K22 and a couple of simple apps for manipulating the dat file.
    Attached Files Attached Files
    Last edited by towlerg; - 5th April 2018 at 22:04.
    George

  4. #4
    Join Date
    May 2009
    Location
    Saint-Quentin-en-Yvelines, FRANCE
    Posts
    80


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    Many thanks tumbleweed, it works now !

    I can't understand why Microchip make such complex thinks sometimes
    "Keep it simple" should be the rule !

    George, would your mods for the PicKit2 provide also the debug capability or only programming ?

    Best regards
    MikeBZH

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    @Mike. No, just stand alone PK2cmd.exe and Pickit2v2.exe.

    For what it's worth the config I use (in Proton but easily transposed)
    Code:
    	' internal clock 16MHz with 4xPLL = 64MHz
      $if _device = _18F26K22
      	Config_Start
      	  FOSC = INTIO67	   ; Internal oscillator block
      	  PLLCFG = On	       ; Oscillator multiplied by 4
      	  PRICLKEN = On	     ; Primary clock enabled
      	  FCMEN = OFF	       ; Fail-Safe Clock Monitor disabled
      	  IESO = OFF	       ; Oscillator Switchover mode disabled
      	  PWRTEN = On	       ; Power up timer enabled
      	  BOREN = On	       ; Brown-out Reset enabled and controlled by software (SBOREN is enabled)
      	  BORV = 285	       ; VBOR set to 2.85 V nominal
      	  WDTEN = OFF	       ; Watch dog timer is always disabled. SWDTEN has no effect.
      	  WDTPS = 32768	     ; 1:32768
      	  CCP2MX = PORTC1	   ; CCP2 input/output is multiplexed with RC1
      	  PBADEN = OFF	     ; PORTB<5:0> pins are configured as digital I/O on Reset
      	  CCP3MX = PORTB5	   ; P3A/CCP3 input/output is multiplexed with RB5
      	  HFOFST = On	       ; HFINTOSC output and ready status are not delayed by the oscillator stable status
      	  T3CMX = PORTC0	   ; T3CKI is on RC0
      	  P2BMX = PORTB5	   ; P2B is on RB5
      	  MCLRE = INTMCLR	   ; RE3 input pin enabled; MCLR disabled
      	  STVREN = On	       ; Stack full/underflow will cause Reset
      	  LVP = OFF	         ; Single-Supply ICSP disabled
      	  XINST = OFF	       ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
      	  Debug = OFF	       ; Disabled
      	  Cp0 = OFF	         ; Block 0 (000800-003FFFh) not code-protected
      	  CP1 = OFF	         ; Block 1 (004000-007FFFh) not code-protected
      	  CP2 = OFF	         ; Block 2 (008000-00BFFFh) not code-protected
      	  CP3 = OFF	         ; Block 3 (00C000-00FFFFh) not code-protected
      	  CPB = OFF	         ; Boot block (000000-0007FFh) not code-protected
      	  CPD = OFF	         ; Data EEPROM not code-protected
      	  WRT0 = OFF	       ; Block 0 (000800-003FFFh) not write-protected
      	  WRT1 = OFF	       ; Block 1 (004000-007FFFh) not write-protected
      	  WRT2 = OFF	       ; Block 2 (008000-00BFFFh) not write-protected
      	  WRT3 = OFF	       ; Block 3 (00C000-00FFFFh) not write-protected
      	  WRTC = OFF	       ; Configuration registers (300000-3000FFh) not write-protected
      	  WRTB = OFF	       ; Boot Block (000000-0007FFh) not write-protected
      	  WRTD = OFF	       ; Data EEPROM not write-protected
      	  EBTR0 = OFF	       ; Block 0 (000800-003FFFh) not protected from table reads executed in other blocks
      	  EBTR1 = OFF	       ; Block 1 (004000-007FFFh) not protected from table reads executed in other blocks
      	  EBTR2 = OFF	       ; Block 2 (008000-00BFFFh) not protected from table reads executed in other blocks
      	  EBTR3 = OFF	       ; Block 3 (00C000-00FFFFh) not protected from table reads executed in other blocks
      	  EBTRB = OFF	       ; Boot Block (000000-0007FFh) not protected from table reads executed in other blocks
      	Config_End
      $endif
    George

  6. #6
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    MikeBZH, Here is the config I use for almost all of my 26K22 projects: 64Mhz internal OSC.

    #CONFIG
    ;----- CONFIG1H Options --------------------------------------------------
    __config _CONFIG1H, _FOSC_INTIO7_1H & _PLLCFG_ON_1H & _PRICLKEN_ON_1H & _FCMEN_ON_1H & _IESO_OFF_1H
    ;----- CONFIG2L Options --------------------------------------------------
    __config _CONFIG2L, _PWRTEN_ON_2L & _BOREN_ON_2L & _BORV_190_2L
    ;----- CONFIG2H Options --------------------------------------------------
    __config _CONFIG2H, _WDTEN_OFF_2H & _WDTPS_32768_2H
    ;----- CONFIG3H Options --------------------------------------------------
    __config _CONFIG3H, _CCP2MX_PORTB3_3H & _PBADEN_OFF_3H & _HFOFST_OFF_3H & _T3CMX_PORTB5_3H & _MCLRE_EXTMCLR_3H
    ;----- CONFIG4L Options --------------------------------------------------
    __config _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
    #ENDCONFIG
    Dave Purola,
    N8NTA
    EN82fn

  7. #7
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    If you are really using a crystal then you need FOSC = LP (or the correct setting for a low power crystal with your device.)
    Your file is set for a medium power high speed resonator

  8. #8
    Join Date
    Aug 2011
    Posts
    412


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    LP, XT, and HS settings are all for use with crystals.
    See section 2.5.3 in the datasheet.

  9. #9
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    Tumbleweed - You're right - I should have looked it up instead of going by memory.

Similar Threads

  1. DT_INTS and 18F26k22
    By Mike2545 in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 9th September 2017, 16:08
  2. 12F1840 config issues
    By enigma in forum PBP3
    Replies: 13
    Last Post: - 15th February 2015, 07:49
  3. 18F26K22 slow startup
    By Tobias in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 7th January 2014, 22:10
  4. Compiling for 18F26K22 - Does anyone have a solution for me?
    By Balachandar in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th August 2012, 12:49
  5. 12c508a Device Config. And Burning Issues
    By sayzer in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th March 2006, 16:50

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts