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.

[PIC] Please Help with Section Error in MPLAB X Debugger

Status
Not open for further replies.

TrevorH

Newbie level 3
Joined
Oct 10, 2014
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
43
Hi

I am a very new Hobbyist of PIC so please go easy on me. I am using a PIC16f628A, Pickit2, MPLAB X v2.20, and PICkit2 v2.61

I am starting with the usual beginner tutorials and the obligatory "flashing LED" project which are fine and understand. I have managed to write the assembly, build the project, use the PICkit2 software to program the PIC and hey presto the LED flashes, etc. The Debug in MPLAB was working fine up until about a week ago and since then I have not been able to use it, however the build still works and I can change the PIC without a problem, its just the Debug that I keep getting an error.

the error is:

Error - section 'dbgD2' can not fit the absolute section. Section 'dbgD2' start=0x00000165, length=0x0000000b

I have searched online for many many hours and cannot figure out what I've done.

Can anyone point me in the right direction so I can get the debug to work again.

Thanks in advance.

Trevor
 

Hi,

Have used degugger old in the old IDE but not yet with the new X; though have built with X

Can you post your assembler code so we can try programming / debugging it; not familiar with X error code but it kind if implies a memory location issue, debugger has to use a bit of high order memory.

As you are new to pics, apart from this problem , you might find these links helpful.

http://www.winpicprog.co.uk/pic_tutorial.htm
**broken link removed** http://www.amqrp.org/elmer160/lessons/
http://www.epemag.wimborne.co.uk/resources.htm
http://www.mikroe.com/chapters/view/5/chapter-4-timers/
 
Hi,

Thanks for reply.

I have tried several assembler code to the point where I started from scratch and entered the following minimum amount:


Code ASM - [expand]
1
2
3
4
5
list        p=16F628A
 #include    <P16F628A.inc>
 __CONFIG _FOSC_EXTRCCLK & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _BOREN_ON & _LVP_ON & _CPD_OFF & _CP_OFF
        
 END



but I still get this error.

regards

Trevor
 
Last edited by a moderator:

Hi,

Afraid you have run into a big problem with the 16F628A chip, you cannot run Debugger on that chip unless you have an adaptor, which is basically another pic than can run debugger !
See the pic from my old Mplab chip selection.

I would not bother getting an adaptor, much cheaper and simpler to get a different chip, there are lots to choose from but a popular direct replacement for the 628 is the 16F88.
You can still debug your 628A code by using Xs Simulator, a good tool to learn the system before using the full hardware debugger.

Not sure how you got debugger to work before ? was it the same chip type, wonder if you were actually just going into Sim instead ?

As for your bit of code, does not look right, the OSC is specifying an External Oscillator , is that correct ?
The chip has a perfect good internal oscillator which you can select as shown in the attached Template file you will find for every chip; store in Mplab/asm folder.

Also the LVP must be off for use with the Pk2.
Code:
;**********************************************************************
;   This file is a basic code template for assembly code generation   *
;   on the PIC16F628A. This file contains the basic code              *
;   building blocks to build upon.                                    *
;                                                                     *
;   Refer to the MPASM User's Guide for additional information on     *
;   features of the assembler (Document DS33014).                     *
;                                                                     *
;   Refer to the respective PIC data sheet for additional             *
;   information on the instruction set.                               *
;                                                                     *
;**********************************************************************
;                                                                     *
;    Filename:	    xxx.asm                                           *
;    Date:                                                            *
;    File Version:                                                    *
;                                                                     *
;    Author:                                                          *
;    Company:                                                         *
;                                                                     *
;                                                                     *
;**********************************************************************
;                                                                     *
;    Files Required: P16F628A.INC                                     *
;                                                                     *
;**********************************************************************
;                                                                     *
;    Notes:                                                           *
;                                                                     *
;**********************************************************************

	list      p=16f628A           ; list directive to define processor
	#include <p16F628A.inc>       ; processor specific variable definitions

	errorlevel  -302              ; suppress message 302 from list file

	__CONFIG   _CP_OFF & _DATA_CP_OFF & _LVP_OFF & _BOREN_OFF & _MCLRE_ON & _WDT_OFF & _PWRTE_ON & _INTOSC_OSC_NOCLKOUT 

; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See data sheet for additional information on configuration word settings.




;***** VARIABLE DEFINITIONS
w_temp        EQU     0x7E        ; variable used for context saving 
status_temp   EQU     0x7F        ; variable used for context saving





;**********************************************************************
	ORG     0x000             ; processor reset vector
	goto    main              ; go to beginning of program
	

	ORG     0x004             ; interrupt vector location
	movwf   w_temp            ; save off current W register contents
	movf	STATUS,w          ; move status register into W register
	movwf	status_temp       ; save off contents of STATUS register

; isr code can go here or be located as a call subroutine elsewhere


	movf    status_temp,w     ; retrieve copy of STATUS register
	movwf	STATUS            ; restore pre-isr STATUS register contents
	swapf   w_temp,f
	swapf   w_temp,w          ; restore pre-isr W register contents
	retfie                    ; return from interrupt


main

; remaining code goes here

	goto	main		  ;loop forever, remove this instruction, for test only


; initialize eeprom locations

	ORG	0x2100
	DE	0x00, 0x01, 0x02, 0x03


	END                       ; directive 'end of program'
 

