Atmega328P stops working

nerdegutta

Joined Dec 15, 2009
2,684
So should i ground them?
Some consider floating pins is bad practice.

The least you can do is to set their direction to OUTPUT, and their state to LOW.

It would be a great benefit, both for you and the forum, if you drew you circuit in a CAD program, exactly like you've made it. Is it on a breadboard?
 

Papabravo

Joined Feb 24, 2006
21,157
  1. Not connected, what should i do with them? all to GND?Waht's the point for that? No matters what state 5V or GND i have there when i'm not using them. If not correct me
  2. Looks like
  3. Yeah i know i should put 10k Ohm resistor to 5V but i didn't experienced random resets yet, the problem is somewhere else
  4. 15 pin is sending some kind of signal to transmitter, no idea how it works exactly
  5. I've got 1 capacitor close to VCC and GND near atmega
  6. if(digitalRead (guzik)==LOW){msg="on";}, so i need to put GND to it to let it work
  7. It's 15
  8. 16Mhz
As i said it's working after i change the way i send the signal from "sensor", now voltage is not droping and maybe that was leading atmega to stop working.
You should not have unconnected pins unless you know for sure they are inputs with internal pullups, and I don't think you can make that claim.
Your answer to #3 is nonsense. Do you really expect us to swallow such a lame statement.
For #5, there should be at least two capacitors and the values matter. What are they?
Your answer to #6 doesn't make a lot of sense unless you want the message to be sent continuously.
For #7 I have no idea how you are implementing the data transfer and I suspect you don't either.

Did you do this design or are you duplicating someone else's design. You certainly have exhibited a substantial number of really bad habits.
 

Thread Starter

akimata

Joined Mar 6, 2016
9
I'm using someone else code
10uF
Code is working as i want that's not the point of that conversation
so Should i make all unused inputs as INPUT_PULLUP in arduino?
 

Papabravo

Joined Feb 24, 2006
21,157
I'm using someone else code
10uF
Code is working as i want that's not the point of that conversation
so Should i make all unused inputs as INPUT_PULLUP in arduino?
You can either make them outputs and set the value to either 1 or 0, or you can make them inputs with input pullups enabled. If I were you I would find out what state they are in just after the processor comes out of RESET, then duplicate that condition in the startup code, then finally set the pins you will be using to their proper values. This way you have redundancy that will always leave all unused pins in a known default state.

What you don't want is for the pins to be floating. If you try to use a port for input sometimes and output sometimes then you must go through an intermediate state where the pin floats. If it does this for a very short period of time no problem. If it does it for a relatively long time (seconds) then power consumption goes up and operation can be erratic.
 
Top