Skip to content

VestaTechnology/Onboard_Mercury_18

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started With Mercury

This guide serves as a quick-start for Mercury 16 and Mercury 18. These are single-board-computers made by Vesta Technology that provide Arduino-compatible connectors as well as additional I/O connectors. This guide will walk you through setting up a development environment with MPLAB X, connecting your Mercury to your computer, and running a basic application (Blinky) in debug mode.

Setting Up a Development Environment

Windows

First, you will need to download three software packages. MPLAB X IDE, the XC 8 Compiler, and the driver for the USB-to-UART chip onboard, MCP2200. Click on the links below to begin downloading!

Direct Download Links

Run the installers and follow their instructions. You should now be ready to open MPLAB X and load your first project.

Loading an MBLAB X Project

Begin by cloning the Onboard_Mercury_18 repository into your local project directory. Alternatively, you can download the zip files, Mercury 18. Let's start with the most simple example, blinking the onboard LED. The project directory is Blinky.X.

Start MPLAB X. Once it has opened, click on the menu File >> Open Project... (Ctrl + Shift + O). Navigate to where you saved the repository and select Blinky.X. Click Open Project. MPLAB X will open the project and load all of its settings. You can see project information in the Dashboard window, bottom left. The Project window, top left, shows all the included files.

Connections

###Debugger/Programmer To debug and program your Mercury you will need to connect it to your computer with a compatible In-Circuit Debugger. We recommend the PICkit 3 for hobbyists, as it provides good capabilities for a reasonable price. PICkit clones are readily available online, and you can always build your own with a little research. Alternatively, there are more capable and faster debuggers available (at higher cost).

Whatever In-Circuit Debugger you choose, you'll need to connect it to the ICSP Connector (J2) on the Mercury. J2 is a 2-row, 6-pin male connector and the pinout can be found in our hardware manual. We have cables available to connect to the PICkit 3 or MPLAB ICD 3 (the debugger we use in-house). The connector on the PICkit 3 is a single-row, 6-pin female header that has the same pinout as the PICkit 2 and may be compatible with other clones. Be sure to check your datasheets! The connector on the MPLAB ICD 3 is an RJ-11 female plug.

###Power With your Mercury connected to an In-Circuit-Debugger and the debugger connected to your computer, it is time to provide power to Mercury. We typically do this with a USB-A to mini-B cable. A powered USB hub or USB port on your computer can provide enough power to run Mercury. This connection is also used for COM port communications with your PC.

Another option is to use a common "wall wart" or "brick" unit. The connector is a common 2.1 mm barrel connector with positive on the center pin and ground on the sheath of the connector. Mercury will accept 6-16 VDC at the barrel connector and provide up to 1 Amp of regulated 5 VDC.

Blinky.x makes use of the COM port so I recommend using a USB cable to power your Mercury for now.

###COM Port ####Windows With a USB-A to mini-B cable connecting your Mercury to your computer open the Windows Device Manager and look under Ports (COM & LPT) to check the COM port number assigned to your Mercury. It should say something like, USB Serial Port (COM#). If you're not sure which one it is, watch the Device Manager while unplugging and re-plugging your Mercury. You'll need a terminal emulator program like Tera Term or PuTTY to connect with Mercury's COM port. I will describe how to connect to your Mercury using PuTTY.

Once you have downloaded putty.exe, run it by double clicking. Change your Connection Type to Serial. Edit the Serial line to match the COM port number of your Mercury. Change Speed to 38400. That is the BAUD rate, set in your repository directory/Common/usart.h. Under Saved Sessions, you can type in a name and click Save so in the future all you will have to do is double click on the name. Now, click Open, and if the connection is successful a terminal will open.

##Debugging In MPLAB X IDE right-click on the project name Blinky in the Projects window and click on properties. Under Conf: [default] you should make sure that the Device: selected matches the flavor of Mercury you're using - PIC18F66K90 for Mercury 18. Also check that the Hardware Tool selected matches what you have plugged in and that the Compiler Toolchain selected is XC8. Click OK.

Next click on the menu Debug >> Debug Main Project. MPLAB X will now build the project, program your Mercury, and run the project. If everything is working the blue LED (LED1) on Mercury will be blinking and the terminal will repeat "Hello World".

The project will continue running until you click Finish Debugger Session or Pause. By clicking Pause you can use Continue, Reset, Step Over, Step Into, Run Till Cursor, and many more useful debug options.

You've done it! Congratulations! Now all that lies between you and the next paradigm shifting embedded design is tinkering around with a few more example programs and a little more reading.

##The Future Thanks for making it this far, and we hope you'll come to know and love your Mercury. If you have any feed back, questions, or just want to talk, we would love to hear from you. Please submit an issue, contact us or send us an email.

###More Example Programs More Example Programs for both Mercurys can be found at our Github or our website.

###A Little More Reading

About

Example programs of onboard features and a quick-start guide.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published