Attachments

  • 000138.jpg
    000138.jpg
    52.1 KB · Views: 77
  • 000139.jpg
    000139.jpg
    44.7 KB · Views: 76
Thank you WP for your information, much appreciated.

I will get and look at the 16F88 to start instead, there was no specific reason I went for the 628. What IS the difference I should look for when I'm choosing a PIC, what info on a PIC tells YOU that you cannot debug it?

I have not looked at the Simulator yet but will do. The only difference I can think of why I had it working, and you may be able to answer this one; The PICKit2 I have is a new one but a couple of weeks ago I must have been holding the button when I plugged it in and I had to download the operating system again (from the internet). Could the original OS have enabled me to do this?

Regarding the bit of code, it was actually the last I had been trying. Up until then I have been using the Internal Oscillator and the "flashing LED" circuit worked perfectly.

Thank you for all your help.

Trevor
 

What IS the difference I should look for when I'm choosing a PIC, what info on a PIC tells YOU that you cannot debug it?
The info is given in the MPLAB device info quoted by WP100 (ICD Header rquired) and also in the datasheet:

14.13 In-Circuit Debugger
Since in-circuit debugging requires the loss of clock, data and MCLR pins, MPLAB® ICD 2 development with an 18-pin device is not practical. A special 28-pin PIC16F648A-ICD device is used with MPLAB ICD 2 to provide separate clock, data and MCLR pins and frees all normally available pins to the user. Debugging of all three versions of the PIC16F627A/628A/648A is supported by the PIC16F648A-ICD.
 

Thank you WP for your information, much appreciated.

I will get and look at the 16F88 to start instead, there was no specific reason I went for the 628. What IS the difference I should look for when I'm choosing a PIC, what info on a PIC tells YOU that you cannot debug it?

I have not looked at the Simulator yet but will do. The only difference I can think of why I had it working, and you may be able to answer this one; The PICKit2 I have is a new one but a couple of weeks ago I must have been holding the button when I plugged it in and I had to download the operating system again (from the internet). Could the original OS have enabled me to do this?

Regarding the bit of code, it was actually the last I had been trying. Up until then I have been using the Internal Oscillator and the "flashing LED" circuit worked perfectly.

Thank you for all your help.

Trevor

Hi,

As said you really have to look to mplab when starting a project off to see if that chip you want to use can debug directly, expect in X if you have your Pk2 connected it will then say on the dashboard if that can run debugger (?)

Seem a bit poor that no simple list of what chips need an adapter is not available.

Many web examples used the 16f84 and 628 but the 16f88 will run all their codes with perhaps just the odd change to the config line etc.
Another very popular project chip is the 16f877a 40 pin, again widely available.

There are a lot more modern chips but be aware that the Pk2, good as it is, cannot program or debug all these later chip.
Check your Pk2 ReadMe

Downloading the pk2 operating system will make no difference to the debug function.

- - - Updated - - -

Hi,

This table shows which chips can be programmed and debugged directly from Mplab X

While it shows that X can debug the 628A , it does not show that an adapter is needed.

file:///C:/Program%20Files/Microchip/MPLABX/docs/Device%20Support.htm

V2.61 can program a few more chips directly than Mplab can, well at least that was true with the old MPlab.
If you view Microchips 'programmers' forum you will find users have added a few newer chips to the Pk2 device file.
https://www.microchip.com/forums/f15.aspx
 

Hi,

As mentioned I am still learning to use X, but as you can see from the screenshots, when you Create a new Project, its when you select your chip that it automatically tell you if a "Header" is needed.

Expect you missed that with all the many options when you start off for the first time.
 

Attachments

  • 000141.jpg
    000141.jpg
    45.4 KB · Views: 91
  • 000140.jpg
    000140.jpg
    75.5 KB · Views: 75

Hi WP

Thanks for the last thumbnails. I had actually selected this as it was the only one there.

Regards your last reply saying "While it shows that X can debug the 628A , it does not show that an adapter is needed"

does this mean I should be able to use the debugger with the 628a I have? It Definitely worked for a short while, have been looking at the "simulator" today and was definitely not that what I was using last time.

Thanks for all your info though, its pointed me in a few directions.

Regards
 

Regards your last reply saying "While it shows that X can debug the 628A , it does not show that an adapter is needed"

Hi,

That comment was when referring to the Device support list which shows which chips can be run by what programmer /debugger, but it does not show which chip needs the addition of the adapter /header device.

does this mean I should be able to use the debugger with the 628a I have? It Definitely worked for a short while, have been looking at the "simulator" today and was definitely not that what I was using last time.

I have a 628A chip but never tried to use debugger on it, because I knew it needed the header, but all I can conclude is that perhaps somehow if connected to the debugger the 628a just might be able to do a little actual debugging ?? - but doubt it would work fully.

Much better to use another chip.

As well as the 18pin 16f88 and there is the 40 pin 16f877a and its much better replacement the 16f887; all these will all run debugger via the Pk2 without any headers.
The 40 pin chips might see a bit over powering but they do have many features that you will appreciate as you get in to things more.
The code from the 18pin chips will work fine on the 40 pin chips
All seem available cheap enough on uk ebay rather than pay the expensive dealer carriage charges.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top