Skip to content

Instantly share code, notes, and snippets.

@ellisgl
Last active May 14, 2023 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ellisgl/9079b71c16cfe4ea7c9692d437566c10 to your computer and use it in GitHub Desktop.
Save ellisgl/9079b71c16cfe4ea7c9692d437566c10 to your computer and use it in GitHub Desktop.
[DRAFT] Request For Comments: Universal Serial Device Communication Protocol (USDCP)

# RFC: Universal Serial Device Communication Protocol (USDCP)

## Introduction: This document describes the Universal Serial Device Communication Protocol (USDCP), a standard communication protocol for serial devices. The purpose of this protocol is to provide a standardized format for requesting and receiving data from serial devices. The protocol defines the structure of request and response packets, and also provides specific definitions for certain requests and their responses.

USDCP supports three baud rates: 115,200, 9600, and 1200, with 115,200 being the default.

## Packet/Frame Structures: USDCP request and response packets consist of the following fields:

Request Packet (9 to 264 bytes): - Start: 2 bytes (0x07 0x07) - Address: 1 byte (0x00 for Host, 0x01 - 0xFD for Devices, 0xFE for Broadcast, 0xFF Needs address) - Request Type: 1 byte - Argument: 1 byte - Data Length (bytes): 1 byte - Data: 1 to 256 bytes - End: 2 bytes (0x17 0x04)

Response Packet (7 to 262 bytes): - Start: 2 bytes (0x06 0x06) - Address: 1 byte - Data Length (bytes): 1 byte - Data: 1 to 256 bytes - End: 2 bytes (0x17 0x16)

## Example Request/Response: The following examples illustrate the use of USDCP for device enquiry and setting data:

- Enquiry Device Info 0x05 (Address: 8 bit, Vendor/Peron Id: 32 bit, Product Id: 32 bit, Serial: 32 bit, Version: 24 bit) - Request: 07 07 01 05 00 01 00 17 04 Start: 0x07 0x07 Address: 0x01 Request Type: 0x05 Argument: 0x00 Data Length: 0x01 Data: 0x00 End: 0x17 0x04 ~~- Response: 06 06 00 ~~ 01 02 02 02 02 03 03 03 03 04 04 04 04 05 05 05 17 04 Start: 0x06 0x06 Address: 0x00 Data Length: 0x10 Data: 0x01 0x02 0x02 0x02 0x02 0x03 0x03 0x03 0x03 0x04 0x04 0x04 0x04 0x05 0x05 0x05 End: 0x17 0x04 - Set Data 0x1A ~~- Request: 07 07 01 1A 01 06 48 6F 77 64 79 21 17 04 ~~ Start: 0x07 0x07 Address: 0x01 Request Type: 0x1A Argument: 0x01 (Vendor / Product defined - Let's say this is to set the greeting settings) Data Length: 0x06 Data: 0x48 0x6F 0x77 0x64 0x79 0x21 (Vendor / Procuct defined) End: 0x17 0x04 - Response (Set Successful): 06 06 00 01 06 17 04 Start: 0x06 0x06 Address: 0x00 Data Length: 0x01 Data: 0x06 End: 0x17 0x04 - Response (Set Failed): 06 06 00 01 15 17 04 Start: 0x06 0x06 Address: 0x00 Data Length: 0x01 Data: 0x15 End: 0x17 0x04 ## Security Considerations: USDCP does not provide any inherent security

## Todo: - Addressing: Is doing it this way okay? If so, need to write up the address request stuff. Or should we use an address mode bit (or byte?) to determine if we need an address, and what kind of addressing scheme should used. Could have the addresss follow some sort of uniuqe schema, such as VID+PID+Serial. - Vendor/Person and Product Id registartion. $5000 fee is outrageous, maybe have a git repo host it?

@ellisgl
Copy link
Author

ellisgl commented May 7, 2023

I found something we can look at for more inspiration: https://github.com/min-protocol/min

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment