Reducing the bootloader delay

Hi all,

Is it possible to reduce the bootloader delay without reflashing an entirely different bootloader? I'm trying to turn my Duemilanove into a device that, when plugged into a Windows PC, will automatically be detected (via plug and play) and appear as an installed device.

When I plug the Arduino in it successfully gets probed, and luckily enough the probe signal causes the Arduino to reset, which means I can put all my plug and play code in the setup() function. The PnP spec only allows about 200ms to respond to the probe, which means my setup() function has to send data out the serial port within 200ms of the reset.

Unfortunately the bootloader delay is just long enough that I can't make it in time, and after the Windows PnP enumerator resets the Arduino half a dozen times it gives up and doesn't detect any device attached to the USB serial port.

Rather than flash some other bootloader (which is difficult as I don't have an external programmer yet), can I set some fuses or program some EEPROM values to change the behaviour of the bootloader? Or even better, can I tell the bootloader not to wait at all unless (say) digital pin 2 is set to high?

can I set some fuses or program some EEPROM values to change the behaviour of the bootloader? Or even better, can I tell the bootloader not to wait at all unless (say) digital pin 2 is set to high?

Sorry no. :cry:

Does this thread help?

yes but he said he didn't want to burn a new boot loader.

My bad... didn't read to the end, I think...

Thanks for the replies. I've had a look around and seen reference to a fuse that tells the chip to ignore the reset signal. Has anyone tried this? I think avrdude is able to set these fuses.

I imagine setting these would stop the onboard reset button from working though, so I guess the only way to upload a sketch would be to power cycle the Arduino and time it correctly with the sketch upload?

Yes; disabling the reset pin is probably a bad idea. In addition to the issues you mention, it means that you'd probably also need a high-voltage programmer to change anything back.

I'm not sure why you think changing a fuse bit is easier than loading a new bootloader; either one is going to require some sort of device programmer. Note that there are hacks available that allow the arduino bootloader to be reprogrammed using "easy" hardware like another arduino, or even the extra pads available from the ftdi chip; you don't necessarily need to go out and buy new hardware.

Can you simply turn off the auto-reset function so that your device is reset only when powered on (by plugging into USB), rather than when "probed" by PNP? It could then set around waiting for the probe and respond appropriately. Or does the probe happen too soon after power-on ?

I assumed changing a fuse bit was easier than loading a new bootloader because I thought avrdude could set the fuse bits using the STK500v1 bootloader that ships with the Arduino. It can certainly read out the fuse bits so I assumed it could write them too…is that incorrect?

The main reason why I don’t want to reflash the bootloader is because I don’t currently have any hardware to restore it if I break it.

Can you turn off the auto-reset function? That’s all I need, I can power up the device and then plug in the USB plug. The problem is that the PNP detection routine toggles the DTR line which causes the Arduino to reset (since that’s how the Arduino IDE triggers a reset to upload a sketch.)

If I could temporarily disable that (without cutting traces etc.) then it would solve the problem.

I also have one of those FTDI breakout boards which I might be able to wire up to the Arduino instead, which would allow me to connect the DTR line to one of the interrupt pins instead, which is probably more reliable - but I would prefer to do it with “stock” hardware, because then I can post my code for others to try out and learn from. The more changes there are, the fewer people who will be able to run it.

without cutting traces

I had in mind cutting the trace. You can still upload using the reset button. At least one of the clones put a switch on the autoreset signal, I think (Seeedstudio?)