I've been researching but have not found what I want.
for a project I'm working on I need to make my controller start up very quickly, as quickly as possible to begin executing the sketch logic.
I know there are bootloader solutions which can remove the delay on startup. Usually once this is done it requires a manual press of the reset button just prior to programming which I am ok with, but under normal operation the sketch will start running almost instantly.
I have not been able to find instructions on how to do this (or a bootloader already compiled?) for the Mega 2560. can someone point me in the right direction?
I have an uno board also which does what I want to do ideally. when I connect power to it it starts executing its logic instantly, I can see no perceptible delay at all. but I can still program it normally without pressing reset. it was given to me by a friend and I do not think its bootloader has been modified at all. is there any way to accomplish this on a mega 2560?
Umm, so you want your sketch to start running the instant its plugged in and not after about 1/4th of a second that the mega takes to turn on? Is it really that much of a rush for what you need?
yes. documentation I've found says the delay is about 2 seconds.
this project involves a situation where the arduino will be powered by request. it is not an option to leave it powered at all times. when the functions that it provides are required it will be powered up and the input indicating the request goes high at the same time. I need it to respond to that request quickly. ideally it needs to be able to activate the necessary outputs within 100ms of being powered up, 50ms would be even better. I just need it to be as fast as it can be.
I have an uno on my table doing exactly what I want it to do, the instant I connect 9V to it the outputs are activated according to the programming. but it lacks the necessary IO for this project and I want to keep it all on one board. I expected the mega to do the same thing, but found this one to delay for about 2 seconds before responding.
in one particular case my arduino will be powered down, it will receive power and get a request by a digital input going high at the same time. that pulse will last about 500ms, the arduino needs to be able to respond to it in that amount of time.
I've considered the method of removing the bootloader but I would prefer to use it as a backup plan. if at all possible I would like to retain the ability to program using the usb.
that is what I want to do, but obviously I want to do it to a mega 2560.
it would be perfect if I can make this work just like the uno. instant logic execution, and no reset required to program. if I can't get both to happen on a mega, I'm ok with needing to press the reset button to download.
Perhaps leave the power on at all times, go into a sleep mode with little power use and use an interupt to wake up on presence of the signal, perform those actions, then goto sleep again
I haven't played around with any of this yet but im sure it can be done,
also you should look into direct port manipulation if you need a whole lot done very quickly
Get yourself a programmer like this & download sketches with no bootloader via USB.
Use the "File:Upload Using Programmer" menu choice.
You will connect to the ICSP header to do that.
You can take a look at the actual code for the bootloader and make the adjustments. GitHub - msproul/Arduino-stk500v2-bootloader: STk500v2 bootloader for AVR 2560 and otherchips It looks like there is a variable boot_timeout that you can probably adjust to your preference. Then just compile a new bootloader from the modified code and upload with an external programmer. It may take some trial and error to figure out how short you can make that.