• AVR Freaks

Helpful ReplyHot!Debug & programming work on PIC18LF25K83 but not on PIC18LF26K83

Author
AxlTxl
New Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2014/11/05 03:13:08
  • Location: 0
  • Status: offline
2020/10/28 16:11:16 (permalink)
0

Debug & programming work on PIC18LF25K83 but not on PIC18LF26K83

Hi!

I'm working on a project born on a PIC18LF25K83 but due to the new features it would max out the FLASH memory, so we moved to PIC18LF26K83.
And here comes the funny part:
1) we changed the device on the board and flashed the code, it worked.
2) later I needed to run it in debug mode to check some things and it didn't worked. Checked few things: the device wasn't erased.
3) I tried to program it in runtime mode, it didn't worked.
*****************************************************

Connecting to MPLAB PICkit 3...

Currently loaded firmware on PICkit 3
Firmware Suite Version.....01.51.08
Firmware type..............Enhanced Midrange

Target voltage detected
Target device PIC18LF26K83 found.
Device ID Revision = a002

The following memory area(s) will be read:
EEData memory

Device Erased...

Programming...

The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0x8b7f
configuration memory
EEData memory
User Id Memory
program memory
Address: 54 Expected Value: ef9d Received Value: ef14
Failed to program device
4) I changed the device in the project properties back to PIC18LF25K83, rebuild the project and flashed: it worked.
 
Same environment, same configuration bits, same compiler, same programmer, same board, same device.
 
Here are the configuration bits:

// PIC18LF26K83 Configuration Bit Settings

// 'C' source line config statements

// CONFIG1L
#pragma config FEXTOSC = XT     // External Oscillator Selection (XT (crystal oscillator) above 100 kHz, below 8 MHz; PFM set to medium power)
#pragma config RSTOSC = EXTOSC  // Reset Oscillator Selection (EXTOSC operating per FEXTOSC bits (device manufacturing default))

// CONFIG1H
#pragma config CLKOUTEN = ON    // Clock out Enable bit (CLKOUT function is enabled)
#pragma config PR1WAY = OFF     // PRLOCKED One-Way Set Enable bit (PRLOCK bit can be set and cleared repeatedly)
#pragma config CSWEN = ON       // Clock Switch Enable bit (Writing to NOSC and NDIV is allowed)
#pragma config FCMEN = ON       // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor enabled)

// CONFIG2L
#pragma config MCLRE = EXTMCLR  // MCLR Enable bit (If LVP = 0, MCLR pin is MCLR; If LVP = 1, RE3 pin function is MCLR )
#pragma config PWRTS = PWRT_1   // Power-up timer selection bits (PWRT set at 1ms)
#pragma config MVECEN = ON      // Multi-vector enable bit (Multi-vector enabled, Vector table used for interrupts)
#pragma config IVT1WAY = OFF    // IVTLOCK bit One-way set enable bit (IVTLOCK bit can be cleared and set repeatedly)
#pragma config LPBOREN = ON     // Low Power BOR Enable bit (ULPBOR enabled)
#pragma config BOREN = SBORDIS  // Brown-out Reset Enable bits (Brown-out Reset enabled , SBOREN bit is ignored)

// CONFIG2H
#pragma config BORV = VBOR_2P45 // Brown-out Reset Voltage Selection bits (Brown-out Reset Voltage (VBOR) set to 2.45V)
#pragma config ZCD = OFF        // ZCD Disable bit (ZCD disabled. ZCD can be enabled by setting the ZCDSEN bit of ZCDCON)
#pragma config PPS1WAY = ON     // PPSLOCK bit One-Way Set Enable bit (PPSLOCK bit can be cleared and set only once; PPS registers remain locked after one clear/set cycle)
#pragma config STVREN = ON      // Stack Full/Underflow Reset Enable bit (Stack full/underflow will cause Reset)
#pragma config DEBUG = OFF      // Debugger Enable bit (Background debugger disabled)
#pragma config XINST = OFF      // Extended Instruction Set Enable bit (Extended Instruction Set and Indexed Addressing Mode disabled)

// CONFIG3L
#pragma config WDTCPS = WDTCPS_31// WDT Period selection bits (Divider ratio 1:65536; software control of WDTPS)
#pragma config WDTE = ON        // WDT operating mode (WDT enabled regardless of sleep)

// CONFIG3H
#pragma config WDTCWS = WDTCWS_7// WDT Window Select bits (window always open (100%); software control; keyed access not required)
#pragma config WDTCCS = SC      // WDT input clock selector (Software Control)

// CONFIG4L
#pragma config BBSIZE = BBSIZE_512// Boot Block Size selection bits (Boot Block size is 512 words)
#pragma config BBEN = OFF       // Boot Block enable bit (Boot block disabled)
#pragma config SAFEN = OFF      // Storage Area Flash enable bit (SAF disabled)
#pragma config WRTAPP = OFF     // Application Block write protection bit (Application Block not write protected)

