Arduino Reference - Windows

## Arduino IDE Troubleshooting

(:*toc:)

#### Errors running a sketch

- Why doesn't my sketch start after I restart my Intel® Galileo board?
- Why I can't upload my programs to the Intel® Galileo board?
- Error: Retry 0: Got TIMEOUT when trying to connect?
- Permission Denied when trying to upload a sketch?

#### Windows* Related

- Why does the Arduino software freeze when I try to upload a program? (on Windows)?
- What should I do if I get an error when launching arduino.exe (on Windows)?
- What can I do about cygwin conflicts (on Windows)?
- Why does do the Arduino software and the Tools menu take a long time to open (on Windows)?

#### Mac OS X* Related

- Why do I get "Build folder disappeared or could not be written" (on Mac OS X)?
- Why doesn't the Arduino software run after I updated the Java (on Mac OS X)?
- Why won't Arduino run on old versions of Mac OS X?
- What if I get a gnu.io.PortInUseException when uploading code or using the serial monitor (on Mac OS X)?

#### Miscellaneous

- Why do I get a java.lang.StackOverflowError when I try to compile my program?
- What if my board doesn't turn on (the green power LED doesn't light up)?
- What do I do if I get an UnsatisfiedLinkError error (about native library librxtxSerial.jnilib) when launching Arduino?
- What about the error "Could not find the main class."?
- Why does my sketch appear to upload successfully but not do anything?
- Why do I get errors about undeclared functions or undeclared types?

### Errors Running a Sketch

#### Why doesn't my sketch start after I restart my Intel® Galileo board?

Intel® Galileo Board forgets sketch after powering down. Intel® Galileo Board is required to boot from the SD card in order to resume the sketch after power down.

These steps help you setup your SD card, and boot the Intel® Galileo Board from the SD card.

1. Connect the Intel® Galileo Board and update the firmware.

2. Download LINUX IMAGE FOR SD for Intel Galileo from Software Downloads - Drivers.

3. Format the SD card to FAT32.

4. Unzip the zip file to the SD card.

The content of the SD should have the following files/folders at the root directory:

/boot/grub/grub.conf

bzImage

core-image-minimal-initramfs-clanton.cpio.gz

grub.efi

image-full-galileo-clanton.ext3

5. Insert the SD card into the SD slot on the Intel Galileo Board.

6. Connect the power supply and micro USB to the Intel Galileo Board.

Note: Intel® Galileo takes about 1-2 minutes to boot Linux before the computer can detect it.

To format

Intel Galileo Board should now be booting from the SD card. The easiest way to verify, is to upload the Blink example, and reboot the Intel Galileo Board. If the Blink example continues to run after booting, then you are booting from the SD card.

#### Why I can't upload my programs to the Intel® Galileo board?

There are many pieces involved in getting a program onto your Arduino board, and if any of them aren't right, the upload can fail. They include: the drivers for the board, the board and serial port selections in the Arduino software, access to the serial port, the physical connection to the board, the firmware on the Galileo and more. The first step to always try is a complete reboot of the Galileo board and your computer. When rebooting the Galileo it is advised to unplug the power instead of using the "reboot" button on the board. If a full reboot does not solve your issues here are some specific suggestions for troubleshooting each of the pieces.

Arduino Software

- Make sure you have the right item selected in the Tools > Board menu. Make sure that you have selected the proper board from the Tools > Board depending on which board you are using (Edison, Galileo Gen1, Galileo Gen2).

