pin condition after hardware reset

when i reset the arduino sometimes pins that had a pwm-signal on them stay high, causing (for example) a motor to spin very fast. the spinning stops after my program initialises the port/timer for that pin again, but only after the initial bootloader delay. adding an pulldown resistor did not help.

is my assumption correct that the arduino bootloader does no initialization on the ports or timers, so the ports/timers retain their last state?

spok:
when i reset the arduino sometimes pins that had a pwm-signal on them stay high, causing (for example) a motor to spin very fast. the spinning stops after my program initialises the port/timer for that pin again, but only after the initial bootloader delay. adding an pulldown resistor did not help.

is my assumption correct that the arduino bootloader does no initialization on the ports or timers, so the ports/timers retain their last state?

Ports and timers do not retain their last state through a reset. Ports are in input mode after reset, high-Z without pullup resistors enabled. The bootloader doesn't change this as far as I am aware.

The bootloader change pin13 (the blink LED), and the Serial port pins, but doesn't do anything to any other pins.
Note that a pin connected to modern CMOS logic (motor drivers, etc) that suddenly becomes an input, may appear to retrain its previous state, just because of capacitance on the output and input gates and wiring...

Pin 5 (with pulldown) goes into a 74LS04 (quad inverter). The output of the inverter sometimes stays low during a reset.

Any idea what i'm missing?

Why on earth would you be using an obsolete logic family?

As others have pointed out, at reset (and until the sketch defines them otherwise) the Arduino pins are open circuit (inputs, actually).

So if you have a pull-down on it, it will be LOW until the sketch takes control of it.

If using HCMOS and no pull-up/ pull-down, it will be a random value until the sketch takes control of it. If reset is pressed, this value will probably be what it was the moment the reset was pressed.

PaulB - regardless of the wisdom of his choice of logic family, the way I interpret his post, that does not explain his issue.

He says that he has pin 5 connected to the input and a pulldown. If the pulldown is on pin 5, between the inverter and output, when the arduino pin goes high-impedance on reset, it should get pulled to gnd by the pulldown, so the output of the inverter should go high.

He reports it sometimes stays low...

What size is the pulldown? Actual TTL gates require quite-a-bit of current (~1mA) to be sunk to pull them low, compared to modern CMOS logic; that's one of the reasons that "pull ups" tended to be the default. Throwing on a 10k resistor like you can do for an AVR input may leave the input biased into "bad" territory.

10k pulldown, on arduino output leading to 74 chip

So try a 5K or 1K then.

So try a 5K or 1K then.

TTL is famous for liking "2.2k"
(I'm not sure why; that was typically a pullup value, and the pullup currents are much smaller than the pull-down currents, so they don't need to be that value. It may date back to some very old chips...)

westfw:
Actual TTL gates require quite-a-bit of current (~1mA) to be sunk to pull them low

Changed to 1K (5mA), workling like a charm. thanks.