Device failing to start properly MCLR and other stuff going nuts

Started by TimB, Jun 17, 2023, 01:40 PM

Previous topic - Next topic

TimB


I have 2 pics on a board used to work with no issues. Now one pic is failing to start properly. If I probe the MCLR with my scope probe it starts running. In fact just touching the MCLR pin with my probe it resets the device.

I have a 10k pullup on MCLR

A section of my fuses are below

I'm really thinking I may have a main issue also that might be related as my AUX laptop monitor will go blank for a couple of secs when I connect the programmer and now if I just pick my osc probe up via the plastic if its grnd is connected to the board :o

I tried swapping the 12v wallwart power I'm using to power the board.

All 240v is via a extension cable except the monitor that's on its own outlet. Thinking I need to check the extension cable grd wiring

Any ideas?

Thanks
Tim

   Device 18f27Q10

'-------------------------------------------------------------------------------
'**** Added by Fuse Configurator ****
' Use the Fuses Tab to change these settings

Config_Start
    FEXTOSC = OFF              'Oscillator not enable
    RSTOSC = HFINTOSC_64MHZ    'HFINTOSC with HFFRQ = 64 MHz and CDIV = 1:
    CLKOUTEN = OFF             'CLKOUT function is disable
    CSWEN = ON                 'Writing to NOSC and NDIV is allowed
    FCMEN = ON                 'Fail-Safe Clock Monitor enable
    MCLRE = EXTMCLR            'MCLR pin (RE3) is MCL
    PWRTE = On                 'Power up timer is on
    LPBOREN = On               'Low power BOR is enabled
    BOREN = SBORDIS            'Brown-out Reset enabled , SBOREN bit is ignore
    BORV = VBOR_190            'Brown-out Reset Voltage (VBOR) set to 1.90
    ZCD = OFF                  'ZCD disabled. ZCD can be enabled by setting the ZCDSEN bit of ZCDCO
    PPS1WAY = ON               'PPSLOCK bit can be cleared and set only once' PPS registers remain locked after one clear/set cycl
    STVREN = ON                'Stack full/underflow will cause Rese
    XINST = OFF                'Extended Instruction Set and Indexed Addressing Mode disable
    WDTCPS = WDTCPS_31         'Divider ratio 1:65536' software control of WDTP
    WDTE = OFF                 'WDT Disable
    WDTCWS = WDTCWS_7          'window always open (100%)' software control' keyed access not require
    WDTCCS = SC                'Software Control

John Lawton

Mysterious. I always use a network of two resistors and a capacitor to 0V on my /MCLR lines so it is held in reset during power-up and don't have startup issues.

Is your programmer connected at the time it fails to start?

Also, do you have an 0V ground anywhere is your system?

Wallwart psu's aren't usually grounded and laptop psu's also float and can be very leaky to the mains side so you can get quite high transients around using that sort of setup without decent grounding on your circuit. Unfortunately it is possible that your chips are damaged.

Fanie

The only time I had pics doing weird things was when an A/D input was pulled to or over the V+ of the pic.

If your scope probe affects the MCLR then there is possibly a disconnect between the 10k and the pic or to the supply iow the MCLR could be floating.  Program the MCLR as an output perhaps ?

Check that you have one ground and properly connected everywhere, a crack in a track perhaps.  I use a low voltage supply 1V2 with current limit to see a short over the tracks.

Make sure you don't have pic pins shorted to each other, sometimes by a thinner than hair conductor, which is the most problems cause I have come across. I have a fairly potent digital microscope and I still fail to always actually see the short.  Scraping between the pic pins with a needle or fine knife point often resolve the problem.

I have found (a few times) a short that I could not find.  I resolved this by simply burning the short off with a low voltage high current supply. ;D This can be caused by a very fine piece of dust landing on a board during the manufaturing.

trastikata

Looks like power supply issue, have you tried placing a decoupling cap at the MCLR pin?

Interestingly old 18F devices don't have a bypass capacitor at MCLR pin in the recommended schematics and newer devices have bypass caps in the datasheets. They even recommend R-C-R filters at MCLR pins?

TimB

Thanks John and Fanie

I tried a new extension and still the same. I removed an USB C to USB A expander I had my screen seems to be behaving its self now

My PicKit 3 is unplugged after programming as the PIC uses USART 2 that is on the same pins as one of the ICSP lines

There is no direct earth connection to the board just +12v and its Grnd.

I ran the board of a battery and the pic is still super sensitive to my finger on either a grnd pin anywhere on the board and the MCLR line. I'm going to add an extra RC to the MCLR line to see what happens

I will report back how it goes.

BTW it seems to have started after I enabled TX2 transmits

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Update 1

OK after writing the sentence above I decided to see what would happen if I commented out the USART2 setup code. Including the PPS. Now its working again as expected. So it might be something to do with the PPS code. I will have to check that the generated PPS code is not in fact doing something stupid like altering the MCLR pin.

Update 2
I figured most of it out
The Monitor issue seems to be down to the USB Expander

the Pic resetting is that the TX2 pins were left to float. I have interrupts on TX2 to handle sending data but no code yet for RXing so it probably saw the RX2 line floating around and thought it was data. Then as there was nothing to handle the interrupt generated it went into a death loop.  I added 2 100k pullups to the line and its working again.

Does not explain why touching MCLR reset it though.




Giuseppe MPO

The problem must be on the MCLR, if there is a 10K resistor it cannot be reset with the oscilloscope tip, it has a minimum impedance of 1M and a low capacitance which cannot absolutely reset the PIC. Have you tried changing the resistor, re-soldering it? Check the supply voltage of the PIC and the voltage on the MCLR they should be very very similar if everything is working as it should. Also check with the oscilloscope the power supply voltage that is stable but above all has no noise, it happened to me that with cheap power supplies I have a very high noise on the power supply.