- Then, check that the proper port is selected in the Tools > Serial Port menu (if your port doesn't appear, try restarting the IDE with the board connected to the computer). On the Mac, the serial port should be something like /dev/tty.usbmodem1a123. On Linux, it should be /dev/ttyACM0 or similar. On Windows, it will be a COM port but you'll need to check in the Device Manager (under Ports) to see which one. If you don't seem to have a serial port for your Intel board, see the following information about drivers.

- If you are having trouble with the Arduino IDE on Linux make sure you have Java installed. To check open a terminal and type in "java" and hit enter. If you get an error of "The program 'java' can noe found..." type in "sudo apt-get install default.jre" To install Java. You will have to enter your password when using sudo.

Drivers

- Drivers provide a way for software on your computer (i.e. the Arduino IDE software) to talk to your hardware. Driver installation is only required if you are using a Windows PC to program the Galileo. To check if you have all the drivers installed open Device Manager ( open start menu and type "Device Manger" into the search bar) and check if you have any unknown devices. If you have an unknown device, most likley called "Gatget Serial v2.4" you will need to manually update the driver software. To do this:
  - right click on the unknown device and select "Update Driver Software..."
  - Select "Browse my computer for driver software"
  - In the search bar put in "C:\arduino-1.5.3\hardware\arduino\x86\tools" and click Next to install the driver
  - NOTE: If you did not unpack the Arduino IDE into C:\, you will have to navigate to your unpack location.

- On Linux, the Intel Galileo board may show up as a device of the form /dev/ttyACM0. This device is not supported by the standard version of the RXTX library that the Arduino software uses for serial communication. The Arduino software download for Linux includes a version of the RXTX library patched to also search for these /dev/ttyACM* devices. There's also an Ubuntu package (for 11.04) which includes support for these devices. If, however, you're using the RXTX package from your distribution, you may need to symlink from /dev/ttyACM0 to /dev/ttyUSB0 (for example) so that the serial port appears in the Arduino software.

Access to the Serial Port

- On Windows, if the software is slow to start or crashes on launch, or the Tools menu is slow to open, you may need to disable Bluetooth serial ports or other networked COM ports in the Device Manager. The Arduino software scans all the serial (COM) ports on your computer when it starts and when you open the Tools menu, and these networked ports can sometimes cause large delays or crashes.

- Check that you're not running any programs that scan all serial ports, like USB Cellular Wifi Dongle software (e.g. from Sprint or Verizon), PDA sync applications, Bluetooth-USB drivers (e.g. BlueSoleil), virtual daemon tools, etc.

- Make sure you don't have firewall software that blocks access to the serial port (e.g. ZoneAlarm).

- You may need to quit Processing, PD, vvvv, etc. if you're using them to read data over the USB or serial connection to the Arduino board.

- On Linux, you might try running the Arduino software as root, at least temporarily to see if fixes the upload. To do this open a terminal, navigate to your Arduino IDE install folder and launch with "sudo ./arduino". You will have to enter your password.

Physical Connection

- First make sure your board is on (the green LED is on) and connected to the computer. If your board is not connected properly follow the instructions at "Help > Getting Started" in the Arduino IDE menu.

- Try uploading with nothing connected to the board (apart from the USB cable, of course).

- Make sure the board isn't touching anything metallic or conductive.

- Try a different USB cable; sometimes they don't work.

Firmware

- Make sure the firmware on your is up to date. To flash the latest firmware follow the steps at:
  - Windows: https://software.intel.com/en-us/articles/getting-started-with-the-intel-galileo-board-on-windows

- OS X: https://software.intel.com/en-us/articles/getting-started-with-the-intel-galileo-board-on-mac
- Linux: https://software.intel.com/en-us/articles/getting-started-with-the-intel-galileo-board-on-linux

If it still doesn't work, you can ask for help in the forum. Please include the following information:

- Your operating system.
- What kind of board you have.
- Whether or not you were ever able to upload to the board. If so, what were you doing with the board before / when it stopped working, and what software have you recently added or removed from your computer?
- The messages displayed when you try to upload with verbose output enabled. To do this, hold down the shift key while clicking on the upload button in the toolbar.

#### Error: Retry 0: Got TIMEOUT when trying to connect?

- Try logging into your board via SSH, or serial, and delete or rename /sketch/sketch.elf file, and then reboot, or at minimum kill the existing running sketch.elf process. Its particularly an issue with porting over a simple Arduino example, or running the AnalogReadSerial, or DigitalReadSerial examples from the IDE. The Intel IoT platforms share the USB connection with the Serial Monitor, unlike a standard Arduino.

#### Getting Permission Denied when trying to upload a sketch?

This error is usually assosiated with a sketch that is running on your board interfering with uploading new sketches. To solve this problem follow these steps:

- Unplug the USB cable from your computer
- unplug the 12V power supply from the wall
- If you have an SD card inserted into the Galileo, remove it
- Follow the steps outlined in the Why doesn't my sketch start after I restart my Intel® Galileo board? to install a new image on your SD card.
- Plug the SD card back into the Galileo.
- Plug the 12V power supply and USB back in.
- You should now be able to upload new sketches to your Galileo.

#### Windows* Related

#### Why does the Arduino software freeze when I try to upload a program? (on Windows)?

This might be caused by a conflict with the Logitech process 'LVPrcSrv.exe'. Open the Task Manager and see if this program is running, and if so, kill it before attempting the upload. more information

#### What should I do if I get an error when launching arduino.exe (on Windows)?

If you get an error when double-clicking the arduino.exe executable on Windows, for example:

`Arduino has encountered a problem and needs to close.`

you'll need to launch Arduino using the run.bat file. Please be patient, the Arduino environment may take some time to open.

#### What can I do about cygwin conflicts (on Windows)?

If you already have cygwin installed on your machine, you might get an error like this when you try to compile a sketch in Arduino:

`6 [main] ? (3512) C:\Dev\arduino-0006\tools\avr\bin\avr-gcc.exe: *** fatal error - C:\Dev\arduino-0006\tools\avr\bin\avr-gcc.exe: *** system shared memory version mismatch detected - 0x75BE0084/0x75BE009C.`

`This problem is probably due to using incompatible versions of the cygwin DLL.`

`Search for cygwin1.dll using the Windows Start->Find/Search facility and delete all but the most recent version. The most recent version *should* reside in x:\cygwin\bin, where 'x' is the drive on which you have installed the cygwin distribution. Rebooting is also suggested if you are unable to find another cygwin DLL.`

If so, first make sure that you don't have cygwin running when you use Arduino. If that doesn't help, you can try deleting cygwin1.dll from the Arduino directory and replacing it with the cygwin1.dll from your existing cygwin install (probably in c:\cygwin\bin).

Thanks to karlcswanson for the suggestion.

#### Why does do the Arduino software and the Tools menu take a long time to open (on Windows)?

If the Arduino software takes a long time to start up and appears to freeze when you try to open the Tools menu, there by a conflict with another device on your system. The Arduino software, on startup and when you open the Tools menu, tries to get a list of all the COM ports on your computer. It's possible that a COM port created by one of the devices on your computer slows down this process. Take a look in the Device Manager. Try disabling the devices that provide COM ports (e.g. Bluetooth devices).

### Mac OS X* Related

#### Why do I get "Build folder disappeared or could not be written" (on Mac OS X)?

Did you drag the Arduino.app out of the disk image (and into, say, your Applications folder)? If not, you won't be able to upload the examples.

#### Why doesn't the Arduino software run after I updated the Java (on Mac OS X)?

The latest Java update from Apple attempts to use 64-bit version of native libraries, but the Arduino application comes with a 32 bit version of the RXTX library. If you launch Arduino, you'll get an error like:

`Uncaught exception in main method: java.lang.UnsatisfiedLinkError: /Applications/arduino-0016/Arduino 16.app/Contents/Resources/Java/librxtxSerial.jnilib: no suitable image found. Did find: /Applications/arduino-0016/Arduino 16.app/Contents/Resources/Java/librxtxSerial.jnilib: no matching architecture in universal wrapper`

To fix this, click on the Arduino application (e.g. Arduino 16.app) in the Finder, and select Get Info from the File menu. In the info panel, click the Open in 32 Bit Mode checkbox. You should then be able to launch Arduino normally.

#### Why won't Arduino run on old versions of Mac OS X?

If you get an error like this:

    Link (dyld) error:

    dyld: /Applications/arduino-0004/Arduino 04.app/Contents/MacOS/Arduino Undefined symbols:
    /Applications/arduino-0004/librxtxSerial.jnilib undefined reference to _printf$LDBL128 expected to be defined in /usr/lib/libSystem.B.dylib

you probably need to upgrade to Max OS X 10.3.9 or later. Older versions have incompatible versions of some system libraries.

Thanks to Gabe462 for the report.

#### What if I get a gnu.io.PortInUseException when uploading code or using the serial monitor (on Mac OS X)?

    Error inside Serial.<init>()
    gnu.io.PortInUseException: Unknown Application
         at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354)
         at processing.app.Serial.<init>(Serial.java:127)
         at processing.app.Serial.<init>(Serial.java:72)

