Multiple resets on arduino when plug into USB

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use arduino boards, but program them in C in AS7.

Very simple code

    // debug led on D13 (PB5)
    DDRB |= _BV(5);
    PORTB |=_BV(5);
    _delay_ms(200);
    PORTB &=~_BV(5);
    while(1);

 

It turnon on led on PB5 ports (D13 on arduino nano), whait a little and turns it off.

So, when the board is turned on i should see just one blink. However, when i plug into into a PC i see it blink from 8 to 11 times!

When i plug it into just USB charger - just one blink.

I looked at the reset line on o-scope and really see it go down multiple times when connected to PC.

As i understand it goes down when PC serial port asserts DTR signal which is connected to RESET.  One reset is ok, but 11??

Is there any explanation why Windows asserts DTR so many times? Or maybe not windows or something else.

 

I looked into this problem because this crazy line of resets also erases my RTC clock on every USB connect. But that's another story.

 

 

Artem Kuchin.
Electronics hobbyist. Born in 1976.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Its probably trying to send you a message in morse code.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Aha, a secret message from driver developer probably.

 

Found two solutions. One to put a cap between dtr and gnd on arduino. Another just cut DTR. Since i am programming using SPI anyway, i will just cut DTR.

IDIOCITY!

 

 

Artem Kuchin.
Electronics hobbyist. Born in 1976.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is one more wait to avoid it. Just put 1 second delay in the very beginning of program, so, if it resets soon then it will not execute anything further. But i need to see if it related to negative voltage spikes and does it really help.

Artem Kuchin.
Electronics hobbyist. Born in 1976.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Artem Kuchin.
Electronics hobbyist. Born in 1976.