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
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
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
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.
There are many functions through which the BDX stack indicate actions to be performed. These functions are captured in the below table.
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.
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.
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:
Binary data exchange Specific APIs.
Defines macros and functions specific to Binary data exchange functionality
- Author
Embien RAPIDSEA Team
- Copyright
Embien Technologies India Pvt. Ltd.
Defines
-
RS_BDX_FRAME_HEADER
< USB receive frame header
USB receive frame footer
-
RS_BDX_FRAME_FOOTER
-
RS_BDX_REQ_HEADER_SIZE
Response frame size.
BDX Frame size Header size for request
-
RS_BDX_RESP_FRAME_SIZE
-
RS_BDX_MAX_LEN_VERSION
Device name length.
BDX Length info Version length
-
RS_BDX_MAX_LEN_DEVICE_NAME
-
RS_BDX_CMD_STATUS_SUCCESS
Command status failure.
BDX cmd status Command status success
-
RS_BDX_CMD_STATUS_FAILED
No file operation in progress.
-
RS_BDX_FILE_OP_NOT_IN_PROGRESS
File upload in progress.
-
RS_BDX_FILE_OP_UPLOAD_IN_PROGRESS
File download in progress.
-
RS_BDX_FILE_OP_DOWNLOAD_IN_PROGRESS
Command to get file information.
-
RS_BDX_CMD_FILE_GET_INFO
Command to start file upload.
-
RS_BDX_CMD_FILE_START_UPLOAD
Command to start file download.
-
RS_BDX_CMD_FILE_START_DOWNLOAD
Command to transmit file data.
-
RS_BDX_CMD_FILE_DATA
Command to stop file data transmission.
-
RS_BDX_CMD_FILE_STOP_DATA
Command to Firmware upadte trigger*/.
-
RS_BDX_CMD_FIRMWARE_DOWNLOAD_TRIGGER
Command to device infermation.
-
RS_BDX_CMD_GET_DEVICE_INFO
Command to UUID.
-
RS_BDX_CMD_UUID_REQUEST
Command to get RTC time.
-
RS_BDX_CMD_RTC_TIME_GET
Command to set RTC time.
-
RS_BDX_CMD_RTC_TIME_SET
Command to reboot the system.
-
RS_BDX_CMD_SYSTEM_REBOOT
Command to get debug information.
-
RS_BDX_CMD_GET_DEBUG_INFO
Command to delete the files.
-
RS_BDX_CMD_FILE_DELETE
Command to update the downloaded firmware file.
-
RS_BDX_CMD_FIRMWARE_UPDATE
Command to update the downloaded firmware file.
-
RS_BDX_CMD_ASYNC_DATA
Command to update the downloaded firmware file.
-
RS_BDX_CMD_ASYNC_DATA_CH_0
Command to update the downloaded firmware file.
-
RS_BDX_CMD_ASYNC_DATA_CH_1
Command to update the downloaded firmware file.
-
RS_BDX_CMD_ASYNC_DATA_CH_2
Command to update the downloaded firmware file.
-
RS_BDX_CMD_ASYNC_DATA_CH_3
Command to update the downloaded firmware file.
-
RS_BDX_CMD_ASYNC_DATA_CH_4
Command to update the downloaded firmware file.
-
RS_BDX_CMD_ASYNC_DATA_CH_5
Command to update the downloaded firmware file.
-
RS_BDX_CMD_ASYNC_DATA_CH_6
Command to update the downloaded firmware file.
-
RS_BDX_CMD_ASYNC_DATA_CH_7
Command to update the downloaded firmware file.
-
RS_BDX_CMD_ASYNC_DATA_CH_8
Command to update the downloaded firmware file.
-
RS_BDX_CMD_ASYNC_DATA_CH_9
Command to update the downloaded firmware file.
-
RS_BDX_CMD_ASYNC_DATA_CH_10
Command to update the downloaded firmware file.
-
RS_BDX_CMD_ASYNC_DATA_CH_11
Command to update the downloaded firmware file.
-
RS_BDX_CMD_ASYNC_DATA_CH_12
Command to update the downloaded firmware file.
-
RS_BDX_CMD_ASYNC_DATA_CH_13
Command to update the downloaded firmware file.
-
RS_BDX_CMD_ASYNC_DATA_CH_14
Command to update the downloaded firmware file.
-
RS_BDX_CMD_ASYNC_DATA_CH_15
Command to set CAN nominal .
-
RS_BDX_CMD_CAN_SET_BAUDRATE
Command to set detailed CAN bit timing parameters (e.g., segments, SJW).
-
RS_BDX_CMD_CAN_SET_BIT_TIMING
Command to add a CAN hardware/software filter.
-
RS_BDX_CMD_CAN_ADD_FILTER
Command to clear all configured CAN filters.
-
RS_BDX_CMD_CAN_CLEAR_FILTER
Command to start the CAN controller (begin communication).
-
RS_BDX_CMD_CAN_START
Command to stop the CAN controller (halt communication).
-
RS_BDX_CMD_CAN_STOP
Command to set CAN mode (e.g.,Classic CAN, FD CAN).
-
RS_BDX_CMD_CAN_SET_MODE
-
RS_BDX_CMD_SERIAL_SET_CONFIG
-
RS_BDX_CMD_MODBUS_READ_COILS
-
RS_BDX_CMD_MODBUS_READ_DISC_INPUTS
-
RS_BDX_CMD_MODBUS_READ_HOLDING_REG
-
RS_BDX_CMD_MODBUS_READ_INPUT_REG
-
RS_BDX_CMD_MODBUS_WRITE_SINGLE_COIL
-
RS_BDX_CMD_MODBUS_WRITE_SINGLE_REG
-
RS_BDX_CMD_MODBUS_WRITE_MULTIPLE_COILS
-
RS_BDX_CMD_MODBUS_WRITE_MULTIPLE_REG
Command to get RTC time.
-
RS_BDX_CMD_USER_DEFINED
-
RS_BDX_FILE_FIRMWARE_A
< Firmware File A
Firmware File B
-
RS_BDX_FILE_FIRMWARE_B
Firmware File BL main.
-
RS_BDX_FILE_BOOTLOADER_MAIN
Firmware File wifi module.
-
RS_BDX_FILE_FIRMWARE_WIFI_MODULE
Firmware File BL wifi module.
-
RS_BDX_FILE_BOOTLOADER_WIFI_MODULE
Firmware File sub ghz module.
-
RS_BDX_FILE_FIRMWARE_SUB_GHZ_MODULE
Firmware File BL sub ghz module.
-
RS_BDX_FILE_BOOTLOADER_SUB_GHZ_MODULE
Firmware File LTE module.
-
RS_BDX_FILE_FIRMWARE_LTE_MODULE
Firmware File BL LTE module.
-
RS_BDX_FILE_BOOTLOADER_LTE_MODULE
Firmware File lora module.
-
RS_BDX_FILE_FIRMWARE_LORA_MODULE
Firmware File BL lora module.
-
RS_BDX_FILE_BOOTLOADER_LORA_MODULE
device config file
-
RS_BDX_FILE_DEVICE_CONFIG
data config file
-
RS_BDX_FILE_DATA_CONFIG
system config file
-
RS_BDX_FILE_SYSTEM_LOG
log File
-
RS_BDX_FILE_STORED_DATA
Firmware File.
-
RS_BDX_FILE_ROOTCA_CERT
Firmware File.
-
RS_BDX_FILE_CLIENT_PEM
Firmware File.
-
RS_BDX_FILE_CLIENT_KEY
channel 0 identifier
-
RS_BDX_FILE_CH_0
channel 1 identifier
-
RS_BDX_FILE_CH_1
channel 2 identifier
-
RS_BDX_FILE_CH_2
channel 3 identifier
-
RS_BDX_FILE_CH_3
channel 4 identifier
-
RS_BDX_FILE_CH_4
channel 5 identifier
-
RS_BDX_FILE_CH_5
channel 6 identifier
-
RS_BDX_FILE_CH_6
channel 7 identifier
-
RS_BDX_FILE_CH_7
channel 8 identifier
-
RS_BDX_FILE_CH_8
channel 9 identifier
-
RS_BDX_FILE_CH_9
channel A identifier
-
RS_BDX_FILE_CH_10
channel B identifier
-
RS_BDX_FILE_CH_11
channel C identifier
-
RS_BDX_FILE_CH_12
channel D identifier
-
RS_BDX_FILE_CH_13
channel F identifier
-
RS_BDX_FILE_CH_14
channel F identifier
-
RS_BDX_FILE_CH_15
Device Name.
-
RS_BDX_DEVICE_NAME_VERSION
Device Versions - SW, HW etc.
-
RS_BDX_DEVICE_CAPABILITY
Byte in bits.
-
RS_BDX_BYTE_IN_BITS
-
RS_BDX_MAX_SIZE_DEVICE_INFO
Typedefs
-
typedef struct tag_rs_bdx_frame rs_bdx_frame_t
Structure to represent BDX frame.
-
typedef struct tag_rs_bdx_status_resp_frame rs_bdx_status_resp_frame_t
Structure to represent BDX status response frame.
-
typedef struct tag_rs_bdx_status_resp_frame_with_data rs_bdx_status_resp_frame_with_data_t
Structure to represent BDX status response frame.
-
typedef struct tag_rs_bdx_dev_info_resp_frame rs_bdx_dev_info_resp_frame_t
Structure to represent BDX status response frame.
-
typedef struct tag_rs_bdx_config rs_bdx_config_t
Structure to represent BDX configuration.
-
typedef struct tag_rs_bdx_instance rs_bdx_instance_t
Structure to represent BDX instance information.
Functions
-
rs_handle_t rs_bdx_open(rs_bdx_instance_t *ptr_bdx_instance, rs_bdx_config_t *ptr_bdx_config)
Initializes the BDX.
This function opens the BDX
- Parameters:
ptr_instance – [in] - Pointer to the BDX instance
ptr_config – [in] - Pointer to the BDX configuration information
- Returns:
Handle on success or negative error code
-
rs_ret_val_t rs_bdx_process(rs_handle_t handle)
Processes BDX (Binary Data Exchange) communication.
This function handles the overall BDX communication process.
- Parameters:
handle – [in] - Handle to the BDX
- Returns:
0 on success and error on failure
-
rs_ret_val_t rs_bdx_process_request(rs_handle_t handle, rs_bdx_frame_t *ptr_req, uint32_t u32_len)
Processes a specific BDX request.
This function processes an individual BDX request, which is represented by a BDX frame.
- Parameters:
handle – [in] - Handle to the BDX
ptr_req – [in] - A pointer to the BDX request frame to be processed
u32_len – [in] - BDX request frame length
- Returns:
0 on success and error on failure
-
rs_ret_val_t rs_bdx_get_file_op_status(rs_handle_t handle)
Retrieves the current file operation status.
This function checks the current file operation status of the provided BDX control structure. It ensures the pointer is valid before accessing the file operation state.
- Parameters:
handle – [in] - Handle to the BDX
- Returns:
Current file operation status.
-
rs_ret_val_t rs_bdx_close(rs_handle_t handle)
Function to free the BDX handle.
This function used to free the BDX handle
- Parameters:
handle – [in] - Handle of the BDX instance information
- Returns:
Return 0 on success or error code on failure
-
uint8_t *rcb_bdx_get_file_data(rs_handle_t handle, uint32_t *ptr_len)
Retrieves the data of a file in the BDX transfer.
This function retrieves metadata or information about a file based on its index in the BDX communication.
- Parameters:
handle – [in] - Handle to the BDX
ptr_len – [in] - pointer to a variable where the length of the file data will be stored.
- Returns:
Data pointer on success or NULL on failure
-
rs_ret_val_t rcb_bdx_transmit_data(rs_handle_t handle, uint32_t u32_len)
Transmits data during the BDX transfer process.
This function handles the transmission of data in the BDX communication protocol.
- Parameters:
handle – [in] - Handle to the BDX
u32_len – [in] - The length of the data to be transmitted in bytes.
- Returns:
0 on success and error on failure
-
rs_ret_val_t rcb_bdx_is_tx_ongoing(rs_handle_t handle)
Checks if a file transfer operation is ongoing.
This function determines whether a transmission is currently active by checking the file index. If the file index corresponds to
RS_BDX_FILE_STORED_DATA, it validates the transfer status.- Parameters:
handle – [in] - Handle to the BDX
- Returns:
Returns RS_ERR_BUSY if a transfer is ongoing, otherwise RS_ERR_OK.
-
rs_ret_val_t rcb_bdx_check_comm_connection(rs_bdx_instance_t *ptr_bdx_instance)
Check Communication interface state.
This function check Communication interface state if state is error it clear all process and ready to process after connection.
- Parameters:
ptr_bdx_instance – [in] - pointer to the bdx instance
- Returns:
Returns RS_ERR_OK if a interface connection is good, otherwise RS_ERR.
-
rs_ret_val_t rcb_bdx_get_async_req_resp(rs_handle_t handle)
Handles and retrieves the response for pending asynchronous requests.
This function checks the pending request in the BDX control structure and processes it accordingly. It handles requests such as file upload, download, firmware update, and RTC time set operations.
- Parameters:
handle – [in] - Handle to the BDX
- Returns:
Returns appropriate status codes depending on the operation result.
-
int32_t rcb_bdx_get_file_info(rs_handle_t handle, uint16_t u16_file_type)
Retrieves information about the specified file type.
This function provides details such as file size based on the given file type..
- Parameters:
handle – [in] - Handle to the BDX
u16_file_type – [in] - The type of file to retrieve information for.
- Returns:
Returns the file size as a 32-bit unsigned integer.
-
rs_ret_val_t rcb_bdx_start_download_file(rs_handle_t handle, uint16_t u16_file_type, uint32_t u32_download_size)
-
rs_ret_val_t rcb_bdx_download_data(rs_handle_t handle, uint16_t u16_file_type, uint8_t *ptr_data, uint16_t u16_data_size)
Handles data transfer during the download process.
This function processes and updates the data buffer for the specified file type during a download operation. Currently, it supports transferring device configuration data.
- Parameters:
handle – [in] - Handle to the BDX
u16_file_type – [in] - The type of file being downloaded.
ptr_data – [in] - A pointer to the data buffer.
u16_data_size – [in] - The size of the data buffer.
- Returns:
Returns RS_TRUE upon successful data transfer, RS_ERR_FILE_NOT_EXIST if the file type is invalid, or RS_ERR_RESP_NOT_READY for incomplete operations.
-
rs_ret_val_t rcb_bdx_file_download_complete(rs_handle_t handle, uint16_t u16_file_type)
Marks the completion of the file download process.
This function performs cleanup and updates flags to indicate the completion of the download process for a specific file type.
- Parameters:
handle – [in] - Handle to the BDX.
u16_file_type – [in] - The type of file whose download has completed.
- Returns:
Returns RS_ERR_RESP_NOT_READY for pending operations or RS_ERR_FILE_NOT_EXIST if the file type is invalid.
-
rs_ret_val_t rcb_bdx_firmware_download_trigger(rs_handle_t handle, uint8_t *ptr_data, uint16_t u16_data_size)
-
rs_ret_val_t rcb_bdx_firmware_update(rs_handle_t handle, uint16_t u16_file_type)
Processes firmware update requests.
This function handles data transfer during firmware updates by updating the appropriate buffer. It prepares the firmware for installation.
- Parameters:
handle – [in] - Handle to the BDX.
u16_file_type – [in] - The type of file whose download has completed.
- Returns:
Returns RS_ERR_RESP_NOT_READY for pending operations.
-
rs_ret_val_t rcb_bdx_rtc_time_set(rs_handle_t handle, uint8_t *ptr_data, uint16_t u16_data_size)
Sets the RTC time.
This function updates the RTC configuration based on the data buffer provided. It ensures the RTC time is correctly synchronized.
- Parameters:
handle – [in] - Handle to the BDX.
ptr_data – [in] - A pointer to the RTC configuration data buffer.
u16_data_size – [in] - The size of the RTC configuration data buffer.
- Returns:
Returns RS_ERR_RESP_NOT_READY for pending operations.
-
uint8_t *rcb_bdx_get_debug_info(rs_handle_t handle, uint16_t u16_debug_info_type, uint32_t *ptr_len)
Get the device debug information.
This function performs to get the debug information for a specific debug type.
- Parameters:
handle – [in] - Handle to the BDX.
u16_debug_info_type – [in] - Debug info type which request from the device.
ptr_len – [in] - pointer to a variable where the length of the debug data will be stored.
- Returns:
Data pointer on success or NULL on failure
-
uint8_t *rcb_bdx_get_rtc_time(rs_handle_t handle, uint32_t *ptr_len)
-
rs_ret_val_t rcb_bdx_file_delete(rs_handle_t handle, uint16_t u16_delete_type)
Delete the file data.
This function performs to delet the file for a specific file type.
- Parameters:
handle – [in] - Handle to the BDX.
u16_delete_type – [in] - Specify the file type to delete.
- Returns:
Returns RS_ERR_RESP_NOT_READY for pending operations or RS_ERR_FILE_NOT_EXIST if the file type is invalid.
-
rs_ret_val_t rcb_bdx_get_dev_name_version(rs_handle_t handle, uint8_t *ptr_des_dev_name, uint8_t *ptr_des_hw_version, uint8_t *ptr_des_sw_version)
-
rs_ret_val_t rcb_bdx_receive_async_data(rs_handle_t handle, uint8_t *ptr_data, uint16_t u16_file_type, uint16_t u16_data_size)
Receives asynchronous data from the BDX device.
This function receives asynchronous data for a specific file type from the BDX interface.
- Parameters:
handle – [in] - Handle to the BDX.
ptr_data – [in] - Pointer to the buffer to store received data.
u16_file_type – [in] - File type identifier.
u16_data_size – [in] - Expected data size to receive.
- Returns:
Returns 0 on success, -1 for failure.
-
rs_ret_val_t rcb_bdx_receive_async_data_ch0(rs_handle_t handle, uint8_t *ptr_data, uint16_t u16_file_type, uint16_t u16_data_size)
-
uint8_t *rcb_bdx_get_async_data(rs_handle_t handle, uint32_t *ptr_len)
Gets the pointer to the latest asynchronous data.
This function returns a pointer to the asynchronous data received and its length.
- Parameters:
handle – [in] - Handle to the BDX.
ptr_len – [out] - Pointer to variable where the data length will be stored.
- Returns:
Pointer to the asynchronous data buffer. NULL on failure.
-
rs_ret_val_t rcb_bdx_receive_can_baudrate(rs_handle_t handle, uint16_t u16_channel, uint32_t u32_baudrate)
-
rs_ret_val_t rcb_bdx_receive_can_bit_timing(rs_handle_t handle, uint16_t u16_channel, uint16_t u16_can_clk_div, uint16_t u16_can_prescale, uint16_t u16_can_tseg1, uint16_t u16_can_tseg2, uint32_t u32_baudrate)
-
rs_ret_val_t rcb_bdx_receive_can_add_filter(rs_handle_t handle, uint16_t u16_channel, uint32_t u32_id, uint32_t u32_mask)
Adds a CAN filter to the specified channel.
This function sends a command to add a CAN ID and mask filter to the channel’s filter list.
- Parameters:
handle – [in] - Handle to the BDX.
u16_channel – [in] - CAN channel number.
u32_id – [in] - CAN identifier to filter.
u32_mask – [in] - CAN mask for filtering.
- Returns:
Returns 0 on success, -1 for failure.
-
rs_ret_val_t rcb_bdx_receive_can_start(rs_handle_t handle, uint16_t u16_channel)
Starts the CAN communication.
This function initiates CAN communication on the specified channel.
- Parameters:
handle – [in] - Handle to the BDX.
u16_channel – [in] - CAN channel to start.
- Returns:
Returns 0 on success, -1 for failure.
-
rs_ret_val_t rcb_bdx_receive_can_stop(rs_handle_t handle, uint16_t u16_channel)
Stops the CAN communication.
This function stops ongoing CAN communication on the specified channel.
- Parameters:
handle – [in] - Handle to the BDX.
u16_channel – [in] - CAN channel to stop.
- Returns:
Returns 0 on success, -1 for failure.
-
uint8_t *rcb_bdx_get_uuid(rs_handle_t handle, uint32_t *ptr_len)
Gets the device UUID token.
This function gets the UUD info of the device.
- Parameters:
handle – [in] - Handle to the BDX.
ptr_len – [in] - Pointer to variable where the data length will be stored.
- Returns:
Data pointer on success or NULL on failure
-
rs_ret_val_t rcb_bdx_receive_can_mode(rs_handle_t handle, uint16_t u16_channel, uint8_t u8_can_mode, uint32_t u32_data_baudrate)
Set CAN mode (e.i Classic or FD).
This function set CAN mode.
- Parameters:
handle – [in] - Handle to the BDX.
u16_channel – [in] - CAN channel to set CAN mode.
u8_can_mode – [in] - CAN mode CAN_FD or CAN_CALSSIC.
u32_data_baudrate – [in] - Data baudrate if set CAN mode as FD .
- Returns:
Returns 0 on success, -1 for failure.
-
struct tag_rs_bdx_frame
- #include <rs_bdx.h>
Structure to represent BDX frame.
-
struct tag_rs_bdx_status_resp_frame
- #include <rs_bdx.h>
Structure to represent BDX status response frame.
-
struct tag_rs_bdx_status_resp_frame_with_data
- #include <rs_bdx.h>
Structure to represent BDX status response frame.
-
struct tag_rs_bdx_dev_info_resp_frame
- #include <rs_bdx.h>
Structure to represent BDX status response frame.
Public Members
-
uint8_t header
Command header.
-
uint8_t cmd
Command identifier.
-
uint16_t sub_index
Size of the message data.
-
uint16_t data_size
Size of the message data.
-
uint8_t dev_name[RS_BDX_MAX_LEN_DEVICE_NAME]
Start of Frame data.
-
uint8_t hw_version[RS_BDX_MAX_LEN_VERSION]
Start of Frame data.
-
uint8_t sw_version[RS_BDX_MAX_LEN_VERSION]
Start of Frame data.
-
struct tag_rs_bdx_dev_info_resp_frame name_version
-
union tag_rs_bdx_dev_info_resp_frame info
Footer for the response frame.
-
uint8_t crc
CRC checksum.
-
uint8_t header
-
struct tag_rs_bdx_config
- #include <rs_bdx.h>
Structure to represent BDX configuration.
-
struct tag_rs_bdx_instance
- #include <rs_bdx.h>
Structure to represent BDX instance information.
Public Members
-
rs_bdx_config_t *ptr_config
Pointer to bdx configuratin.
-
uint8_t pending_req
Asynchronous request being processed.
-
uint8_t file_op
0 - No file operation, 1 - Upload, 2 - Download
-
uint16_t file_index
File index.
-
uint32_t file_read_index
Index for file reading.
-
uint32_t file_request_size
Requested file size.
-
int32_t file_size
Total file size.
-
uint8_t *ptr_tx_buf
Pointer to the transmit buffer.
-
uint32_t tx_buf_size
Size of the transmit buffer.
-
uint32_t start_time
Start time of the file operation.
-
rs_bdx_config_t *ptr_config