my MicroController resets repeatedly

Go To Last Post
58 posts / 0 new

Pages

Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hello every body

in my project i have used SIM800C and Atmega32A.

i used this circuit for supply(Recommended in SIM800C Hardware design):

 

and this is the sim800c circuit(Extracted from sim800c hardware design):

and this is microController circuit:

and connections:

 

and entire PCB:

 

in above PCB, P2 and P3 are headers to connect board to my AVR programmer through ISP.

when programmer is connected to my board the circuit works good 

But when I disconnect the programmer and want to use the board stand alone, MicroController resete for multiple times when:

1.when SIMCARD is going to be registered in network.

2.when I want to call the simcard

 

note:

1.doesn't matter what program is burned into Uc, it resets.

 

here is a video from the problem:

https://youtu.be/0AHXApNwDIU

 

 

This topic has a solution.
Last Edited: Wed. Jun 6, 2018 - 03:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

WHERE are all the capacitors at your processor pins ???   Are the power supply capacitors soldered directly to the pins?

Please point out exactly the bypass caps for the chip 

 

Why on earth are some resistor smd & others through hole?  Makes no sense at all.

 

The crystal caps must be grounded to the processor pins, not some remote gnd connection. The crystal should be located right at the pins  (it's probably at a tolerable distance now, but not ideal)

When in the dark remember-the future looks brighter than ever.

Last Edited: Wed. May 23, 2018 - 05:02 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would imagine that both registering with a network and receiving a call both require the most amount of current for the SIM800C, which may be causing the voltage to drop elsewhere, such as micro_VDD. Your ISP likely provides enough current, but the circuit supplying it from battery does not.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

i don't see the required 100nf caps placed across the VCC/GND and AVCC/GND pin pairs as close to the micro as possible.

 

Jim

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
WHERE are all the capacitors at your processor pins ???   Are the power supply capacitors soldered directly to the pins? Please point out exactly the bypass caps for the chip

I didn't use power supply caps on micro. there is only one 100n cap from AREF to gnd.

 

avrcandies wrote:
Why on earth are some resistor smd & others through hole?  Makes no sense at all.

because UC was through hole I used it's resistors through hole. I don't know it is a mistake or not.

 

 

MalphasWats wrote:
I would imagine that both registering with a network and receiving a call both require the most amount of current for the SIM800C, which may be causing the voltage to drop elsewhere, such as micro_VDD. Your ISP likely provides enough current, but the circuit supplying it from battery does not.

you are right and I tested it: I added another supply for UC separately and isolated it from sim800 supply but problem didn't solved.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

reza_mslm wrote:
I didn't use power supply caps on micro. there is only one 100n cap from AREF to gnd.

You MUST use bypass caps on both pairs of power pins, placed close to the micro!!!

 

 

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:
i don't see the required 100nf caps placed across the VCC/GND and AVCC/GND pin pairs as close to the micro as possible.   Jim

 

I didn't used VCC/GND cap but used 100nf AVCC/GND (C7).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:
You MUST use bypass caps on both pairs of power pins, placed close to the micro!!!

what kind of cap? what value?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

100n ceramic

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
100n ceramic

I will do it and say the result

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

reza_mslm wrote:
I didn't used VCC/GND cap but used 100nf AVCC/GND (C7).

C7 is on the AREF pin, that is good, but you also need 100nf across each VCC/GND(pins 10/11) and AVCC/GND (pins 30/31) pin pairs, use ceramic disc caps on the bottom of your

board connected to the pins (keep leads as short as possible) and you should be ok. 

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

Last Edited: Wed. May 23, 2018 - 05:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Keep learning, much better than watching TV all day...if you keep at it you will get good results.

Proper grounding & bypassing are rather important, as well as solid connections.

When in the dark remember-the future looks brighter than ever.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:
C7 is on the AREF pin, that is good, but you also need 100nf across each VCC/GND(pins 10/11) and AVCC/GND (pins 30/31) pin pairs, use ceramic disc caps on the bottom of your board connected to the pins (keep leads as short as possible) and you should be ok. 

 

I did it but didn't solved the problem

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
Keep learning, much better than watching TV all day...if you keep at it you will get good results. Proper grounding & bypassing are rather important, as well as solid connections.

I Love learning but I'm a newbie and need to be guided.

this is a good forum for me to learn and thankyou every body that shares his/her knowledge

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can you measure current from your supply **before** it resets? (some meters can detect peak values) -idea from post 3-

What does BOD mean?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

reza_mslm wrote:
I did it but didn't solved the problem

Ok, so now you need to troubleshoot when the reset occurs.  Do you have a debugger?

If so, use it to find where in the code the reset happens, is it just after initiating a SIM tx packet?

Do you have access to a fast Oscope that you can use to monitor the VCC line, looking for voltage drops?  When do they occur?

You may need to "bulk up" your power supply output cap, double or tripple it's size, i.e. instead of 100uf, use 220 or 470uf. 

 

Let us know how it goes.  Others may jump in with more suggestions.

 

Jim

 

 

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dbrion0606 wrote:

Can you measure current from your supply **before** it resets? (some meters can detect peak values) -idea from post 3-

What does BOD mean?

-sim800c is more sensitive to voltage and current than UC, I think if voltage/current  was insufficient that module would be turned off first.

-brown out detector is enabled and set to 2.7v

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:
Ok, so now you need to troubleshoot when the reset occurs.  Do you have a debugger? If so, use it to find where in the code the reset happens, is it just after initiating a SIM tx packet?

I don't have Debugger but dont think it's necessary because as mentioned in first post it doesn't matter what code is burned into UC(tested it). even I disconnected RX and TX pins between module and UC and even seperated their VCC and GND but again when making a call the UC was reseted,changing UC doesnt solved too.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your power traces for your micro go along way around your board and look to be kinda narrow in some spots. Try taking a wire from your output caps on your regulator directly to your vcc pin and see if that helps, it kinda sounds like a bod problem. An oscilloscope on the vcc pin may show this

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:
Do you have access to a fast Oscope that you can use to monitor the VCC line, looking for voltage drops?  When do they occur? You may need to "bulk up" your power supply output cap, double or tripple it's size, i.e. instead of 100uf, use 220 or 470uf. 

 

I dont have oscope.

I tried a 1000uf electrolytic cap but didnt solved.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

reza_mslm wrote:

ki0bk wrote:
Ok, so now you need to troubleshoot when the reset occurs.  Do you have a debugger? If so, use it to find where in the code the reset happens, is it just after initiating a SIM tx packet?

I don't have Debugger but dont think it's necessary because as mentioned in first post it doesn't matter what code is burned into UC(tested it). even I disconnected RX and TX pins between module and UC and even seperated their VCC and GND but again when making a call the UC was reseted,changing UC doesnt solved too.

 

It's possible that the micro isn't resetting, but some runaway code could wrap the program counter back to 0000, which would look like a reset has occurred.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dksmall wrote:
It's possible that the micro isn't resetting, but some runaway code could wrap the program counter back to 0000, which would look like a reset has occurred.

Yes!

A debugger would be most helpful with this...

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dksmall wrote:
It's possible that the micro isn't resetting, but some runaway code could wrap the program counter back to 0000, which would look like a reset has occurred.

so why when the programmer is connected to board problem is vanished?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

reza_mslm wrote:
so why when the programmer is connected to board problem is vanished?

It provides a better gnd connection then you have provided on the PCB, and depending on the programmer used, perhaps a better VCC supply as well.

Layout a better PCB, or modify the one you have to "beef up" the VCC and GND lines to the mpu.

 

 

Jim

 

 

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

reza_mslm wrote:

I dont have oscope.

I tried a 1000uf electrolytic cap but didnt solved.

 

Bigger is not always better, because of a minor detail called 'parasitic inductance' where a big capacitor (particularly electrolytic!) will look like an inductor too.

 

Better is lots of little ones splattered all over.  Furthermore, you want many paths (of wide traces) for power and ground to get around the board.  Ideal is a solid plane, a grid is a close second.  If it looks more like a tree, with the AVR on the end of one branch somewhere, it will not be reliable.  I'm saying again what has been said before, really - add wires for power and ground everywhere they can be easily hooked together, and add lots of little capacitors.

 

Have fun, S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Write a simple program to blink your leds...it works with the programmer connected, yes?  Use NO inputs.  Now try running on its own (no programmer)......this might help to narrow down if it is something strange in your real code (like noise getting in on some pins & making the code react/fail).

When in the dark remember-the future looks brighter than ever.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
Write a simple program to blink your leds...it works with the programmer connected, yes?

yes

 

avrcandies wrote:
Use NO inputs.  Now try running on its own (no programmer)

micro resets like before.

 

Scroungre wrote:
Bigger is not always better, because of a minor detail called 'parasitic inductance' where a big capacitor (particularly electrolytic!) will look like an inductor too.   Better is lots of little ones splattered all over.  Furthermore, you want many paths (of wide traces) for power and ground to get around the board.  Ideal is a solid plane, a grid is a close second.  If it looks more like a tree, with the AVR on the end of one branch somewhere, it will not be reliable.  I'm saying again what has been said before, really - add wires for power and ground everywhere they can be easily hooked together, and add lots of little capacitors.   Have fun, S.

thankyou for your help

I will test it and say the result

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The PCB does not match the schematic.

 

On the PCB the 5V rail leaves the power supply section and goes via what looks like a diode before traveling all over the board.

 

Yellow is the 0V rail, Green is VCC...

 

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Also, did you look at the datasheet for the LM2596?

 

There are many many examples in there for 'good' PCB layouts. Yours is not one of them.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I noticed that , on the avr side, it  PCB is one sided -blue color-  (hope I am wrong). It would be easier to make a huge ground on the other side, including U3 ground (at least). Xal capacitors have long connections, too : huge ground would help to fix it.... and, more generally, to make connections shorter (5 v connections are long, too)

I bet the PCB is two sided -this is more expensive than 1 side-  : why only use one side on huge parts of it?

Last Edited: Thu. May 24, 2018 - 09:56 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:
On the PCB the 5V rail leaves the power supply section and goes via what looks like a diode before traveling all over the board.

D12 is not a diode

it's a ferrite bead

because I had not ferrite footprint in my library,I placed a Diode footprint but mounted a ferrite!(sorry I had to metioned it. in order to prevent wasting your time)

 

Brian Fairchild wrote:
Also, did you look at the datasheet for the LM2596?   There are many many examples in there for 'good' PCB layouts. Yours is not one of them.

the circuit for LM2596 I used is recommended in SIM800C hardware design.

 

dbrion0606 wrote:
why only use one side on huge parts of it?

you are right. i had to use empty area to optimize connections.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I placed a 100nf ceramic disc cap and a 1000uf electrolytic cap on AVCC/GND and  (100nf + 18pf) ceramic disc cap on VCC/GND pins.

now the circuit works good but i think I have to put the board under test for many hours. I hope it to be solved.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

reza_mslm wrote:

Brian Fairchild wrote:

Also, did you look at the datasheet for the LM2596?   There are many many examples in there for 'good' PCB layouts. Yours is not one of them.

the circuit for LM2596 I used is recommended in SIM800C hardware design.

 

I didn't mention the circuit design; I commented on the physical PCB layout. This is an example of a good LM2596 layout...

 

 

See all that copper? That's a good thing. Now look at your layout. See all those thin long tracks? That's a bad thing.

 

People forget that a wire is also an electrical component. It has resistance, inductance and capacitance. All of which can make a circuit which looks simple on paper way more complicated in the real world.

 

This is a part of a board design I have in my PCB editor right now. The red tracks are on the top, the blue on the bottom. The green is on the bottom as well and is my 0V rail. Big isn't it?...

 

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It occurs to me as an aside that your inductors may be saturating, as well.  Compare the physical size of the inductor on Brian's layout vs. the size of yours.

 

It's a function of DC current - too much DC and they don't 'induct' anymore.  Just throwing this out there too...  S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This diagram from the datasheet shows which tracks should be in thick copper...

 

 

 

And on the subject of inductors, there's a section in the datasheet about choosing the current size.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have you scoped your 5V power supply right at the AVR?  Take a look, is it clean, or are there dropouts?  That could cause a reset (especially if the brownout BOD fuse is set).  If the programmer provides power, it might make up for poor power from your board.

What programmer is used?

 

When in the dark remember-the future looks brighter than ever.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

Have you scoped your 5V power supply right at the AVR?  Take a look, is it clean, or are there dropouts?  That could cause a reset (especially if the brownout BOD fuse is set).  If the programmer provides power, it might make up for poor power from your board.

What programmer is used?

 

 

the power is 3.98v and is constant. but when i make a call it drops to about 3.92v. BOD is enabled and is set to 2.7v.

I use USB asp programmer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

when I remove the 18pf cap from VCC/GND reset occures when sending SMS and sometimes when making a call and if I put it on no reset occurs. I think problem is solved.

in my idea, altough I had some mistakes on pcb design but putting the capacitors (post #32) prevented faults.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

reza_mslm wrote:

avrcandies wrote:

Have you scoped your 5V power supply right at the AVR?  Take a look, is it clean, or are there dropouts?  That could cause a reset (especially if the brownout BOD fuse is set).  If the programmer provides power, it might make up for poor power from your board.

What programmer is used?

 

 

the power is 3.98v and is constant. but when i make a call it drops to about 3.92v. BOD is enabled and is set to 2.7v.

I use USB asp programmer.

 

Is that 3.92v measured with a multi-meter of with a scope???

 

If its with a multi-meter then your voltage may drop alot lower then that becuase of how slow a multi-meter is, so power may drop below 2.7v and be triggering the bod.

 

A scope will let you see how low the voltage actually gets and for how long.

 

im worried that your Micro is only seeing 3.92v with a 5V supply, This confirms that your 5v traces and ground trace are way to small

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

reza_mslm wrote:

when I remove the 18pf cap from VCC/GND reset occures when sending SMS and sometimes when making a call and if I put it on no reset occurs. I think problem is solved.

in my idea, altough I had some mistakes on pcb design but putting the capacitors (post #32) prevented faults.

 

I would replace the 18pF with a higher value 100nF is a good value, would insure no ghost resets in the future

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kuch wrote:

reza_mslm wrote:

when I remove the 18pf cap from VCC/GND reset occures when sending SMS and sometimes when making a call and if I put it on no reset occurs. I think problem is solved.

in my idea, altough I had some mistakes on pcb design but putting the capacitors (post #32) prevented faults.

 

I would replace the 18pF with a higher value 100nF is a good value, would insure no ghost resets in the future

 

18pf is parallel with 100nf

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kuch wrote:
Is that 3.92v measured with a multi-meter of with a scope???   If its with a multi-meter then your voltage may drop alot lower then that becuase of how slow a multi-meter is, so power may drop below 2.7v and be triggering the bod.   A scope will let you see how low the voltage actually gets and for how long.   im worried that your Micro is only seeing 3.92v with a 5V supply, This confirms that your 5v traces and ground trace are way to small

 

yes multi-meter.

sopply is 4v 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think I have to re-design my pcb in order to be reliable

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I noticed the resistor values  on the post schem  won't give 5v, but wasn't sure what actual values were used...apparently it is indeed 4V

When in the dark remember-the future looks brighter than ever.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

4V is marginal, especially given the clock speed (which isn't specified, as far as I can see - Did I miss something?).  Why not set it to 5V?

 

And yeah, you're right, your PCB isn't right.  It's good to do it again, and this is how you learn.  Don't worry too much about board re-spins (re-spin is what they call making a new modified board).  It happens.  It's expensive, but aren't all the best lessons that way? 

 

S.

 

Edited to add PS - Yeah, 18pF is real small.  I told you about putting 'lots of little caps' around, but I should have qualified it to say 'not that small'.  The cap generally specified as a decoupling capacitor to be splattered around the place is 0.1uF, aka 100nF, or 100,000pF...  I'd install about four, 0.1uF, neatly spaced around the AVR, and make that power and ground layout look a lot more like a grid and a lot less like a tree.   S.

Last Edited: Fri. May 25, 2018 - 07:01 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Scroungre wrote:
4V is marginal, especially given the clock speed (which isn't specified, as far as I can see - Did I miss something?).  Why not set it to 5V?

 

I use Atmega32A which works at 2.7v-5.5v and sim800c works at 3.4v-4.4v(recommended is 4v) so i preferred 4v for both. BOD is enabled and set to 2.7v and clock is 8Mhz.

Last Edited: Fri. May 25, 2018 - 01:36 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I edited the PCB layout.

oscillator is placed near the UC, VCC/GND path is wided and distributed, supply circuit paths got wided and holes for VCC/AVCC/GND caps are added to place caps.

please say your opinions. will this work good?

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That should work better!  Nice job!

 

Jim

 

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If C8 and C9 were SMD, Xal connections could be made shorter, leading to a better clock.

 

What is Xal frequency (http://ww1.microchip.com/downloa... p362 if voltage is too low, 16 Mhz Xals can work ... or not (there were 3.v arduini clones, with 16 Mhz clock: though they were nice, they could not be mass produced as a portion of them could fail -else, people were very happy- )?

 

size of the board could decrease (thus prices). But I bet you already have a box...

Last Edited: Fri. May 25, 2018 - 03:14 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Where are the holes by the processor pins for your power pin caps?  Are they the holes to the left of Y1?

 

how does the blue hook to the red (or maybe I'm not looking properly)

 

Check everything carefully, especially for shorts, since you went wild with connecting via's between layers

 

 

This Trace is probably too close to the mounting hole.

You don't want the screw head to hit it & to also clear it with plenty of room  (also consider the board can wiggle around in the mounting holes, possibly bringing the head or washer closer to the trace)  ...same for any standoff or boss on the bottom side.

 

 

 

When in the dark remember-the future looks brighter than ever.

Last Edited: Fri. May 25, 2018 - 07:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Okay, it's the sim card gizmo that won't do 5V.  And you're only running the AVR at 8MHz.  4V should be fine for that (I tend to run my AVRs absolutely flat-out, so I like high(er) voltages).

 

And you didn't 'alf have fun with those thru-vias!  (they cost about a penny each, you know...)  I like the ones under/around the voltage regulator, but most of the ones out in the corners aren't doing much.  You could easily get away with fewer in a tidy row.  I would also put a few more decoupling capacitors (those 0.1uFs we're so on about) as well as those right next to the AVR out on the 'ends of the line' as it were.  Such that the longest runs of power and ground have a capacitor at the end(s).  (And I know, they're 10c each...)  S.

 

Edited to add another suggestion:  You did okay with a big patch of copper under U3 in the first place as a heat sink, but more copper is better, and you, when you get around to assembling the board, might want to fill those thru-holes with solder so heat carries itself away on both layers.  For that, you may want a bigger hole, but it's expensive to have yet another drill size required.  These are choices every board designer confronts.  S.

Last Edited: Fri. May 25, 2018 - 10:54 PM

Pages