PDA

View Full Version : Device appears to be running slow: Returned after being in the field for months.



jmgelba
- 16th December 2010, 00:26
A couple of issues here, both with a 18F1320. It appears that it is running super slow. The LCD is displaying gibberish and a flashing LED is taking hundreds of times longer to flash on and off. All settings are correct. Resonator is correct.

I have no idea.

Couple of days after this, another 1320 came back with the same problem. I've programmed hundreds with the same code, and very few have come back, and only these two have this symptom. The others were for other areas of the power supply failing.
I can reprogram these PIC's and get exactly the same results. I replaced all support components on each pcb but it is actually the PIC that's failing.

So has anyone else seen failures of this nature? Did you figure it out? On both these boards, I replaced the PIC and the boards ran fine.

mackrackit
- 16th December 2010, 00:34
Are you using the internal OSC? If so are the boards running in a hot environment?

jmgelba
- 16th December 2010, 01:45
No, external ceramic resonator.
Boards can sometimes get hot but are designed to turn off the output if an overt emp is detected.

J. Mark Wolf
- 16th December 2010, 12:31
I got bit by this phenomena once on my first '18F' series parts after years of using '16F' parts.

Turns out I didn't have both pins of the oscillator set up correctly. One was set for OSC IN but the other was inadvertantly configured for GPIO. It worked fine on my desk for months during development but would inexplicably drop to the internal slow oscillator in the field.

Check the "Clock Sources and Oscillator Switching" section of your data sheet.

The following is for a different device than yours but illustrates the issue.

...includes a feature that allows the
device clock source to be switched from the main
oscillator to an alternate low-frequency clock source.
PIC18F2525/2620/4525/4620 devices offer two alternate
clock sources. When an alternate clock source is enabled,
the various power managed operating modes are
available.
Essentially, there are three clock sources for these
devices:
• Primary oscillators
• Secondary oscillators
• Internal oscillator block

...The secondary oscillators are those external sources
not connected to the OSC1 or OSC2 pins. These
sources may continue to operate even after the
controller is placed in a power managed mode.

jmgelba
- 16th December 2010, 21:36
The fuses are set right and the program performs exactly the same if I set it up for internal RC.

Here is the code with everything removed except the LCD related stuff. I cant show the actual code used in the product. It appears to be none code related though as this is a very stripped piece of code that should have no problems.

DEFINES are the same, ports are the same.


DEFINE OSC 10
DEFINE LCD_DREG PORTB ' Set LCD Data port
DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 2 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 3 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2000 ' Set command delay time in us
DEFINE LCD_DATAUS 50 ' Set data delay time in us

DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50

ADCON1 = %01000000
ADCON2 = %10111111
TRISA = %11111111 'All inputs
TRISB = %00000000 'PORTB.1 is output to flash heartbeat LED

PAUSE 1000
LCDOUT $FE, 1
LCDOUT $FE, 2, "HELLO"
LCDOUT $FE, $C0, "WORLD"

Loop:
PORTB.1 = 1
LCDOUT $FE, 1
PAUSE 500
LCDOUT $FE, 2, "LED 1"
LCDOUT $FE, $C0, "I=123456"
PAUSE 1000
PORTB.1 = 0
PAUSE 500

Goto loop

Archangel
- 17th December 2010, 06:12
Meaning no disrespect . . . how about you let US see those fuse settings, you know . . fresh eyes.
esp.is this in there?


_FSCM_OFF_1H
; Fail-Safe Clock Monitor disabled

_IESO_OFF_1H
; Internal External Oscillator Switch Over mode disabled

shahidali55
- 18th December 2010, 08:13
Could it be some sort of corrosion between the OSC1 and OSC2 pins?
I've experienced something similar due to oxide formation between the pins . . .

jmgelba
- 20th December 2010, 19:43
No corrosion. And it will run slow if set for internal oscillator.