NU32: Bootloading from command line

From Mech
Jump to: navigation, search

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.


The NU32 can be bootloaded from the command line using some C code. The code uses serial communication to transfer data to the NU32, but the serial library is different on Windows and Mac. Follow the directions for your OS.

You can also call the bootloader program from MPLABX automatically every time you compile.

Bootloading on Windows

Download the following C file: nu32utility.c

Compile nu32utility.c using the following command: gcc nu32utility.c -o nu32utility -lwinmm

Now you can load a .hex file onto the NU32 using a command of the form nu32utility \\.\COM10 myhex.hex where

  • \\.\COM10 is the name of the larger of the two sequential COM ports
  • You can find the names of the COM ports in Device Manger -> COM
  • the \\.\ is only necessary for COM ports greater than 9
  • the hex file name is the full path to your hex file

Bootloading on Mac

Download the following C file: nu32utilitymac.c

Compile nu32utilitymac.c using the following command: gcc nu32utilitymac.c -o nu32utility

Now you can load a .hex file onto the NU32 using nu32utility /dev/tty.usbserial-00001024B myhex.hex where

  • /dev/tty.usbserial-00001024B ends in B, not A
  • You can find the names of the COM ports from Terminal using ls /dev/tty.*
  • the hex file name is the full path to your hex file

Bootloading from MPLABX

Open the project properties, and under Conf -> Building, check 'Execute this line after build', and enter something like

c:\nu32utility\nu32utility.exe \\.\COM34 ${ImagePath}

in the line. The first entry is the path of the bootloader program. The second is the name of the COM port. The third is the path of the hex file, which can be inserted by MPLABX by the macro ${ImagePath}

Personal tools