This probably means that the port is actually in use by another application. Please make sure that you're not running other programs that access serial or USB ports, like PDA sync application, bluetooth device managers, certain firewalls, etc. Also, note that some programs (e.g. Max/MSP) keep the serial port open even when not using it - you may to need to close any patches that use the serial port or quit the application entirely.

If you get this error with Arduino 0004 or earlier, or with Processing, you'll need to run the `macosx_setup.command`, and then restart your computer. Arduino 0004 includes a modified version of this script that all users need to run (even those who ran the one that came with Arduino 0003). You may also need to delete the contents of the /var/spool/uucp directory.

### Miscellaneous

#### Why do I get a java.lang.StackOverflowError when I try to compile my program?

The Arduino environment does some preliminary processing on your sketch by manipulating the code using regular expressions. This sometimes gets confused by certain strings of text. If you see an error like:

    java.lang.StackOverflowError
    at java.util.Vector.addElement(Unknown Source)
    at java.util.Stack.push(Unknown Source)
    at com.oroinc.text.regex.Perl5Matcher._pushState(Perl5Matcher.java)

or:

    	at com.oroinc.text.regex.Perl5Matcher._match(Perl5Matcher.java)
    	at com.oroinc.text.regex.Perl5Matcher._match(Perl5Matcher.java)
    	at com.oroinc.text.regex.Perl5Matcher._match(Perl5Matcher.java)
    	at com.oroinc.text.regex.Perl5Matcher._match(Perl5Matcher.java)
    	at com.oroinc.text.regex.Perl5Matcher._match(Perl5Matcher.java)
    	at com.oroinc.text.regex.Perl5Matcher._match(Perl5Matcher.java)
    	at com.oroinc.text.regex.Perl5Matcher._match(Perl5Matcher.java)

