Author Topic: PIC18F25K20 is resetting when MCLR is floating (MCLRE = OFF)  (Read 3195 times)

0 Members and 1 Guest are viewing this topic.

Offline npelovTopic starter

  • Frequent Contributor
  • **
  • Posts: 331
  • Country: bg
    • Microlab.info
PIC18F25K20 is resetting when MCLR is floating (MCLRE = OFF)
« on: March 07, 2014, 02:19:04 pm »
Hi,
 
I have basic PIC18F25K20 circuit using 12 MHz oscillator and debug output like this:
 
  while(1){
    NOP();
    LATBbits.LATB5 = 1;
    NOP();
    LATBbits.LATB5 = 0;
  }
 
The chip is resetting every few ms. When I connect MCLR pin to Vdd (it's 5V) it stops resetting. MCLR is disabled using:
#pragma config MCLRE = OFF // disable reset from MCLR 
 
To be sure I read the device and these are the config words (from config1 to config7):
0600
1410
0C00
0001
C00F
E00F
400F
 
config3 bit 15 is 0
 
Watch dog and Brown-out Reset are disabled.
 
I guess a software instruction could reset the chip, but it stops resetting when I pull up MCLR to Vdd. Also if I pull down MCLR it is held in reset - like if it was enabled. The program is pretty simple. Interrupts are disabled. I can't think of a reason why the chip should reset. I checked errata - nothing there about MCLR. Any ideas?
 
 

jucole

  • Guest
Re: PIC18F25K20 is resetting when MCLR is floating (MCLRE = OFF)
« Reply #1 on: March 07, 2014, 02:55:49 pm »
hi,  your CONFIG 4  "0001" seems like you have the debugger enabled could it be that?
 

Offline npelovTopic starter

  • Frequent Contributor
  • **
  • Posts: 331
  • Country: bg
    • Microlab.info
Re: PIC18F25K20 is resetting when MCLR is floating (MCLRE = OFF)
« Reply #2 on: March 07, 2014, 03:18:12 pm »
Well it is that :)
I thought I covered that by setting "RELEASE" build in ide few times - I use this code:
#ifdef __DEBUG
#pragma config DEBUG = ON
#else
#pragma config DEBUG = OFF
#endif

However I guess I did something wrong - probably didn't run complete rebuild. Now I did and it's working fine. I guess I should do complete clean/rebuild when I switch build configuration.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: PIC18F25K20 is resetting when MCLR is floating (MCLRE = OFF)
« Reply #3 on: March 07, 2014, 05:14:50 pm »
Quote
I guess I should do complete clean/rebuild

Or finding a minimalist piece of your code that exhibits the issue and post all of it.

A big part of getting helped is to make it easier for others to help you.
================================
https://dannyelectronics.wordpress.com/
 

Offline npelovTopic starter

  • Frequent Contributor
  • **
  • Posts: 331
  • Country: bg
    • Microlab.info
Re: PIC18F25K20 is resetting when MCLR is floating (MCLRE = OFF)
« Reply #4 on: March 07, 2014, 05:35:33 pm »
You are right. I should have posted more/full code. But the problem is fixed.
 

jucole

  • Guest
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf