This article provides the step-by-step explanations for how to build a firmware form its source code, then how to write the firmware into PIC of BC-USB-Kit.
When you write your firmware into your BC-USB-Kit, please apply this method.
To complete the build and writing processes, the hardware and applications are required.
- BC-USB-Kit No pin headers are attached to BC-USB-Kit. There are only hole-throughs. Please solder a DIP-28 connected IC socket and an A/R type L-shaped 6-pin pin header to J1 and J2, respectively.
- In-Circuit Debugger In-circuit Debugger is a tool for writing a firmware into a PIC micro controller. There are two types of In-Circuit Debuggers for PIC: MPLAB ICD 3 and MPLAB PICkit 3. In this article, PICkit 3 is used.
- Firmware (for checking) The source code of a demo firmware, “USB Device - CDC - Sensors.zip,” is listed here. It uses the humidity and temperature sensor of BC-USB-Kit.
This firmware can be used for checking the operational status of BC-USB-Kit as well as testing this demo.
- MPLAB X IDE This is an IDE for the PIC micro controller. It is used for developing firmwares.
- MPLAB XC Compilers 16bit version (XC16) In this article, Windows version of MPLAB X IDE and MPLAB XC Compiler (XC16) are used.
If you use other platforms other than Windows, please apply the same kinds of tasks, which are explained here.
1. Expand the downloaded source code of the firmware, “USB Device - CDC - Sensor.zip.”
2. Start up X IDE.
3. From the menu of MPLAB X IDE, select File →Open Project...
Open Up “USB Device - CDC – Sensor.X,” which is located at the directory of “USB Device -CDC- Sensor\src\aps\usb\device\cdc_i2c\firmware\.”
4. Once open up the project you will use, close Start Page of MPLAB X IDE.
From the menu of MPLAB X IDE, choose Run →Set Project Configuration → Customize.
As the Project Properties Window opens, configure the usign Hardware Tool and Compiler Toolchain for the project. In this project, PICkit 3 is selected for Hardware Tool, and XC16 (v.1.24) is chosen for Compiler Toolchain.
5. Once these configurations of Hardware Tool and Compiler Toolchain are completed, select the configuration of Power for PICkit 3. Then, check the box of “Power target circuit form PICkit 3.” This is the end of preparations for building the firmware.
6. Once the preparations are completed, to click the icon of Build Project (look at the red circle in the picture) on the window menu of MPLAB X IDE, execute the build process.
As the execution log shows up in the tab of USB Device - CDC - Sensor on Output pane, the build process of the firmware is completed.
The name of the built firmware is “USB_Device_-_CDC_-_Sensor.X.production.hex, which is located at the directory of “USB Device - CDC - Sensor\src\apps\usb\device\cdc_i2c\firmware\USB Device - CDC – Sensor.X\dist\bc_usbkit_pic24f\production.”
1. The build process of the firmware is completed, click the icon of Run project (See the red circle in the picture) on the window menu of MPLAB X IDE.
> The firmware is written into BC-USB-Kit by PICkit 3. While PICkit 3 writes the firmware into PIC, the color of its status LED changes from green to red. As the writing process is completed without any issues, the color of status LED goes back from red to green.
The status of the writing process is appeared in the PICkit tab on Output pane of the MPLAB X IDE main window.Picture>
Programming... Programming/Verify completeWhen the status shown above appears in the tab, the writing process is successfully finished.
If you click the icon of Make and Program Device (See the red circle in the picture) on the window menu of MPLAB X IDE, both the build process and the writing process can be completed at onece.Picture>
1. As BC-USB-Kit, which is the firmware is already written, is connected to a USB port of a PC, driver is installed into the PC, and BC-USB-Kit is recognized as a USB serial port (COM *).
2. To open up the recognized COM port by TeraTerm at Baud rate of 9600, the output numbers are displayed.
> The contents of outputs are the read values of the humidity and temperature sensor. These are repeated results of “Temperature x 10: Humidity x 10” return sentence.~
- 2015/04/01 This document is initially published.