Go Down

Topic: PINs going crazy on bootup? (Read 667 times) previous topic - next topic

cbandera

Hello, hopefully someone can help me with this.

Here is the problem:
I am using an Arduino Ethernet http://arduino.cc/en/Main/ArduinoBoardEthernet with a Arduino Motor Shield R3 http://arduino.cc/en/Main/ArduinoMotorShieldR3.
When starting up, meaning either connecting it to a powersupply (USB or power cable) or after a new sketch was uploaded, my motor connected to channel B runs crazy. This means, the speed (on PMW Pin 11) is set to high and the Direction (Pin 13) changes all the time, in a high frequency.
Why is this a problem? Well I have a printermotor hooked up and on startup it runs on full power, changing it's direction many times and then just keeps running in one direction for 1-2seconds and therefor crashing in to the end of the rail.

This doesen't happen on channel A, (which uses other PINs) but I can't use that one, since I need the precious "interrupt" PIN3 for my encoder.

My guess is that it is the bootloader, since this phenomena appears even before the sketch loads. (I also tried it with the bareminimum sketch)
Now, I found several hints for this problem:

  • arduino.cc/forum/index.php/topic,51774.0.html - This post discusses, as I think, exactly my problem, but they found no solution. Also he states that the problem disappears when he connects the battery pack instead of the USB. But in my case, the external power cable produces the same problem.

  • http://arduino.cc/en/Hacking/Bootloader?from=Main.Bootloader - It says:
    Quote
    The only differences is the time the bootloader waits for a new program to arrive and the number of times it flashes the pin 13 LED when it starts.
    This would atleast explain the change in direction...


Does anyone have an explanation on why it does that? And wheather I can supress this in any way?

Thank you for your help!

SurferTim

Don't use D10-D13 for the motor. Those are reserved for the SPI bus. Both the w5100 and the SD card use it. This is from the online datasheet.
Quote
NB: Pins 10, 11, 12 and 13 are reserved for interfacing with the Ethernet module and should not be used otherwise. This reduces the number of available pins to 9, with 4 available as PWM outputs.


cbandera

Thanks for the quick answer!
That would mean, that I can only use Channel A with a motor if I want to avoid my problem, because the pins for the motorshield can not be reassigned. Well thats bad luck.
I guess my only chance is to bend the pins of the motorshield and reroute the PINs to others, that are not used?

SurferTim

Quote
I guess my only chance is to bend the pins of the motorshield and reroute the PINs to others, that are not used?

Yes, that is the normal option others take. "Pin bending" was common before the SPI data lines were put on the ICSP pins. The Mega needed pins bent and jumpers on the older models of the ethernet shield.

Go Up