• AVR Freaks

Hot!PIC18F2525 - Debugging Issue

Author
Navaneeth_1996
New Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2021/03/02 06:14:42
  • Location: 0
  • Status: offline
2021/03/02 22:16:42 (permalink)
0

PIC18F2525 - Debugging Issue

Hi I have a PIC18F2525, PICKIT 3 and a Microchip Explorer 8 board. I am working with MPLAB IDE v8.88 with Hi-Tech compiler v8.35. 
 
I have a couple of questions:
1. Can I use this MCU with Explorer 8 board?
2. I wrote a simple program to toggle a GPIO pin (RB2). When I tried to program it, I am getting programming failed error. When I tried the verify option I get verify failed error. After couple of attempts both are passed. But I am unable to debug the code. What might be the reason behind this? Also I would like to know the differences between the programmer and debugger option in MPLAB.
3. Can I get any code for LED toggling, checking UART?
 
I am unable to debug the code. This is my major concern. Any help would be appreciated.
 
Thanks in advance.
 
Attached is the code for GPIO toggling and configuration bit settings.
 

Attached Image(s)

#1

7 Replies Related Threads

    ric
    Super Member
    • Total Posts : 30244
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: PIC18F2525 - Debugging Issue 2021/03/03 15:51:13 (permalink)
    0
    Navaneeth_1996
    Hi I have a PIC18F2525, PICKIT 3 and a Microchip Explorer 8 board. I am working with MPLAB IDE v8.88 with Hi-Tech compiler v8.35. 
     

    Is there any particular reason you are using such an old IDE and compiler?
    The final MPLAB8 version was v8.92.
    HiTech were bought by Microchip years ago, and the compiler became XC8.
     

    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
    Navaneeth_1996
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2021/03/02 06:14:42
    • Location: 0
    • Status: offline
    Re: PIC18F2525 - Debugging Issue 2021/03/03 21:53:37 (permalink)
    0
    Yea I know its a very old compiler and IDE. But the project I am working on needs to be completed with this. Its a very old product about 40 years which uses the firmware done using this setup.  
    #3
    RISC
    Super Member
    • Total Posts : 6067
    • Reward points : 0
    • Status: offline
    Re: PIC18F2525 - Debugging Issue 2021/03/04 04:13:32 (permalink)
    0
    Hi,
    Yes you can use PIC18F2525 on the  EXPLORER8.
    This board has lots of jumpers...Did you check carefully that they are setup correctly ?
    https://ww1.microchip.com...eviceDoc/40001812B.pdf
    Also there are lots of chips on this board so you must make sure to either disconnect them(if possible from a jumper) or make sure it does not interfere with your software.
    Do you want to use internal or external oscillator ?
    Regards

    For support make sure to check first here : http://microchipdeveloper.com
    There are hundreds of PIC, AVR, SAM...which one do YOU use ?
    #4
    RISC
    Super Member
    • Total Posts : 6067
    • Reward points : 0
    • Status: offline
    Re: PIC18F2525 - Debugging Issue 2021/03/04 05:16:21 (permalink)
    0
    Hi,
    I tried the EXPLORER8 with PIC18F25K22 and it works fine with MPLAB X and Pickit3.
    To avoid issues with the power supply do NOT power supply from pickit3 has is has limited supply capability
    I used an external 9V power supply.
    Can you please check following jumpers :
    J51 : RB7
    J52 : RB6
    and J2 : BRD +5V for external power supply
    You should at least be able to program the PIC18F2525 otherwise it means there is an issue with pickit3.
    Did your pickit3 upgrade firmware when you connected it to the board ?
    I recommend that you use MPLAB X instead of MPLAB. It is compatible with Hitech compiler
     
    you example code works after correcting this :
    LATB2 = 1; // remove this line
    ...
    ...
    LATB2 = 0 ; ==> change to LATB2 = LATB2 ^ 1;   // to toggle the LED 
    Make sure you select INTERNAL clock for the PIC (your configuration bits window screenshot shows incorrect configuration but your source code seems to be ok)
    Regards

    For support make sure to check first here : http://microchipdeveloper.com
    There are hundreds of PIC, AVR, SAM...which one do YOU use ?
    #5
    GilJ
    Super Member
    • Total Posts : 119
    • Reward points : 0
    • Joined: 2011/04/05 02:36:47
    • Location: 0
    • Status: offline
    Re: PIC18F2525 - Debugging Issue 2021/03/04 05:38:33 (permalink)
    0
    Hi,
    My attempt to answer your questions:
    1. Can I use this MCU with Explorer 8 board?

    You should be able to use PIC18F2525 with Explorer 8 board. That particular MCU is not listed in the Explorer 8 supported devices page, but with a quick look in the board schematic I can see that the 28-pin socket (J13) has the power supply, programming and oscillator pins matching those of that MCU.

    How are the jumpers J51/J52 and J36/J37 configured? Check all jumpers related to RB6 and RB7.
    How are you powering the board? Check the PIC voltage at Vdd/Vss pins, is it 5V? (Check all power selection jumpers.)

    2. I wrote a simple program to toggle a GPIO pin (RB2). (...)

    I don't remember how MPLAB IDE works, but in your attached image "Configuration bits set in code" is checked, so, I think you should set all configuration parameters in your code. You are only setting two: FOSC and WDT.
     
    From the datasheet "On a Power-on Reset, RB4:RB0 are configured as analog inputs by default and read as ‘0’; RB7:RB5 are configured as digital inputs." So, you need to configure RB2 as digital.
     
    Also, with your code you will not see the LED toggling ON/OFF. It will appear always ON since there is no delay between the OFF state and the ON state.
     
    None of this previous points should interfere with programming the MCU. Check the board settings, as RISC mentioned.
     
    You said "After couple of attempts both are passed.", so, you are able to program the PIC but not debug it, is that it?
    The code built in programming mode is to just compile the code and program the MCU. The debug mode is intended to maintain the programmer/debugger attached to the MCU and do the debug (step, watch variables, etc.) using the source code.

    3. Can I get any code for LED toggling, checking UART?

    The code you provided should work (check RISC answer) if you set the configuration bits, turn that pin to digital and use a delay between the LED OFF and LED ON state.
     
     
    #6
    Navaneeth_1996
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2021/03/02 06:14:42
    • Location: 0
    • Status: offline
    Re: PIC18F2525 - Debugging Issue 2021/03/04 06:37:39 (permalink)
    0
    Regarding the jumper settings:
     
    J51 - RB7
    J52 - RB6
    J37 - RA6
    J36 - RA7
     
    I have set the jumper to default settings (as in the explorer's manual). And configuration bits are not set in code.
     
    1. Selected External Oscillator (External oscillator port function on RA6)
    2. WDT disabled
    3. PBADEN - PORTB<4:0> pins are configured as digital I/O on reset
    4. LVP - Single supply ICSP disabled
     
    @RISC Thank you. I have changed the code as per your instructions. Now I have selected External Oscillator. And Yes the PICKIT3 firmware upgraded. I need to work with MPLAB IDE only. 
     
    @GiLJ Thanks for the detailed information. I am powering the board through USB cable (J12). Voltage at VDD and ~MCLR pins are at 5v. And there is a nested for loop written in the code to act as delay right? 
     
    Is it possible to upload the code and configuration settings image in this thread? I am unable to find an option (Sorry I am new to the forum).
     
    Unfortunately even now I am unable to program and debug. 
     
    Have I missed something?
     
    #7
    RISC
    Super Member
    • Total Posts : 6067
    • Reward points : 0
    • Status: offline
    Re: PIC18F2525 - Debugging Issue 2021/03/04 07:12:56 (permalink)
    0
    Hi,
     
    As you power your board from USB, I guess you have J2 jumper set to USB +5V ?
     
    Your XTAL jumpers seems ok but I would recommend to reduce issues that you start your blinking using internal clock (in configuration bits).
    Are you sure that in the project properties of the pcikit3 you have selected that the pickit3 does not power the target ?
    As long as the Pickit3 cannot detect your PIC you will not be able to program / debug it...
    Is pin 1 of the Pickit3 (white triangle) the closest to the USB connector on EXPLORER8 ?
    Do you see any LED lit on yor board ? (e.g. D9 = Device Power, LD2 = 5V)
     
    Do you have any other hardware debugger ?
    Can you please take a picture of your hardware including pickit3 and post it ?
    Can you also take a screenshot of the error message ?
     
    Regards

    For support make sure to check first here : http://microchipdeveloper.com
    There are hundreds of PIC, AVR, SAM...which one do YOU use ?
    #8
    Jump to:
    © 2021 APG vNext Commercial Version 4.5