0

I am using Atmega328p with 5V power supply, My Arduino getting hangs [or auto restarts] after some times.

I am using libraries:

  • Wire.h
  • CRC32.h
  • EEPROM.h
  • Arduino.h
  • TimerOne.h
  • RtcDS3231.h
  • SoftwareSerial.h
  • Adafruit_NeoPixel.h
  • avr/wdt.h

I have tried to search, some people are deny to use software serial library.

enter image description here

Michel Keijzers
13k7 gold badges41 silver badges58 bronze badges
asked Jan 15, 2019 at 5:14
5
  • it's possibly some error in your code Commented Jan 15, 2019 at 5:17
  • This is my code, can you guide me... github.com/savaliyadnk/arduinoswitch Commented Jan 15, 2019 at 5:30
  • don't use String. use C strings (zero terminated char array) majenko.co.uk/blog/evils-arduino-strings Commented Jan 15, 2019 at 5:45
  • 1
    That is only a minimal circuit in theory. Can you show us a photo? We like to see where the decoupling capacitors are and how close the crystal with the 22pF capacitors to the atmega328p is. Commented Jan 15, 2019 at 5:50
  • Do you have 100nF connected to aref and vcc? It should be to gnd. All gnd and all vcc should be connected to the power. All of them. You have no decoupling capacitors. They are not an optional extra according to this page: gammon.com.au/bootloader Commented Jan 15, 2019 at 22:32

1 Answer 1

3

Not sure if this will fix your problem, but this is a major error:

 char buf1[8], buf2[6];
 sprintf(buf1, "%08lu", myvote.mydate);
 sprintf(buf2, "%06lu", myvote.mytime);

Take a look at sprintf function reference

A terminating null character is automatically appended after the content.

So, the text buffers are too small. It should be at least:

char buf1[9], buf2[7];
answered Jan 15, 2019 at 10:08

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.