Objective
MPLAB® Harmony provides Board Support Packages (BSPs).
A 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 which 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.
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
Note: As the tools are regularly updated, there may be occasional issues while using newer versions. If that is the case, we recommend using the same version as specified in the project.
The archived versions of our tools can be found below:
MPLAB Harmony
MPLAB X IDE and XC32 Compiler
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 |
- Analyze the schematics of the custom hardware and decide which pins are to be mapped in the BSP.
- Verify and update the global bsp.hconfig file with the device information related to the PIC32 part on your development board.
- Update the <device name>.hconfig to support your development board.
- Create a new folder with the necessary BSP files.
- Update the bsp.hconfig file in the local BSP folder.
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.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 BSP from scratch for your custom development board. You should be able to use the APIs 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 that 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. MHC will take care of all the clock and pin configurations; all you need to focus on is the development of your application.