|
|
View previous topic :: View next topic |
Author |
Message |
pfaerber
Joined: 18 May 2004 Posts: 5 Location: Germany
|
Restart problem / BROWNOUT question |
Posted: Mon Mar 26, 2007 7:02 am |
|
|
Hello I has a problem when starting my board.
Sometimes it does not start, sometimes it run perfekt.
If I switch BRONWOUT off or to BORV42 all run perfect.
Can someone explain this?
my testcode
Code: | #include <18F6720.h>
#device ADC=10
#device *=16
//////// Fuses: LP,XT,HS,RC,EC,EC_IO,H4,RC_IO,PROTECT,NOPROTECT,OSCSEN
//////// Fuses: NOOSCSEN,NOBROWNOUT,BROWNOUT,WDT1,WDT2,WDT4,WDT8,WDT16,WDT32
//////// Fuses: WDT64,WDT128,WDT,NOWDT,BORV25,BORV27,BORV42,BORV45,PUT,NOPUT
//////// Fuses: CPD,NOCPD,NOSTVREN,STVREN,NODEBUG,DEBUG,NOLVP,LVP,WRT,NOWRT
//////// Fuses: CPB,NOCPB,EBTRB,NOEBRRB,EBTR,NOEBTR,CCP2E7,CCP2C1,WRTD
//////// Fuses: NOWRTD,WRTC,NOWRTC,WRTB,NOWRTB
#fuses EC,NOWDT,BORV45,PUT,NOPROTECT,BROWNOUT,LVP,NOWRT
#use delay(clock=16000000)
#use fast_io(A)
#use fast_io(B)
#use fast_io(C)
#byte MEMCON = 0xf9c
#BIT fnoBeep = 0xf82.4
main(){
set_tris_a(0x22); // RA xxiooio
set_tris_b(0x46); // RB oooooiio
set_tris_c(0x88); // RC 0,1,2,4,5,6 sind Ausgang
fnoBeep = 0;
set_tris_d(0x00); // RD Ausgang
set_tris_e(0x00); // RE 0,1,2 sind Ausgang
delay_ms(100);
fnoBeep = 1;
while(true){}
} // main
|
I use version 3.249 and pic 18f6720
Paul
sorry for my bad english :-( |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Mar 26, 2007 11:39 am |
|
|
Quote: |
#fuses EC,NOWDT,BORV45,PUT,NOPROTECT,BROWNOUT,LVP,NOWRT
Hello I has a problem when starting my board.
Sometimes it does not start, sometimes it run perfect.
If I switch BROWNOUT off or to BORV42 all run perfect.
Can someone explain this?
|
Look in the 18F6720 data sheet, in the Electrical Characteristics
section. Here's the information from that section:
Code: | Min Max
VBOR BORV1:BORV0=00 4.50v 4.78v
|
It shows that for the VBOR45 setting, the actual trigger voltage can
be anywhere from 4.50v to 4.78v for any individual PIC chip.
This is probably caused by variations in the manufacturing process.
This means your power supply may be falling down to 4.75v and
causing a Brownout reset. You need to improve your power
supply circuit.
-----------
One more comment on your fuse settings:
You have the LVP fuse set. Are you using a LVP programmer ?
99% of all programmers are not LVP. For example, PicStart-Plus,
Microchip ICD2, Warp-13a, CCS ICD-U40, etc., all use the High Voltage
Programming mode. If you are using a normal programmer, then
change the fuse to NOLVP. |
|
|
pfaerber
Joined: 18 May 2004 Posts: 5 Location: Germany
|
|
Posted: Tue Mar 27, 2007 12:38 am |
|
|
thanks for the fast replay
PCM programmer wrote: |
Look in the 18F6720 data sheet, in the Electrical Characteristics
section. Here's the information from that section:
Code: | Min Max
VBOR BORV1:BORV0=00 4.50v 4.78v
|
It shows that for the VBOR45 setting, the actual trigger voltage can
be anywhere from 4.50v to 4.78v for any individual PIC chip.
This is probably caused by variations in the manufacturing process.
|
Yes thats right, but i have after 500us power startup stabel 5V. The funny thing is that the start is sometimes delayed (1-2s) after that all run fine. I can live with BORV42 but i want understand the thing.
Quote: | You have the LVP fuse set. Are you using a LVP programmer ?
99% of all programmers are not LVP. For example, PicStart-Plus,
Microchip ICD2, Warp-13a, CCS ICD-U40, etc., all use the High Voltage
Programming mode. If you are using a normal programmer, then
change the fuse to NOLVP. |
Oh thanks I have a ICD-U40 and has meant that it use LVP (RTFM :-( ).
Paul |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
pfaerber
Joined: 18 May 2004 Posts: 5 Location: Germany
|
|
Posted: Wed Mar 28, 2007 12:21 am |
|
|
PCM programmer wrote: | Quote: | #fuses EC,NOWDT,BORV45,PUT,NOPROTECT,BROWNOUT,LVP,NOWRT |
The EC fuse implies that you are using an oscillator. Are you ?
|
Yes I use a 16Mhz oscillator.
The signal is connected to pin 39(OSC1/CLKI) pin 40 is open.
Paul |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Mar 28, 2007 12:40 am |
|
|
I assume that you changed the fuses to add NOLVP. Like this:
Code: |
#fuses EC,NOWDT,BORV45,PUT,NOPROTECT,BROWNOUT,NOLVP,NOWRT |
Do you still have the slow startup ?
If so, describe your MCLR circuit. Give the values for all the external
components and the connections.
Also, do you have the ICD-U40 debugger connected to the PIC when
you have the slow startup problem ? |
|
|
pfaerber
Joined: 18 May 2004 Posts: 5 Location: Germany
|
|
Posted: Wed Mar 28, 2007 1:19 am |
|
|
PCM programmer wrote: | I assume that you changed the fuses to add NOLVP. Like this:
Code: |
#fuses EC,NOWDT,BORV45,PUT,NOPROTECT,BROWNOUT,NOLVP,NOWRT |
Do you still have the slow startup ?
|
Yes I have the LVP change to NOLVP. The startup ist sometimes slow like before.
On the MCLR pin is only a 10k pullup and the line vor the ISP.
For the test I disconected the ICD-U40.
Paul |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Mar 28, 2007 1:54 am |
|
|
How do you know that the PIC has a slow startup ? In your program
posted above, it looks like you have a beeper on pin C4. Is that true ?
Try a more simple program like the one below. It just turns on the
beeper for 100 ms and that's all it does.
Code: |
#include <18F6720.h>
#fuses EC,NOWDT,BORV45,PUT,NOPROTECT,BROWNOUT,NOLVP,NOWRT
#use delay(clock=16000000)
#define FNO_BEEP PIN_C4
//================================
void main()
{
output_low(FNO_BEEP);
delay_ms(100);
output_high(FNO_BEEP);
while(1);
} |
If you have a slow startup problem, I would suspect:
1. Power supply.
2. Reset circuit.
3. Oscillator circuit.
4. PIC fuse settings.
5. Other external circuits.
6. Setup code for the oscillator registers inside the PIC.
If you still have the problem with the program above, here is a question:
Do you have power applied to any of the external circuits when the
main power to the PIC is off ? In other words, do you have pull-up
resistors or an OpAmp, or some other circuit that is connected to your
PIC, but has its own power source which is still on, when the PIC's Vdd
is off ? |
|
|
pfaerber
Joined: 18 May 2004 Posts: 5 Location: Germany
|
|
Posted: Thu Mar 29, 2007 3:52 am |
|
|
After a funny day of testing I have found it :-)
I have your program changed and can than see the error in a endlees loop. In this loop I found on the scope a smal (20ns) spike in VCC down to 4,2V.
Code: |
#include <18F6720.h>
#fuses EC,NOWDT,BORV45,PUT,NOPROTECT,BROWNOUT,NOLVP,NOWRT
#use delay(clock=16000000)
#define FNO_BEEP PIN_C4
#byte LATD = 0xf8c
//================================
void main()
{
output_low(FNO_BEEP);
delay_ms(100);
output_high(FNO_BEEP);
delay_ms(1000);
//LATD = 0xff;
set_tris_e(0x00);
set_tris_d(0x00);
set_tris_b(0xff);
set_tris_a(0x22);
output_low(FNO_BEEP);
delay_ms(100);
output_high(FNO_BEEP);
while(1);
}
|
When I aktivate the LATD line all ist OK. The D port ist the data port of a CF - card. When I cange the type off the cf-card all runs fine (LATD not in).
Many thanks vor the help PCM programmer
Paul |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|