Binary Data eXchange(BDX) Protocol

Overview

Embedded systems call for data communication between two devices that should be reliable and simple to implement. The data to be carried also varies including the file upload/download, devince information, data configuration, RTC settings etc.

RAPIDSEA BDX (standing for Binary Data eXchange) serves this purpose with a predefined frame structure suitable for embedded communicaiton.

Supported features

RAPIDSEA BDX Stack supports the following features

  • Simple header and footer based delimiter

  • CRC validation

  • Maximum frame size of 65535 bytes

  • Transport medium agnostic

  • Request/Response mechanism

The protocol operates in synchronous manner i.e. there must be a response for ever request. Though it need not be immediate, the responder must respond with in a pre-configured time, otherwise the requester assumes the command timedout. The responder will not accept another command till it completes processing of the previous one.

As a standalone module, it supports easy integration with any embedded firmware.

Frame Structure

The design philosophy behind the BDX protocol is its simplicity. The request frame has the following structure

Request Frame

Function

Size (Bytes)

Description

header

1

Fixed signature

cmd

1

Command to indicate operation

sub_index

2

Provide more information about the command such as file ID etc.

data_size

2

Size of the following data bytes associated with the command

data

Variable

Data associated with the command

footer

1

Fixed signature

CRC

1

CRC calculated from header to footer

Similarly the response frame without any data has the following structure

Response Frame without data

Function

Size (Bytes)

Description

header

1

Fixed signature

cmd

1

Command associated with this response

status

1

Result of the operation. 0 for success or error code

footer

1

Fixed signature

CRC

1

CRC calculated from header to footer

The response frame data has the following structure

Response Frame without data

Function

Size (Bytes)

Description

header

1

Fixed signature

cmd

1

Command associated with this response

data_size

2

Size of the following data bytes associated with the response

data

Variable

Data associated with the command

footer

1

Fixed signature

CRC

1

CRC calculated from header to footer

Application Interface

The RAPIDSEA BDX stack is transparent to the underlying communication medium and data received from the interface must be fed to it through the bwlo mentioned APIs.

The below table captures the function that are to be called from the application logic.

API Functions

Function

Description

rs_bdx_process

To be called periodically to handle processing

rs_bdx_process_request

To handle the request packed received

rs_bdx_get_file_op_status

Get file operation status

There are many functions through which the BDX stack indicate actions to be performed. These functions are captured in the below table.

Callback Functions

Function

Description

rcb_bdx_get_file_info

Called to get information about the requested file

rcb_bdx_get_file_data

Called to get part of data from the file being uploaded

rcb_bdx_transmit_data

Called to transfer the response over the communication interface

rcb_bdx_is_tx_ongoing

Called to check if there is transmission ongoing on the communication interface

rcb_bdx_get_async_req_resp

Called to get the asynchronous request that is pending to be processed

rcb_bdx_start_download_file

Called to initiate file download

rcb_bdx_download_data

Called to process file data being downloaded

rcb_bdx_file_download_complete

Called to indicate completion of file download operation.

rcb_bdx_firmware_update

Called to initiate firmware update operation

rcb_bdx_rtc_time_set

Called to set RTC time

These functions are documented in detail in the below sections. It is important for the application to implement these functions correct for proper operation of the system.

Supported Commands

Following commands are supported as of now.

Supported Commands

Command

Description

RS_BDX_CMD_FILE_GET_INFO

Get information about the file

RS_BDX_CMD_FILE_START_UPLOAD

Initiation file upload operation

RS_BDX_CMD_FILE_START_DOWNLOAD

Initiation file download operation

RS_BDX_CMD_FILE_DATA

File Upload/Download data packet

RS_BDX_CMD_FILE_STOP_DATA

End of File upload/download operation

RS_BDX_CMD_FIRMWARE_UPDATE_TRIGGER

Initiates firmware update process

RS_BDX_CMD_GET_DEVICE_INFO

Get information about the device

RS_BDX_CMD_UUID_REQUEST

Get UUID of the device

RS_BDX_CMD_RTC_TIME_GET

Get RTC time from the device

RS_BDX_CMD_GET_DEVICE_INFO

Set RTC time of the device

RS_BDX_CMD_USER_DEFINED

Start of user defined commands

Major Commands Flow

In this section, flow of some of the major commands are captured.

File Download Flow

Requester

Direction

Responder

RS_BDX_CMD_FILE_START_DOWNLOAD (sub_index = FILE_ID)

—->

<—-

RS_BDX_CMD_FILE_START_DOWNLOAD success response

RS_BDX_CMD_FILE_DATA (sub_index = data offset 0)

—->

<—-

RS_BDX_CMD_FILE_DATA success response

RS_BDX_CMD_FILE_DATA (sub_index = data offset n - x)

—->

<—-

RS_BDX_CMD_FILE_DATA success response

RS_BDX_CMD_FILE_DATA (sub_index = data offset n)

—->

<—-

RS_BDX_CMD_FILE_DATA success response

RS_BDX_CMD_FILE_STOP_DATA (sub_index = file ID)

—->

<—-

RS_BDX_CMD_FILE_STOP_DATA success response

Implementation Guide

Dependency

This stack depends on the below RAPIDSEA modules/interfaces/utils that can be obtained or custom implemented.

ANC Header Details

Documentation from the relevant header as follows:

Warning

doxygenfile: Cannot find file “rs_bdx.h