Difference between revisions of "NU32: Software to Install"

From Mech
Jump to navigationJump to search
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
'''THIS PAGE REFERS TO A PRE-RELEASE VERSION OF THE NU32 PIC32 DEVELOPMENT BOARD. FOR INFORMATION, SAMPLE CODE, AND VIDEOS RELATED TO THE PRODUCTION VERSION (2016 AND LATER), AND TO THE CORRESPONDING BOOK "EMBEDDED COMPUTING AND MECHATRONICS WITH THE PIC32 MICROCONTROLLER," VISIT [[NU32|THE NU32 PAGE]].'''


If you are in ME333, follow the instructions for the FTDI Serial Communication Drivers, NU32 Utility Computer Application, MPLAB X v1.60, and the XC32 v1.20 compiler. You should also have access to MATLAB.
If you are in ME333, follow the instructions for the FTDI Serial Communication Drivers, NU32 Utility Computer Application, MPLAB X v1.60, and the XC32 v1.20 compiler. You should also have access to MATLAB.


Line 7: Line 10:


== NU32 Utility Computer Application ==
== NU32 Utility Computer Application ==
Download, save and unzip [[Media:NU32Utilityv3.zip| NU32UtilityV3]]. Inside of this folder is NU32_utility.exe. This "bootloader" program is used to put code that you have compiled using MPLAB X onto your NU32, and also send and receive serial data. It must remain in a folder with the folders called "lib" and "source", and rxtxSerial.dll. You will use this program very often, so it may be helpful to make a shortcut on your desktop, adding it to your quick launch bar, or adding it to the Start menu. This can be done by right-clicking the .exe and selecting "Pin to Start Menu", "Add to Quick Launch", or "Create Shortcut".
Download, save and unzip [[Media:NU32_Utility_v4.zip| NU32_Utility_v4]], (Here is [[Media:NU32_Utility_v5.zip| NU32_Utility_v5]], a temporary version for to work with the board from 2012). Inside of this folder is NU32_utility_v4.exe. This "bootloader" program is used to put code that you have compiled using MPLAB X onto your NU32, and also send and receive serial data. It must remain in a folder with the folders called "lib" and "source", and rxtxSerial.dll. You will use this program very often, so it may be helpful to make a shortcut on your desktop, adding it to your quick launch bar, or adding it to the Start menu. This can be done by right-clicking the .exe and selecting "Pin to Start Menu", "Add to Quick Launch", or "Create Shortcut".


