How to speed up serial port initialization and bootloader?

Hello,

My project has a PC application talking to an arduino nano through the serial port.

My issue is that it takes around 5 seconds of my application sending the "hello" character to the nano before it "reacts"....

I am guessing that this is because the bootloader is in the way waiting to see if it's not signal for it to do something, but I am not 100% sure.

Can anyone tell me what I should do to speed up the process?

Thanks,
Cyrille

Please post your sketch so that we can see how you deal with the incoming Serial data

Are you by any chance using a function such as Serial.readString() that only terminates after a timeout occurs, and how is the Serial data terminated, if at all ?

Program it in ISP mode to get rid of the boot loader, or build and install a boot loader with a shorter delay.

2 Likes

The bootloader is only active after resetting the Nano. Once the sketch started, only your sketch can be waiting for data on serial.

I think that's the point.

The PC application opens up the serial port, which reboots the arduino and it takes some time before the setup() is reached and the Serial.begin() is executed and the connexion between the PC app and the arduino can proceed.

I've seen 2s, 5s seems large

but once the connection is established, then indeed there is no lag anymore (well only the baud rate and what the app is doing)

Hello

What? Openning the com port on the PC resets the arduino! I had not even noticed that...
But that would explain what I am seeing...

This is actually problematic for me! Is there a way to change this behavior?
Or is there some type of secret handshake in the bootloader to tell it to imediately drop to the main program?

Thanks,
Cyrille

some arduino

you are in the classic nano section, so yes this would apply to that board

you'll find many ways to disable this behavior on line ➜ first google hit
Disable Arduino's Auto-Reset on Connection :: Astroscopic.

getting rid of the boatloader altogether and using ISP to load your code will ensure the boot loader is gone and thus when you boot, it's your code taking control right away (well Arduino's main() function which performs the board's init)

Hello,

Yep, this was it, thanks for the pointer to the Disable Arduino's Auto-Reset on Connection :: Astroscopic. page!

I did not know that they was an auto reset and that is what was throwing me off...

Removed the cap and fixed the issue!

Thanks,
Cyrille

If your question has been answered to your satisfaction, please mark the thread as solved so that other members that wish to help will not waste their time opening and reading the thread only to find that you no longer require assistance.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.