Creating a Harmony BSP for Your Custom Hardware

 Objective

MPLAB® Harmony provides Board Support Package (BSP)

A Board Support Package (BSP) provides code and configuration items to support board-specific hardware. It may be provided for Microchip development boards or may be defined by you for your own board. It allows you to manage board-specific settings and code in one place. Any changes to a BSP will propagate automatically to every configuration of every application that uses that BSP.

You need to define a BSP if you plan to use the same board for multiple applications (or for multiple configurations of an application).

In this training module, you will learn how to create a BSP for your custom development board. As an example we have chosen the PIC32MZEF Curiosity Development Board to create a BSP.

 Materials

Development Board User's Guide Files

Files

Software Tools

This project has been verified to work with the following versions of software tools:

  • MPLAB® X IDE v3.50
  • MPLAB® XC32 Compiler v1.42
  • MPLAB® Harmony v2.02b

Because we regularly update our tools, occasionally you may discover an issue while using newer versions. If you suspect that to be the case, we recommend that you double check using the same versions that the project was tested with.

Archived versions of our tools can be found on the following Microchip websites:
MPLAB Harmony (see "Archived Downloads" tab)
MPLAB X IDE and XC32 Compiler (see "Downloads Archive" tab)
Note that multiple versions of all these tools can co-exist on the same computer.

Tool About Installers
Installation
Instructions
Windows Linux Mac OSX
MPLAB® X
Integrated Development Environment
MPLAB® XC32
C/C++ Compiler
MPLAB® Harmony 1.xx
Integrated Software Framework

Overview

The process for creating a BSP for your custom hardware is outlined below:


Process Diagram
  1. Analyze the schematics of the custom hardware and decide on which pins are to be mapped in the BSP.
  2. Verify and update the global bsp.hconfig file with the device information related to the PIC32 part on your development board.
  3. Update the <device name>.hconfig to support your edvelopment board.
  4. Create a new folder with the necessary BSP files.
  5. Update the bsp.hconfig file in the local BSP folder.
process_diagram.png
Click image to enlarge.

Procedure

The following steps need to be completed in a sequential manner to create a BSP for your custom development board:

Lab Index

Step 1: Analyze the schematics and make an assessment of pin mapping

  • Step 1.1 – Criteria to map a pin.
  • Step 1.2 – Decide on pins to be mapped in the BSP.

Step 2: Verify and update the global bsp.hconfig file

  • Step 2.1 - Identify the document number of the device.
  • Step 2.2 - Verify and update the global bsp.hconfig file.
  • Step 2.3 - Update .hconfig file of the PIC32 device.

Step 3: Create a new folder for the necessary BSP files

  • Step 3.1 - Create a BSP folder.
  • Step 3.2 - Modify the files in the BSP folder.

Step 4: Modify the local bsp.hconfig file

  • Step 4.1 - Modify the local bsp.hconfig file.

Step 5: Verify the newly created BSP

  • Step 5.1 - Create a new MPLAB Harmony project.
  • Step 5.2 - Verify that the new BSP is created for the device.
  • Step 5.3 - Verify BSP components in MHC.

Step 6: Test the BSP

  • Step 6.1 - Generate code.
  • Step 6.2 - Verify the system configuration.
  • Step 6.3 - Build the application.
  • Step 6.4 - Add application code.
  • Step 6.5 - Test the application.

 Results

You created a Board Support Package (BSP) from scratch for your custom development board. You should be able to use the API's provided by your BSP in your application. With the BSP taking care of the clock and pin configurations, you can focus on your application development.

 Analysis

You analyzed the schematics and made an assessment on what goes into your BSP. You modified the <device_name>.hconfig file to make your BSP appear as an option in the MHC's BSP selection menu. You created a folder structure which supports your custom development board. You made board specific clock and pin configurations in the local bsp.hconfig. Finally, you tested your newly created BSP on an application.

 Conclusions

With this tutorial we demonstrated how easy it is to create a BSP for your custom development board. The BSP can be used for all the applications you develop on your custom development board. All clock configurations and pin configurations will be taken care by MHC; all you need to focus on is development of your application.

© 2017 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.