this is what's happening. Look for unusual sequences involving "double-quotes", "single-quotes", \backslashes, comments, etc. For example, missing quotes can cause problems and so can the sequence '\"' (use '"' instead).

#### What if my board doesn't turn on (the green power LED doesn't light up)?

Make sure that you are powering your board correctly according to the "Tools > Getting Started" guide in the Arduino IDE menu.

#### What do I do if I get an UnsatisfiedLinkError error (about native library librxtxSerial.jnilib) when launching Arduino?

If you get an error like this when launching Arduino:

`Uncaught exception in main method: java.lang.UnsatisfiedLinkError: Native Library /Users/anu/Desktop/arduino-0002/librxtxSerial.jnilib already loaded in another classloader`

you probably have an old version of the communications library lying around. Search for comm.jar or jcl.jar in /System/Library/Frameworks/JavaVM.framework/ or in directories in your CLASSPATH or PATH environment variables. (reported by Anurag Sehgal)

#### What about the error "Could not find the main class."?

If you get this error when launching Arduino:

`Java Virtual Machine Launcher: Could not find the main class. Program will exit.`

make sure that you correctly extracted the contents of the Arduino .zip file - in particular that the lib directory is directly inside of the Arduino directory and contains the file pde.jar.

#### Why does my sketch appear to upload successfully but not do anything?

Check for a noisy power supply. It's possible this could cause the chip to lose its sketch. If the power LED on the Galileo board is flashing or flickering the system is resetting and cannot run any sketches. If you are using a battery to power the Galileo make sure it is above 7 volts. If you are running off of USB power and have multiple sensors/servos plugged into your board there might not be enough power to run the logic. Unplug the sensors or servos or plug your Galileo into the wall through the barrel jack and try loading the sketch again.

#### Why do I get errors about undeclared functions or undeclared types?

The Arduino environment attempts to automatically generate prototypes for your functions, so that you can order them as you like in your sketch. This process, however, isn't perfect, and sometimes leads to obscure error messages.

If you declare a custom type in your code and create a function that accepts or returns a value of that type, you'll get an error when you try to compile the sketch. This is because the automatically-generated prototype for that function will appear above the type definition.

If you declare a function with a two-word return type (e.g. "unsigned int") the environment will not realize it's a function and will not create a prototype for it. That means you need to provide your own, or place the definition of the function above any calls to it.