Getting Started with the VEX Cortex

From ROBOTC API Guide
Jump to: navigation, search
Tutorials → Getting Started with the VEX Cortex




Configuring the VEX Cortex for a WIRED connection using USB

This is a guide for setting up the VEX Cortex using the USB A-to-A cable. These steps are required the first time you use your computer to program a specific VEX Cortex, or after you've upated ROBOTC to the latest verstion. Once you've successfully completed these steps you can download your own programs without revisiting them. Note: Administrative privileges are required for some of these steps.


Note: Driver Installation

ROBOTC 3.05 and later automatically installs the necessary drivers for the VEX Cortex, VEXnet Joysticks, and USB-to-Serial Programming cable. If you need to download the drivers for troubleshooting purposes, you can still find them at www.ROBOTC.net/download/cortex:
The drivers for the CORTEX Microcontroller and VEXnet Joysticks are included in the ROBOTC 3.0 installers. If, for any reason, you need to download them separately, here are the downloads:
Download Network Driver (in addition to required driver) if ROBOTC will run from a network:


Step 1: Connect the Cortex to your PC

Connect the VEX Cortex directly to a USB port on your computer using the USB A-to-A cable. Allow a few seconds for Windows to recognize the device.

Vex2-getting-started-connect.JPG

Connect a 7.2V Robot battery to the Cortex and move the POWER switch to the ON position. Optionally, you can connect two motors to MOTOR Ports 2 and 3 for testing a sample program later in the sequence. You can connect 3-wire motors directly, or the newer 2-wire motors using Motor Controller 29 cables.

Vex2-getting-started-battery motors.JPG
Note: Technically, the battery is not necessary for downloading Master CPU Firmware and ROBOTC Firmware, but it has helped in cases where the USB ports on the computer provide too little power to facilitate a reliable connection to the Cortex.


Step 2: Platform Type and Communication Port

Specify that you are using the Cortex and how it is connected to your computer in ROBOTC. Go to Robot → Platform Type → Innovation First (IFI) and select "VEX 2.0 Cortex" or "Natural Language (VEX Cortex)".

Vex2-getting-started-platform-selection.png
Note: You should choose "VEX 2.0 Cortex" if you plan on programming using the standard ROBOTC language. Choose "Natural Language (VEX Cortex)" if you want to take advantage of the Natural Language commands in ROBOTC.

Then go to View and choose Select Communication Port.

Comm port.png

The Select Communications Port for Platforms window will appear. From the Communications Port drop down list, you should see "Automatic Selection" and one of two additional options:

If your VEX Cortex is in "bootload mode" or running an older (2.x) version of the Master CPU Firmware, it will appear as a "USB Wired Cable" option in the list.
Comm port select.png

If your VEX Cortex is running a newer (3.x) version of the Master CPU Firmware, it will appear as a "Vex Robotics Comm Port" in the list.

Vex2-getting-started-auto-select.png
Make sure that "Automatic Selection" or one of the two legitimate options is selected. If you ever plan on programming your robot wirelessly over VEXnet, choosing "Automatic Selection" is recommended. Press OK to save your choice.


Important: If the "USB Wired Cable" or "Vex Robotics Comm Port" options do not appear in the drop down menu when a VEX Cortex is connected, this may indicate that Windows has not recognized the device or access to it is blocked. Ensure that the VEX Cortex Device Driver was successfully installed with Administrative Privileges, disconnect and reconnect your Cortex from the computer, and press "Refresh List" to force ROBOTC to repopulate the list.


Step 3: Updating VEX Cortex Firmware

Go to Robot → Download Firmware and select "Automatically Update VEX Cortex".

Vex2-getting-started-auto-update.png

A message will appear, informing you that the software will update your Cortex to the latest Master CPU and ROBOTC Firmware files. Press OK to begin the process.

Vex2-getting-started-robotc-message.png

A Download Progress window will appear, showing the progress of the Master CPU Firmware download.

Vex2-getting-started-download-progress.png

When the Master CPU Firmware download is complete, a ROBOTC Message will appear and inform you that it will now update the ROBOTC firmware, if needed. Press OK to continue the process.

Vex2-getting-started-ROBOTC Message-2012-01-06 12 59 37.png