// CONFIG4H
#pragma config WRTB = OFF       // Configuration Register Write Protection bit (Configuration registers (300000-30000Bh) not write-protected)
#pragma config WRTC = OFF       // Boot Block Write Protection bit (Boot Block (000000-0007FFh) not write-protected)
#pragma config WRTD = OFF       // Data EEPROM Write Protection bit (Data EEPROM not write-protected)
#pragma config WRTSAF = OFF     // SAF Write protection bit (SAF not Write Protected)
#pragma config LVP = OFF        // Low Voltage Programming Enable bit (HV on MCLR/VPP must be used for programming)

// CONFIG5L
#pragma config CP = OFF         // PFM and Data EEPROM Code Protection bit (PFM and Data EEPROM code protection disabled)

// CONFIG5H

// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.

#include <xc.h>



 
 
 

In the programming interface R14 has been shorted and C7 has been removed.
VCC is 2.5V supplied by an on board DC/DC, the system clock runs on a 4MHz xtal and the programmer is a PicKit3.
 
Thanks in advance for attention and help.
Axl

Attached Image(s)

#1
ric
Super Member
  • Total Posts : 28943
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: Debug & programming work on PIC18LF25K83 but not on PIC18LF26K83 2020/10/28 17:25:46 (permalink) ☄ Helpfulby AxlTxl 2020/10/29 01:58:59
+2 (2)
Could you possibly raise Vdd slightly while programming?
There is a note on bulk erase in the programming specification, saying:

The hardware requires VDD to be above the BOR threshold, at the~2.4V nominal setting, in order to perform Bulk Erase operations. This threshold does not depend on the BORV Configuration bit settings. The threshold is the same for both F and LF devices, even though the LF devices may not have a user-configurable ~2.4V nominal BOR trip point setting. Refer to the microcontroller device data sheet specifications for min./typ./max. limits of the VBOR level (at the BORV = 0 setting of F devices).

 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#2
Aussie Susan
Super Member
  • Total Posts : 3787
  • Reward points : 0
  • Joined: 2008/08/18 22:20:40
  • Location: Melbourne, Australia
  • Status: offline
Re: Debug & programming work on PIC18LF25K83 but not on PIC18LF26K83 2020/10/28 18:40:20 (permalink) ☄ Helpfulby AxlTxl 2020/10/29 01:51:07
+1 (1)
Not related to your problem, but don't set teh DEBUG config item - let the IDE do that when you select the type of compile (debug or release).
Susan
#3
AxlTxl
New Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2014/11/05 03:13:08
  • Location: 0
  • Status: offline
Re: Debug & programming work on PIC18LF25K83 but not on PIC18LF26K83 2020/10/29 01:58:37 (permalink)
0
Thank you for your kind answer, I'll make this test.

My concern was about the fact that I'm able to erase, program and run _the same device_ [literally, the same chip] if I declare it's a PIC18LF25K83 in the IDE [getting a Device ID warning while programming, but it works] but not if I declare it as the PIC18LF26K83 it is.
#4
ric
Super Member
  • Total Posts : 28943
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: Debug & programming work on PIC18LF25K83 but not on PIC18LF26K83 2020/10/29 02:05:20 (permalink) ☄ Helpfulby AxlTxl 2020/10/29 02:49:27
+1 (1)
I thnk I read somewhere that it is meant to avoid using the bulk erase command when Vdd is low, doing it another way which is slower.
I guess it may do this correctly for the 25K, but not the 26K.
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#5
AxlTxl
New Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2014/11/05 03:13:08
  • Location: 0
  • Status: offline
Re: Debug & programming work on PIC18LF25K83 but not on PIC18LF26K83 2020/10/29 03:03:18 (permalink)
0
Another question: this project will require in-application programming [that's the feature that required a bigger flash size], using the boot sector for the bootloader and the remaining flash as runtime program memory... As I get from the PIC18LF25/26K83 datasheet the program memory is erased/written in blocks and bulk erase is not available by user code while this problem affect only the bulk erase [so I won't encounter it in further project developing], am I right?
 
Thanks!
#6
NorthGuy
Super Member
  • Total Posts : 6404
  • Reward points : 0
  • Joined: 2014/02/23 14:23:23
  • Location: Northern Canada
  • Status: offline
Re: Debug & programming work on PIC18LF25K83 but not on PIC18LF26K83 2020/10/29 19:53:03 (permalink)
+1 (1)
AxlTxl
Another question: this project will require in-application programming [that's the feature that required a bigger flash size], using the boot sector for the bootloader and the remaining flash as runtime program memory... As I get from the PIC18LF25/26K83 datasheet the program memory is erased/written in blocks and bulk erase is not available by user code while this problem affect only the bulk erase [so I won't encounter it in further project developing], am I right?
 
Thanks!




Yes, row erase works with lower voltages.
#7
Jump to:
© 2020 APG vNext Commercial Version 4.5