Skip to content

"IoT Made Easy!" - This application serves as an illustration of how to extend a CAN network wirelessly using BLE. The CAN-BLE Central Device connects to the CAN-BLE Peripheral Device and establishes a BLE link using Microchip's proprietary Transparent UART Profile for CAN data transfer.

Notifications You must be signed in to change notification settings

MicrochipTech/pic32cxbz2_wbz45x_ble_can_bridge

Repository files navigation

PIC32CXBZ2_WBZ45x BLE to CAN Bridge using MCP251863

"IoT Made Easy!"

Devices: | PIC32CXBZ2 | WBZ45x |
Features: | CAN | BLE |

⚠ Disclaimer

THE SOFTWARE ARE PROVIDED "AS IS" AND GIVE A PATH FOR SELF-SUPPORT AND SELF-MAINTENANCE. This repository contains example code intended to help accelerate client product development.

For additional Microchip repos, see: https://github.com/Microchip-MPLAB-Harmony

Checkout the Technical support portal to access our knowledge base, community forums or submit support ticket requests.

Contents

  1. Introduction
  2. Bill of materials
  3. Hardware Setup
  4. Software Setup
  5. Harmony MCC Configuration
  6. Board Programming
  7. Run the demo

1. Introduction

This application serves as an illustration of how to extend a CAN network wirelessly using BLE.
CAN Bridge Block Diagram The CAN-BLE Central Device connects to the CAN-BLE Peripheral Device and establishes a BLE link using Microchip's proprietary Transparent UART Profile for data transfer.

The Microchip CAN Bus Analyzer tool is used in this example to simulate transmitting and receiving CAN messages from a CAN network. Alternatively, the CAN-BLE peripheral device can be connected to a mobile application to visualize the CAN messages on a mobile phone.

2. Bill of materials

TOOLS QUANTITY
PIC32CX-BZ2 and WBZ451 Curiosity Development Board 2
MCP251863 CLICK 2
CAN BUS ANALYZER TOOL 2
DB9 Connector 2

3. Hardware Setup

WBZ451 MCP251863 CLICK Description WBZ451 MCP251863 CLICK Description
AN 1(STB) StandBy Control PWM NC NC
RST 13(IN1) RX Interrupt INT NC NC
CS 3(CS) CHIP SELECT RX NC NC
SCK 4(SCK) SPI CLOCK TX NC NC
MISO 5(MISO) SERIAL DATA OUTPUT SCL NC NC
MOSI 6(MOSI) SERIAL DATA INPUT SDA NC NC
3.3V 7(3.3V) POWER SUPPLY 5V 5V 5V POWER SUPPLY
GND 8 (GND) GROUND GND GND GROUND

4. Software Setup

5. Harmony MCC Configuration

6. Board Programming

Programming hex file:

Program the precompiled hex file using MPLAB X IPE

  • The Precompiled hex file is given in the hex folder. Follow the steps provided in the link to program the precompiled hex file using MPLABX IPE to program the pre-compiled hex image.

Build and program the application using MPLAB X IDE

The application folder can be found by navigating to the following path:

  • CAN-BLE Central Device
    • "01_wbz451_mcp251863_CAN_BLE_Central\firmware\bleCan_Central.X"
  • CAN-BLE Peripheral Device
    • "02_wbz451_mcp251863_CAN_BLE_Peripheral\firmware\bleCan_Peripheral.X"

Follow the steps provided in the link to Build and program the application.

7. Run the demo

Running Demo as CAN BLE Bridge

  • Program a WBZ451 Curiosity board with bleCan_Central application and other with WBZ451 Curiosity board with bleCan_Peripheralapplication.
  • Connect MCP251863 CLICK to Mikroe Header in WBZ451 Curiosity board as per the Hardware Setup
  • Connect CAN BUS ANALYZER TOOL to MCP251863 CLICK board using a DB9 Connector as shown in the figure.

MCP251863_WBZ451_SETUP

  • The transmission and receipt of CAN messages from a CAN network are recreated using the Microchip CAN Bus Analyzer tool.
  • Open Microchip CAN Bus Analyzer tool, in 'Setup --> Hardware Setup', Configure the CAN Bitrate Control, CAN Mode Control and Bus Termination Control as shown below figure.
    CAN ANALYZER Hardware setup
  • Open Rolling Trace window from 'Tools --> Rolling Trace' to view the transmitted and received data. CAN ANALYZER Rolling Trace
  • Open Transmit Window from 'Tools --> Transmit' to transmit data from CAN Bus Analyzer Tool.
  • Configure the Transmit window as shown in the below figure. CAN ANALYZER Transmit
  • Similarly Open another instance of Microchip CAN Bus Analyzer tool and configure the tool as mentioned in above steps
  • Click on Send Button in Transmit window to send the data from CAN
  • Observe the data is being received on other instance of CAN Analyzer
  • The below video shows the working of the CAN-BLE bridge.

Alt Text

Connecting CAN Network to Mobile App (MBD App)

  • Program a WBZ451 Curiosity board with bleCan_Peripheralapplication.
  • Connect MCP251863 CLICK to Mikroe Header in WBZ451 Curiosity board as per the Hardware Setup
  • Connect CAN BUS ANALYZER TOOL to MCP251863 CLICK board using a DB9 Connector as shown in the figure.
  • Open Microchip MBD Application on Mobile phone and click on BLE Smart to scan for the available devices.

MBD_APP_1

  • The MBD App will scan for the available devices and the scan result will be shown as below. Select "CAN BLE Bridge Device" from the scan list.

MBD_APP_2

  • Click on the Connect button to establish a BLE Connection with the device.

MBD_APP_3

  • Once BLE Connection is established and service discovery is completed, Transparent UART Service is discovered and shown as Microchip Data Service as shown below.

MBD_APP_4

  • To view the CAN messages transmitted via BLE, select the Transparent UART TX Characteristic (UUID ending with 9616) as shown below.

MBD_APP_5

  • In the Characteristics page, enable notify/indicate as shown below.

MBD_APP_6

  • Open CAN Bus Analyzer Tool and set Transmit window as shown below and click on the send button.

CAN Analyzer Tool tx

  • The MBD App will show the received messages as shown below.

MBD_APP_7

  • The below video shows the working of the CAN-BLE bridge using MBD application.

Alt Text

About

"IoT Made Easy!" - This application serves as an illustration of how to extend a CAN network wirelessly using BLE. The CAN-BLE Central Device connects to the CAN-BLE Peripheral Device and establishes a BLE link using Microchip's proprietary Transparent UART Profile for CAN data transfer.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published