NTH Music Synthesizer Firmware Tutorial

Overview

The NTH features an in-circuit serial programming port (ICSP) that allows the user to update the firmware on the NTH’s PIC microcontroller.  This means that any part of the NTH’s firmware-based functionality can be changed, including:

  • Sequencer and oscillator algorithms
  • Knob, slider, and button functionality (except for the analog filter controls)
  • LED behavior (except for the power LED)
  • MIDI I/O

NTH firmware can be updated as many times as you’d like.  We hope that the user community will create a variety of NTH firmware “flavors”.

Tools

The only tools needed are an ICSP programmer and a computer.  The ICSP programmer used for this guide is the PICkit 2 manufactured by Microchip.  The PICkit 2 attaches to your computer via USB.  At the time of this writing, the PICkit 2 is available directly from Microchip or from electronics distributors like Mouser for $35.

Microchip publishes a free Windows software utility for use with the PICkit 2, confusingly called “PICkit 2”.  Command line software for Mac and Linux is also available.  The utilities can be downloaded from the PICkit 2 development tools page.  For the Windows portion of this guide, we will use “PICkit 2 v2.61”.  Future versions of the utility should also work.

For the rest of this guide, the physical PICkit 2 will be called the “PICkit 2” and the software utility will be called the “PICkit 2 utility”.

Firmware Image: The Hex File

The “hex file” is a specific file format that is used to convey the firmware image for a PIC microcontroller.  To update the NTH firmware, we will load a hex file onto the PICkit 2, and then transfer the firmware from the PICkit 2 to the NTH’s microcontroller.

This guide assumes that you already have a hex file ready to load onto the NTH, provided either by us or by someone in the NTH user community.  To generate your own hex file, you must compile the NTH source code.  Source code modification and compiling is outside the scope of this guide.

Firmware Update Procedure (Windows)

Be sure to follow the steps below without changing the order.  When done correctly, the entire procedure will take less than a minute.

  1. Put the NTH power switch in the off (“0”) position.  The battery does not need to be removed.
  2. Plug the PICkit 2 into a USB port on your computer.
  3. Plug the PICkit 2 into the NTH ICSP port.  Match the white arrow on the PICkit 2 with the white arrow on the NTH ICSP port.
  4. Launch the PICkit 2 utility.
  5. In the PICkit 2 utility “Device Family” menu, select “Midrange -> 1.8V Min”
  6. In the PICkit 2 utility “File” menu, select “Import Hex”.  Select the hex file using the resulting dialog.  The PICkit 2 utility will display the message “Hex file successfully imported.”
  7. Click the PICkit 2 utility “Write” button.  Wait for the “Programming Successful” message to be displayed.
  8. Unplug the PICkit 2 from the NTH.

Firmware Update Procedure (Mac)

IMPORTANTThis guide assumes some understanding of the command line on OS X.  If you are not familiar with command line interfaces, it is highly recommended that you research before doing any work in Terminal.  It is possible that changing anything via Terminal without knowing what you are doing can cause issues with your system.  We hold no responsibility for the well-being of your computer.

(For a quick tutorial, check out Zed Shaw’s “Command Line Crash Course“).

  1. Download PK2CMD V1.20 Mac OS 10.4 & 10.5 Universal Binary . (Much of the information in the Mac guide is taken from the ReadMe in the above download).
  2. Make sure the NTH hex file you want to upload to the NTH is in the same directory as “pk2cmd”.
  3. You need to copy “pk2cmd” and “PK2DeviceFile.dat” to two separate places on your computer. In Terminal, navigate to the folder housing “pk2cmd” and “PK2DeviceFile.dat” and type:
    sudo cp pk2cmd /usr/local/bin

    Enter password, then type:

    sudo cp PK2DeviceFile.dat /usr/share/PK2DeviceFile.dat
  4. Your user PATH environment variable should include /usr/share/pk2. In Terminal, navigate to /Users/”Your user name”.
    Create/edit file named “.bashrc”.
    Type:

    pico .bashrc

    Type:

    export PATH=$PATH:/usr/share/pk2

    Hit Ctrl + X then Y to Save file.

    Type:

    echo $PATH

    to confirm your PATH will include /usr/share/pk2 .

    (NOTE: To save your PATH alterations beyond a single session, edit “.bash_profile” in /Users/”Your user name” to include “export PATH=$PATH:/usr/share/pk2” using “pico .bash_profile” similar to above).

  5. In Terminal, navigate to the folder housing “pk2cmd”. Type:
    ./pk2cmd

    and hit return.  This should bring up the command line PICKit program in your Terminal.

  6. Upload hex file to NTH. Type:
    ./PK2CMD /PPIC16F1937 /F"hexfilename.hex" /M

    where “hexfilename.hex” is the name of your hex file. Do not include the quotes in the command.

You should now have the new firmware file uploaded to the NTH.

2 thoughts on “NTH Music Synthesizer Firmware Tutorial

  1. Pingback: Ponoko Enclosure, Firmware How-To, 2 NTHs Jamming | NTH Synth

  2. Pingback: NTH Synth

Comments are closed.