Most Arduino’s are programmed and communicate with the same serial port. That can cause conflicts if you want to upload a new program while MegunoLink is, say, busy plotting data it is receiving from the same port. MegunoLink’s Arduino upload monitor helps share that port between MegunoLink and the Arduino IDE.
When the upload monitor is installed, MegunoLink will automatically disconnect from the serial port when it detects the Arduino IDE is trying to upload a new program. When programming is complete, MegunoLink will automatically reconnect so you don’t miss any serial communications.
Check out a demo in this short video:
Installing the Arduino Upload Monitor
The Arduino upload monitor is included with MegunoLink but not installed by default. To install the upload monitor, choose Setup Arduino Integration from the gear menu.
Select the folder where you installed the Arduino IDE and the Install action in the Arduino Upload Monitor group. Press the Update Installation button to continue.
Using the Upload Monitor
There’s nothing special you need to do once the upload monitor is installed. MegunoLink will automatically detect when the Arduino IDE starts uploading a program using a port that it has open. MegunoLink will quickly close the serial port so the uploader can use it. When the upload is finished, MegunoLink will reconnect to continue receiving serial data.
MegunoLink will only release the port needed for programming. So other devices you have connected will not be interrupted.
How does the Arduino Upload Monitor work?
The secret is AVRDude. AVRDude is the program used by the Arduino IDE whenever it wants to upload a new program to your Arduino hardware. AVRDude needs to know which serial port to use, so that information is supplied by the Arduino IDE as a command-line parameter.
When you installed the MegunoLink upload monitor, we renamed AVRDude and dropped the monitor program in its place.
Since nobody told the Arduino IDE, it still calls AVRDude to do the update. But now, it runs the monitor program which quickly notifies MegunoLink that the port is needed and passes the upload command onto the real AVRDude. When the upload has finished, the monitor notifies MegunoLink that it is safe to use the port again and communication continues.