Note: If this is the first time a VEX Cortex running the 3.x Master CPU Firmware has been connected to your computer, Windows will recognize it as a new device, and may prompt you to verify the new hardware installation. Press Continue or Continue Anyway to complete the installation.

New hw.png

If your ROBOTC Firmware is out-of-date, another Download Progress window will appear and begin the ROBOTC Firmware download.

Vex2-getting-started-Download Progress-2012-01-06 13 00 34.png

When the download completes, another ROBOTC Message will appear. Press OK to complete the process.

Vex2-getting-started-ROBOTC Message-2012-01-06 13 00 00.png

Notes:

Once this step is complete, you should no longer need Administrative privileges on your computer; you should be able to download Master CPU Firmware, ROBOTC firmware, and ROBOTC programs in a permissions-restricted account. Only future updates to ROBOTC and the VEX Cortex Device Driver will require Administrative privileges. Exception: On some computers, Windows may prompt you to "install new hardware" each time the Cortex is plugged in on a different USB port. To alleviate the issue, connect the updated VEX Cortex on each USB port as an administrator (no need to redownload firmware), or dedicate one USB port for communication with the VEX Cortex.

You only need to download the Firmware once, when you first start using a VEX Cortex with ROBOTC, or when you upgrade to a newer version of ROBOTC. You do not need to re-download the firmware every time you want to download code. If the download fails, disconnect the VEX Cortex from your computer and turn it off. Then reconnect it to the computer, allow a few seconds to ensure that Windows recognizes it, turn it on, and try downloading the firmware again.


Step 4: Downloading and Running Code

ROBOTC contains a large library of sample programs to help you get started. These sample programs can be downloaded to your VEX Cortex using the USB A-to-A cable, or using a wireless VEXnet connection.


The VEX Cortex Communication Mode controls how ROBOTC downloads programs to your Cortex, as well as what types of connections your Cortex checks for when it is powered on. Confirm that your VEX Cortex Communication Mode is set to "VEXnet or USB" or "USB Only". "USB Only" is the recommended method for wired-only programming.
Vex2-getting-started-usb-only.png

Option 1: VEXnet or USB
With this option selected, ROBOTC will download programs to your Cortex using a VEXnet or USB connection. In this mode, when the Cortex is powered ON it will look for a VEXnet or USB connection for up to 15 seconds before running your program. (The Communication Port → Automatic Selection option in the ROBOTC Preferences should be selected if you plan on switching between VEXnet and USB as your download method.)

Option 2: USB Only
With this option selected, ROBOTC will download programs to your Cortex using only the USB connection. In this mode, when the Cortex is powered ON it will immediately run your program. This option will NOT work if you are using the VEXnet Joysticks to download to the Cortex, or remotely control it.

Option 3: Competition (VEXnet)
This option disables the ROBOTC debugger, and is not recommended for classroom use.

To open a sample program, go to File → Open Sample Program.

Vex2-getting-started-program 2.png

Navigate to the Basic Movement folder and open "Moving Forward.c".

Vex2-getting-started-program 1.png

Make sure that your robot is connected to the computer and turned ON. Then go to Robot → Compile and Download Program.

Vex2-getting-started-compile.png

Important Note: The VEX Cortex Communication Mode is stored in ROBOTC and on the Cortex. If you change the setting, it gets transferred to the Cortex the next time you download a program. The Cortex must be power cycled (disconnected from the computer, turned fully off, and then back on) before the change will take effect.

Vex2-getting-started-download method chage.png

Download Progress window will appear while the program is downloading to the Cortex.

Robotc download-vex2-tut.png

When the Download Progress window closes, the Program Debug window will appear. You can run your program by pressing the "Start" button, or by disconnecting the robot and turning it OFF and back ON.

Vex2-getting-started-program debug.png

With the sample program above, you should observe motors plugged into Ports 2 and 3 spinning for 3 seconds.

Vex2-getting-started-battery motors.JPG


Step 5: Getting More Help

ROBOTC includes a useful Help system. You can launch the help system by going to the Help menu and selecting Open Help, or by pressing the F1 key on your keyboard.

Vex2-getting-started-help.png

The VEX Cortex Video Trainer provides many useful video tutorials for learning the VEX Cortex system and ROBOTC Programming.


Additional help and support can be found at http://www.robotc.net or by e-mailing support@robotc.net