Go Down

Topic: Add command chars and short delay to start of sketch upload protocol (Read 2376 times) previous topic - next topic

m_elias

I'm working on a setup that allows the target arduino to get a new sketch uploaded via another arduino with an ethernet shield. The idea is to allow for remote sketch uploads and debug monitoring. I have seen a couple ethernet capable bootloaders but so far I have not had any success getting them to work. So I switched to writing a sketch for an ethernet arduino that basically acts like a ethernet-serial bridge/server. So, I use a virtual serial port emulator on my pc to create a virtual com port and link to the ethernet bridge arduino for the IDE to use, and as soon as I click upload, the bridge arduino detects the new connection, resets the target arduino and forwards all the ethernet data to the serial port and vice versa. It works pretty good but the target arduino then also resets every time I connect just to monitor the debug port on the target arduino, similar to the auto reset on most arduinos these days (I often disable that for a production device). I'd also like to add a few command codes for changing baud rate, resetting target arduino, etc.

So that brings me to my question, is it reasonable to try to modify the IDE to send an extra "reset target arduino" command code right after it's done compiling and just before it starts the upload? I did experiment with issuing a reset command over the virtual com port manually before clicking upload, I have to program the bridge arduino to delay the reset about 5-6 secs to give my computer time to compile the sketch first but that delay varies depending on the computer and it's still a manual reset command. Older versions of the IDE allowed you to skip the sketch compilation step if you had just clicked verify without modifying the code before clicking upload. This would allow me to set the reset delay to a consistent number but I'd still like to have the IDE issue it automatically for me and then delay maybe a second before starting the upload.

Go Up