labs.beatcraft.com
BC-USB-Kit

BC-USB-Kit get started

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.

Requirements

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.
    001.png 001_Pk.png

  • 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 ICD
    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.

Build the Firmware

  1. Expand the downloaded source code of the firmware, “USB Device - CDC - Sensor.zip."
    003_firmware.png

  2. Start up X IDE.
    004_X_IDE_launch.png 005_X_IDE.png

  3. From the menu of MPLAB X IDE, select File →Open Project...
    006_X_IDE_open.png

    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\.”
    007_X_IDE_open.png 008_X_IDE_open.png 009_X_IDE_open.png

  4. Once open up the project you will use, close Start Page of MPLAB X IDE.
    010_X_IDE.png 011_X_IDE.png

    From the menu of MPLAB X IDE, choose Run →Set Project Configuration → Customize.
    012_X_IDE_conf.png

    As the Project Properties Window opens, configure 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.
    013_X_IDE_pp.png 014_X_IDE_pp.png

  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.
    015_X_IDE.png 016_X_IDE.png 017_X_IDE.png

  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.
    018_X_IDE_build.png

    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.
    019_X_IDE_build.png

    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.”

Writing the firmware onto PIC

  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.
    020_X_IDE_rp.png

    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.
    021_X_IDE_rp.png

    Programming...
    Programming/Verify complete
    When 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 once.
    022_X_IDE_mp.png

  • If the writing process is failed, pull off the USB cable of PICkit 3 from the PC once and reconnect the USB cable to the PC. Then, at MPLAB X IDE, show the tab of “USB_Device_-_CDC_-_Sensor – Dashboard” on the left side pane of the main window, and click the icon of “Refresh Debug Tool Status.”
    027_X_IDE.png

    If the color of status LED at PICkit 3 turns to green, it means the system is working correctly.
    Still the writing process is failed, please check the solder work at J2.

Conforming operation of the firmware

  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 *).
    023_driver.png 024_driver.png

  2. To open up the recognized COM port by TeraTerm at Baud rate of 9600, the output numbers are displayed.
    025_teraterm.png 026_teraterm.png

    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.”

Revision History

  • 2015/04/01 This document is initially published.

Attach file: file027_X_IDE.png 345 download [Information] fileUSB Device - CDC - Sensor.zip 340 download [Information] file026_teraterm.png 369 download [Information] file025_teraterm.png 365 download [Information] file024_driver.png 349 download [Information] file023_driver.png 388 download [Information] file022_X_IDE_mp.png 346 download [Information] file021_X_IDE_rp.png 354 download [Information] file020_X_IDE_rp.png 377 download [Information] file019_X_IDE_build.png 365 download [Information] file018_X_IDE_build.png 336 download [Information] file017_X_IDE.png 345 download [Information] file016_X_IDE.png 357 download [Information] file015_X_IDE.png 348 download [Information] file014_X_IDE_pp.png 385 download [Information] file013_X_IDE_pp.png 349 download [Information] file012_X_IDE_conf.png 360 download [Information] file011_X_IDE.png 360 download [Information] file010_X_IDE.png 353 download [Information] file009_X_IDE_open.png 365 download [Information] file008_X_IDE_open.png 389 download [Information] file007_X_IDE_open.png 378 download [Information] file006_X_IDE_open.png 374 download [Information] file005_X_IDE.png 370 download [Information] file004_X_IDE_launch.png 358 download [Information] file003_firmware.png 361 download [Information] file001_Pk.png 373 download [Information] file001.png 429 download [Information]

Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   RSS of recent changes
Last-modified: 2015-04-01 (Wed) 09:52:17 (968d)