Go Down

Topic: ATmega328 random reset (Read 1 time) previous topic - next topic

luxy

Jan 11, 2013, 11:15 pm Last Edit: Jan 11, 2013, 11:16 pm by luxy Reason: 1
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.

SirNickity

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.

luxy

#2
Jan 11, 2013, 11:48 pm Last Edit: Jan 11, 2013, 11:52 pm by luxy Reason: 1
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

MarkT

Brown-out detection.  Google would tell you that!

My first guess is decoupling.  But a photo and/or schematic are very illuminating usually.
[ I won't respond to messages, use the forum please ]

SirNickity

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

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
--> 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

vasquo

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

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

luxy

-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

MAS3

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.
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

luxy

I will try that and report.. Thanks!

dc42

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.
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.

#11
Jan 12, 2013, 07:29 pm Last Edit: Jan 12, 2013, 07:31 pm by Docedison Reason: 1
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
--> 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

luxy


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.

luxy

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 :) 

Thank you for all guys! :D

A Good Job, well Done.

Bob
--> 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

Go Up