Pages: [1]   Go Down
Author Topic: ATmega328 random reset  (Read 869 times)
0 Members and 1 Guest are viewing this topic.
Slovenia, EU
Offline Offline
Full Member
***
Karma: 0
Posts: 152
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

i made PCB for measuring temperature with some other components (fan, lcd and sd card module). I made two almost the same versions, one with Arduino Nano (for development) and one with ATmega328 stand alone (with arduino bootloader) for long-term use. All the components are basicly the same.

I finished program code and test it on PCB with Arduino Nano.. Everything is working like it should, without any problems. I burned bootloader in new ATmega328 and load exactly the same program on it. On this stand alone version i am getting random resets from time to time, totally without any logical iteration.

Any ideas? I can upload circuit scheme if it will help.
« Last Edit: January 11, 2013, 05:16:33 pm by luxy » Logged

Anchorage, AK
Offline Offline
Edison Member
*
Karma: 37
Posts: 1150
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would minimize the code as much as possible.  In fact, run Blink on it for a while if you have an LED onboard.  Try to separate hardware and software faults any way you can.

Is the BOD set on the mega?  Check supply voltages.  Can you post a pic of your PCB?  Maybe we can see something obvious.
Logged

Slovenia, EU
Offline Offline
Full Member
***
Karma: 0
Posts: 152
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I uploaded the whole scheme..

What is BOD? I don't know what's that mean. I measured supply voltages and they are fine, stable 5V.

https://www.dropbox.com/s/9zl9ygkf4lyvep1/scheme.pdf
« Last Edit: January 11, 2013, 05:52:24 pm by luxy » Logged

0
Offline Offline
Shannon Member
****
Karma: 162
Posts: 10523
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Brown-out detection.  Google would tell you that!

My first guess is decoupling.  But a photo and/or schematic are very illuminating usually.
Logged

[ I won't respond to messages, use the forum please ]

Anchorage, AK
Offline Offline
Edison Member
*
Karma: 37
Posts: 1150
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't see anything obviously wrong from the schematics.  An actual photo of the PCB itself might help though.
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 44
Posts: 2813
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The schematic was very good well laid out and almost perfect but it can't possibly work as drawn or designed. The CD4050 or 74HC4050 or whatever is a 5V part and I assume that the device was intended as a level shifter for the 3V3 SD card? Most of the ones I've seen are 3V3 interface and your level shifter Vcc is connected to 5 V defeating the level shifting, were it so you could have used one of the remaining 3 buffers for the MISO connection from the card to the controller. In my opinion you need the .1 uF capacitors right at both the display Vcc and on the '4050 as well as the two 'obligatory' caps on the controller's analog and digital Vcc connections and I think that the best method for a multi-chip board as busy as yours (not a nano or pro..) really requires both caps right at the IC for best results.

Bob
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Offline Offline
Sr. Member
****
Karma: 9
Posts: 296
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is the standalone version in a case? case properly grounded?

If not, you may get freezing, hangups, or random resets.
Logged

Slovenia, EU
Offline Offline
Full Member
***
Karma: 0
Posts: 152
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

-74HC4050 is for SD card level shifting
-74HC595 is for LCD multiplexing
-TC670 is fan failure IC

I am using SD card module with voltage regulator (LC Studio)
http://www.ebay.com/itm/1pcs-ARM-MCU-NEW-SD-Card-Module-Slot-Socket-Reader-For-Arduino-/121048128832?pt=LH_DefaultDomain_0&hash=item1c2f07dd40

For now, the whole PCB is not in the case. How can version with Nano work ok without being put in case, although everything is basicly the same (or isn't?)

In my opinion you need the .1 uF capacitors right at both the display Vcc and on the '4050 as well as the two 'obligatory' caps on the controller's analog and digital Vcc connections and I think that the best method for a multi-chip board as busy as yours (not a nano or pro..) really requires both caps right at the IC for best results.

I put 16MHz crystal and 22pF as close as possible. Crystal is under the ATmega socket and two caps are as near as possible. Could you please draw it in my scheme picture, where and how exactly should i put those another caps? You say 0,1 uF (probably ceramic).

I uploaded 3 pictures of actual PCB.

Top
https://www.dropbox.com/s/m6a4607nn2wdy0s/pcb_top.jpg

Bottom
https://www.dropbox.com/s/bc484s3vj4ocn6p/pcb_bottom.jpg

Working
https://www.dropbox.com/s/dqns05w5me7luqn/pcb_working.jpg

Scheme
https://www.dropbox.com/s/9zl9ygkf4lyvep1/scheme.pdf
Logged

The Netherlands
Offline Offline
Edison Member
*
Karma: 36
Posts: 1304
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Those caps go as close as possible across pins 1 and 16 of the -595, pins 1 and 8 of the 4050.
So it's just like the TC670 you put on that small pcb.
You should always use such cap directly at any logic IC.
Logged

Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

Slovenia, EU
Offline Offline
Full Member
***
Karma: 0
Posts: 152
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I will try that and report.. Thanks!
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Three possibilities come to mind:

1. Lack of decoupling capacitors. See previous posts. The most important one is between Vcc and Gnd of the atmega328p. I suggest you solder one directly across the Vcc and ground pins of the chip, on the underside of the board, with really short leads.

2. Power supply brownout, e.g. if the peak fan current is too much for either the 7805 or the supply that is providing 12V. Need to know more about the fan and the supply before we can discount this as a possibility.

3. Software problem.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 44
Posts: 2813
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Somehow you missed this part...
Quote
The schematic was very good well laid out and almost perfect but it can't possibly work as drawn or designed. The CD4050 or 74HC4050 or whatever is a 5V part and I assume that the device was intended as a level shifter for the 3V3 SD card? Most of the ones I've seen are 3V3 interface and your level shifter Vcc is connected to 5 V defeating the level shifting, were it so you could have used one of the remaining 3 buffers for the MISO connection from the card to the controller.
Before that board is going to work you will have to fix the level shifter Vcc. If the CD4050 is seeing 5V as it's supply it will output 5V.. Not 3V3 as you need for proper operation.
{Edit}
Bob
« Last Edit: January 12, 2013, 01:31:42 pm by Docedison » Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Slovenia, EU
Offline Offline
Full Member
***
Karma: 0
Posts: 152
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Before that board is going to work you will have to fix the level shifter Vcc. If the CD4050 is seeing 5V as it's supply it will output 5V.. Not 3V3 as you need for proper operation.
{Edit}
Bob

Oh my.. Hmm.

I saw that sd card module have voltage regulator for 3,3V. It uses AMS1117 and it should provide up to 1A current. Is it possible to use this voltage regulator for supplying 74HC4050? I think in my case this would be the easiest solution, if it could work that way of course.
Logged

Slovenia, EU
Offline Offline
Full Member
***
Karma: 0
Posts: 152
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think i solved my problem.. 

Like i said in my previous post, now i am powering 74HC4050 through 3.3V regulator. I also added 0,1uF ceramic caps between VCC and GND of ATmega328, 74HC4050, 74HC595 and LCD. 

Up till now (after half an hour of testing) everything works fine, without problems.. And i hope it will stay that way smiley 

Thank you for all guys! smiley-grin
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 44
Posts: 2813
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A Good Job, well Done.

Bob
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Pages: [1]   Go Up
Jump to: