chipKIT MPIDE Board Variant Mechanism
The chipKIT MPIDE system has been designed to make it relatively easy to adapt the operation of the system to new hardware as boards are designed. We’ve put together a document that describes the mechanisms used in the system to allow a board developer to describe the features of a new board to the system and allow the system to use the new board without the need to modify any of the core hardware abstraction layer code or standard libraries.
The board variant mechanism makes use of a standardized folder structure and set of definition files that can be installed into the MPIDE system that adapt the system to work with new boards. In some cases, these files are distributed with the MPIDE, but board variant files can be easily added into an installation of MPIDE after it has been installed on the client computer.
In addition to the board variant mechanism described here, a developer designing a new board will also need to produce a boot loader for the board. Note that this document does not describe the process required to create a new custom boot loader from the boot loader project, as that process is described in a separate document.
To learn more, download the full guide here.
The PIC32MX3xx series parts do not have a USB controller. The other PIC32 series (i.e. PIC32MX4xx/5xx/6xx/7xx) all have a USB controller. The Uno32 uses a PIC32MX320F128H and therefore does not have a USB controller.
The Uno32 and Max32 have standard FTDI serial to USB interface chips (FT232R) to keep consistent with the Arduino way of interfacing. However, it is also nice to be able to use the built in USB port. Many other PIC32 boards have this USB port brought out to a standard connector such as the Microchip USB Starter Kit and the Digilent Cerebot 32MX4 and Cerebot 32MX7.
The latest version of HardwareSerial.cpp now supports the first serial port (Serial.begin(), Serial.print() etc) can be reconfigured to use the USB port instead.
In order to take full advantage of this, first you have to program the board with the USB bootloader, then use the appropriate board setting in the BOARDS menu. If you are using a custom board in the boards file you can just add the following to your board description:
When using the USB for Serial, UART1 becomes Serial0 Serial1 etc, are still there normal configurations
Serial.begin(baudrate); //The baudrate is ignored, when doing real USB, there is no baudrate.
Receive is interrupt driven and behaves EXACTLY like regular Serial. NO CODE CHANGES REQUIRED.
If you want to see how this is done, look at HardwareSerial.h and HardwareSerial.cpp, the actual usb code is in HardwareSerial_cdcacm.c and HardwareSerial_usb.c. The USB code was written by Rich T (http://www.cpustick.com/
More documentation will be provided on how to do this soon.