Random Boot PWM

Hi,

I have an Arduino Mega Pro 5V from Sparkfun mounted to a PCB with some DRV8801 on it.

When I program the Mega-Digital Pin 13 twitches high and low, making the DRV8801 spasm. This also happens as the Mega is booting. Once the program kicks in, the pin is usable and seems to function correctly. The DRV8801 has the correct output and direction as directed by the Mega.

I have tried adding a 7.5k pull down to the pin with no change.

I have tried removing the built in LED on that pin with no change. When the LED is in place, it flashes on and off during programming and boot up.

I have other Analog pins connected to other DRV8801 (identical circuits) that do not have this issue-just digital 13. The other analog pins in use are 2,3,4,5,6,7,9,10,11,12. These all work correctly when the Mega is booting.

I have tried a different Mega with no change. I have tried having the main program uploaded be “Hello World” with no change.

The issue does not seem to be with the uploaded program, but rather in the act of programming and boot up sequence.

Help appreciated Thanks in advance.

The schematic shows a 470 ohm resistor going to ground via the LED so 7.5k will do nothing.

Since it flashes during programming, perhaps the bootloader code has been modified to use that LED as a TX or RX indicator. The only way to fix that would be to upload a new bootloader via the ISP pins.

You may be correct. The only info I can find (not mega specific) from the Arduino bootloader page:

The bootloader is active for a few seconds when the board resets; then it starts whichever sketch was most recently uploaded to the microcontroller. The bootloader will blink the on-board (pin 13) LED when it starts (i.e. when the board resets).

And it looks like this is the case with the Optiboot-which I think is what the Mega Pro uses?

I cannot change the bootloader at this time-looks like I may be haywiring over to analog pin 8...

The SparkFun page says that it uses a modified bootloader. They should have posted the source code on Github but I haven't looked to see if it's there.

I don't know why you couldn't use a standard bootloader - there must be something different about the particular installation. Since it uses an FTDI header and not a 16U2 USB chip, there may be some differences but I don't think it's significant.

Obtaining a copy of Optiboot source code and removing any pin13 output should not be too hard.

Once you have an Arduino programmed as an ISP programmer, then you can take a copy of the bootloader off the Mega Pro and keep it as a backup in case your modified bootloader doesn't work. You just can't modify that backup, as it will be a binary or hex file.