NU32_utility requires that Java be installed on your computer. Usually you will already have Java installed, but if you try to run the program and get an error related to Java, then go to [http://www.java.com/en/download/index.jsp the Java download page], download and install Java and try again. ('''If you are using a Mac''' and you are having problems, go to Applications/Utilities and open Java Preferences. Under the General tab, you may see different versions of Java. Java applications go down this list and use the first checked version that is compatible with the application. Click on Java SE 6 if it is available and drag it to the top of the list, so it is used.)
NU32_utility requires that Java be installed on your computer. Usually you will already have Java installed, but if you try to run the program and get an error related to Java, then go to [http://www.java.com/en/download/index.jsp the Java download page], download and install Java and try again. ('''If you are using a Mac''' and you are having problems, go to Applications/Utilities and open Java Preferences. Under the General tab, you may see different versions of Java. Java applications go down this list and use the first checked version that is compatible with the application. Click on Java SE 6 if it is available and drag it to the top of the list, so it is used.)


To learn more about the bootloader code installed on your NU32, how NU32_utility.exe works, or get the source code for either, take a look at [[NU32: A Detailed Look at Programming the PIC32 on the NU32]].
To learn more about the bootloader code installed on your NU32, how NU32_utility.exe works, or get the source code for either, take a look at [[NU32: A Detailed Look at Programming the PIC32 on the NU32]].


If the NU32_Utility does not run well (takes a long time to open, crashes a lot), try the Python version:
[[Media:NU32_python.zip| NU32_python.zip]]

Instructions:
Basic Instructions to Use Bootloader Utility:

The only dependency required for Linux / Mac is to make sure python has the pySerial library installed (I believe it is installed by default on Linux but I could be wrong). You can test that this is installed by opening up a terminal, typing "python", and once in python running the "import serial" command. Assuming python does not complain the library has already been installed. If not, the easy install program can be used to install it by opening a terminal and typing the command "easy_install -U pyserial." More detailed instructions can be found online if necessary.

To run the program all you have to do is unzip and extract the directory into whatever location you want. Using the terminal cd into that directory. The default settings should work just fine with the board handed out today in class. To load a hex file, use the command:

./nu32_boot -f /path_to_hex_file/hexfile.hex

If the hex file is created and built in an MPLAB.X project directory the program can also be uploaded using the following command:

./nu32_boot.py -d /MPLABX_dir/Project.X/dist/ -x

This command searches for any hex files in the specified directory, hopefully finds one, and loads it automatically. Remember to make sure the PIC is powered on and set to bootload mode (the green LED is flashing) before using the script.

The default settings are designed to work on a Linux machine. On a Mac, the user will also have to specify the appropriate usb device to use. The command ./nu32_boot.py -l can be used to list the available devices and an alternate device can be specified with a command like:

nu32_boot.py -f test.hex -p /dev/ttyUSB1

The program has a help screen built in so if for any reason things don't work the command ./nu32_boot.py -h can be used to learn more about the different options you can play with.


== MPLAB X v1.60 ==
== MPLAB X v1.60 ==

Latest revision as of 05:24, 16 January 2016

THIS PAGE REFERS TO A PRE-RELEASE VERSION OF THE NU32 PIC32 DEVELOPMENT BOARD. FOR INFORMATION, SAMPLE CODE, AND VIDEOS RELATED TO THE PRODUCTION VERSION (2016 AND LATER), AND TO THE CORRESPONDING BOOK "EMBEDDED COMPUTING AND MECHATRONICS WITH THE PIC32 MICROCONTROLLER," VISIT THE NU32 PAGE.


If you are in ME333, follow the instructions for the FTDI Serial Communication Drivers, NU32 Utility Computer Application, MPLAB X v1.60, and the XC32 v1.20 compiler. You should also have access to MATLAB.

The remaining software is also useful for some programming projects.

FTDI Serial Communication Drivers

Download and install the "setup executable" version (second row, right column in table) of the FTDI drivers to allow your PC to communicate with your microcontroller through a serial port.

NU32 Utility Computer Application

Download, save and unzip NU32_Utility_v4, (Here is NU32_Utility_v5, a temporary version for to work with the board from 2012). Inside of this folder is NU32_utility_v4.exe. This "bootloader" program is used to put code that you have compiled using MPLAB X onto your NU32, and also send and receive serial data. It must remain in a folder with the folders called "lib" and "source", and rxtxSerial.dll. You will use this program very often, so it may be helpful to make a shortcut on your desktop, adding it to your quick launch bar, or adding it to the Start menu. This can be done by right-clicking the .exe and selecting "Pin to Start Menu", "Add to Quick Launch", or "Create Shortcut".

NU32_utility requires that Java be installed on your computer. Usually you will already have Java installed, but if you try to run the program and get an error related to Java, then go to the Java download page, download and install Java and try again. (If you are using a Mac and you are having problems, go to Applications/Utilities and open Java Preferences. Under the General tab, you may see different versions of Java. Java applications go down this list and use the first checked version that is compatible with the application. Click on Java SE 6 if it is available and drag it to the top of the list, so it is used.)

To learn more about the bootloader code installed on your NU32, how NU32_utility.exe works, or get the source code for either, take a look at NU32: A Detailed Look at Programming the PIC32 on the NU32.


If the NU32_Utility does not run well (takes a long time to open, crashes a lot), try the Python version: NU32_python.zip

Instructions: Basic Instructions to Use Bootloader Utility:

The only dependency required for Linux / Mac is to make sure python has the pySerial library installed (I believe it is installed by default on Linux but I could be wrong). You can test that this is installed by opening up a terminal, typing "python", and once in python running the "import serial" command. Assuming python does not complain the library has already been installed. If not, the easy install program can be used to install it by opening a terminal and typing the command "easy_install -U pyserial." More detailed instructions can be found online if necessary.

To run the program all you have to do is unzip and extract the directory into whatever location you want. Using the terminal cd into that directory. The default settings should work just fine with the board handed out today in class. To load a hex file, use the command:

./nu32_boot -f /path_to_hex_file/hexfile.hex

If the hex file is created and built in an MPLAB.X project directory the program can also be uploaded using the following command:

./nu32_boot.py -d /MPLABX_dir/Project.X/dist/ -x

This command searches for any hex files in the specified directory, hopefully finds one, and loads it automatically. Remember to make sure the PIC is powered on and set to bootload mode (the green LED is flashing) before using the script.

The default settings are designed to work on a Linux machine. On a Mac, the user will also have to specify the appropriate usb device to use. The command ./nu32_boot.py -l can be used to list the available devices and an alternate device can be specified with a command like:

nu32_boot.py -f test.hex -p /dev/ttyUSB1

The program has a help screen built in so if for any reason things don't work the command ./nu32_boot.py -h can be used to learn more about the different options you can play with.

MPLAB X v1.60

This is the cross-platform version of MPLAB (will work on MAC/Windows/Linux, based on NetBeans). It will be used in ME 333 in Winter 2013.

To download and install MPLAB X v1.60, go to the MPLAB X download page. Under your platform, download "MPLAB® X IDE v1.xx" and "MPLAB XC32 Compiler v1.xx"

These files are the:

  • MPLAB X installer
  • MPLAB XC32 compiler installer

First, install the MPLAB X IDE by running MPLAB X installer. Follow the on screen instructions to install. You may see the following window:

MPLAB X Switcher warning.

The tool switcher allows us to go back and forth between the previous version of MPLAB, v8.xx, and MPLAB X. We will not need this tool in ME333, so you can press OK and forget about it.

Second, install the XC32 compiler by running the MPLAB XC32 compiler installer. Follow the on screen instructions to install. Select the Evaluation Compiler when prompted (this is a full version for 60 days, then it will automatically downgrade, losing some optimization options, but in typical use these are not needed)

MPLAB C32 Evaluation Compiler.

You are now ready to write code to run on the PIC32, take a look at NU32: Starting a New Project and Putting it on the NU32.

Some mac-specific instructions:

If you use a mac, and the first time you try to run mplab_ide, and get the error

Java 6 Standard Edition or newer required Cannot run on older versions of Java than Java 6 Standard Edition. Please install Java 6 Standard Edition or newer or use --jdkhome switch to point to its installation directory.

To fix this, go to Applications/Utilities and open Java Preferences. Under the General tab, you'll see different versions of Java. Java applications go down this list and use the first checked version that is compatible with the application. For me, the checked versions were

J2SE 5.0 32-bit

Java SE 6 64-bit

J2SE 5.0 64-bit

in that order. I just clicked on Java SE 6 and dragged it to the top of the list and closed the window. Then MPLAB finds this version first and runs just fine. If you don't have Java 6 on your list, you need to update your software. One way to do this is by going to Apple>Software Update.

Now you should be able to run mplab_ide, which we will use as our C project development environment. But I was unable to "build" any projects at first. According to Microchip: "On the Mac it is a requirement to install the Mac XTools developers Studio that comes with the shipped CD. This contains the 'make' utility which is used to build ALL embedded projects under MPLAB X." I was unable to compile programs with the MPLAB IDE because I didn't have xtools installed (it is not installed by default on your mac, so if you're not sure if you have it, you probably don't).

To get xtools (if you don't have it already), you can register with Apple as a developer. Go to

http://developer.apple.com/programs/start/register/create.php

and choose the free option (don't pay $99!). After you've registered, you can go to the Mac Dev Center and download Xcode 3.2.5 if you are running Mac OSX 10.6.x (this is big, > 3 GB!). If, like me, you're running Mac OSX 10.5.8, you should download the older xcode 3.1.4 (less than 1 GB). I found it at

http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wo/5.1.17.2.1.3.3.1.0.1.1.0.3.3.3.3.1

about 1/3 of the way down the page (search for 3.1.4).

Processing

Download and install Processing, free software that will allow you to develop GUIs and communicate with your PIC microcontroller.

The NU32_Utility can be run out of Processing directly, rather than as an executable, which can sometimes speed up performance. To do this, you need to download a library called ControlP5.

Terminal Emulator

A terminal emulator will allow simple keyboard-and-screen communication between you and your PIC. You can use any terminal emulator you want; here are some suggestions:

  • For the PC: Download and save PuTTY, a free terminal program (putty.exe) that will allow you to communicate with your microcontroller through the serial port. (You don't need to run PuTTY now, and can click "Cancel" if you happen to run it.)
  • For the Mac: You can try ZTerm.