Auto reset problem on Atmega4809

Hi everyone
I wrote a code for serial testing.

I made a simple counter for each data transmission, and I noticed that the processor automatically resets at the same point or count value.

Does anyone know what's happening?

[code]
//
#define led 39
int counter = 0;

void setup()
{
  pinMode (led, OUTPUT);
  
  delay(1000);
  Serial.begin(9600);
  Serial.println("START"));

    digitalWrite (led, HIGH);
    delay (300);
    digitalWrite (led, LOW);
       counter = 0; 

}   // end setup routine
//------------------------
void loop() {
          counter += 1;     
          Serial.println (counter);
 
//      Serial.println ("Hello World");
        digitalWrite (led, HIGH);
        delay (500);
        digitalWrite (led, LOW);
        delay (1500);

}   // end main loop

[/code]

I disabled the reset pin (40) and left it as GPIO and the problem stopped.

Short circuit between PF5 and PF6?
No pullup resistor PF6 (RESET)?

Watchdog reset?

Hi, @jjcohen

Have you got a current limit resistor in series with the LED?

What Arduino controller are you using?

Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

How are you powering your project?

Some images of your project would also help.

Thanks.. Tom.... :smiley: :+1: :coffee: :australia:

That doesn't compile.

 Serial.println("START");

Tom.... :smiley: :+1: :coffee: :australia:

Hi everyone.
Thank you for all the replies.
I discovered that the reset problem was caused by a watchdog timer connected to the circuit's reset line. When this timer is not triggered, it resets the microcontroller.
I use this timer to wake up the MCU every minute, as I turn it off completely to save power.
Therefore, this topic could be closed. Additional information below.

I have another question about the possibility of using the <SPI.h> library for the atmega4809 chip, so I ask: should I ask here or open another topic?

I would start a new topic as it does not sound like the new question has a relation with the problem described in the tile of this topic.

That shows that you should provide full information in an opening post; in this case your opening post should have included the schematic. Somebody could have picked up the WDT as a possible culprit 23 hours ago :slight_smile:

2 Likes