3.1.2 Barcode Scanner Application using PIC32CX SG61 Curiosity Ultra Evaluation Board

Download

Description

This application detects the EAN-13 barcode and decodes it with the help of the ArduCAM Mega camera module. The ArduCAM Mega captures an image with a resolution of 1920x1080 and stores the image in an internal memory. The decoded barcode is then displayed on the serial console and graphical display.

Modules/Technology Used

  • Peripheral Modules
    • NVMCTRL
    • EVSYS
    • NVIC
    • PORT
    • SYSTICK
    • SERCOM - SPI
    • SERCOM - UART
    • TC
  • Drivers
    • SPI Driver
    • LE SPI 4-line display driver
    • External Display Controller Driver
  • System Services
    • Time
    • STDIO
    • Input System
  • Middleware libraries
    • Harmony Core
    • Legato Graphics

Hardware Used

Software/Tools Used

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

Refer Project Manifest present in harmony-manifest-success.yml under the project folder firmware/src/config/pic32cx_sg61_cult.

  • Refer the Release Notes to know the MPLAB X IDE and MCC Plugin version.
  • Any Serial Terminal application like Tera Term terminal application.

Because Microchip regularly updates tools, occasionally issue(s) could be discovered while using the newer versions of the tools. If the project does not seem to work and version incompatibility is suspected. It is recommended to double-check and use the same versions that the project was tested with. To download original version of MPLAB Harmony v3 packages, refer to document How to Use the MPLAB Harmony v3 Project Manifest Feature (DS90003305).

Setup

  • Connect the ArduCAM Camera module and OLED C Click board to the PIC32CX SG61 Curiosity Ultra Evaluation Board as shown below.
  • Connect the ArduCAM pins directly to the Extension 2 (EXT2) pins. See table below:
  • Mount the OLED C Click board on mikroBUS connector of PIC32CX SG61 Curiosity Ultra Evaluation Board.
  • Connect a micro-USB cable to the DEBUG USB port of the PIC32CX SG61 Curiosity Ultra Evaluation Board to power the board and for programming and debugging.

Programming hex file

The pre-built hex file can be programmed by following the below steps

Steps to program the hex file
  • Open MPLAB X IDE.
  • Close all existing projects in IDE, if any project is opened.
  • Go to File -> Import -> Hex/ELF File.
  • In the Import Image File window,
    1. Create Prebuilt Project,
      • Click the Browse button to select the prebuilt hex file.
      • Select Device as PIC32CX1025SG61128.
      • Ensure the proper tool is selected under Hardware Tool and click on Next button.
    2. Select Project Name and Folder,
      • Select appropriate project name and folder and click on Finish button
  • In MPLAB X IDE, click on Make and Program Device button to program the device.
  • Follow the steps in Running the Demo section below.

Programming/Debugging Application Project

  • Open the project (pic32cx_sg61_barcode_scanner\firmware\pic32cx_sg61_cult.X) in MPLAB X IDE.
  • Ensure PIC32CX SG61 Curiosity Ultra is selected as hardware tool to program/debug the application.
  • Build the code and program the device by clicking on the Make and Program Device button in MPLAB X IDE tool bar.
  • Debugging the project can be done by clicking on the Debug Main Project button in MPLAB X IDE tool bar.
  • Follow the steps in Running the Demo section below.

Running the Demo

  • Open a standard terminal application on the computer (like Putty or Tera Term) and configure the virtual COM port.
  • Set the serial baud rate to 115200 baud in the terminal application.
  • Wait for the initialization prints in the serial port terminal. If it does not show any prints, press the RESET button on the curiosity board or give the command ‘0’ through terminal console or press the RESET button which resets the development board.
  • When the ArduCAM Mega Camera is enabled in the demonstration, wait for the initialization confirmation from the development board. This will be printed on the serial port terminal.
  • Show the Barcode in front of the camera for capture (maintain a minimum distance of 10 to 15 cm).
  • Give the command ‘1 through terminal console.
  • An LED “LED0” on the PIC32CX SG61 Curiosity Ultra Evaluation Board toggles when the scanning is in progress.
  • Once the scanning is completed, the result will be displayed in the terminal console as well as graphical display also.

Output

Note:
  • This demo supports EAN-13 barcodes only.
  • Print the EAN-13 type barcode on an A4 sheet and show it before the ArduCAM Mega Camera module (keep a distance of 10 to 15 cm).

Comments