Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
usp:usp_spec [2012/10/18 18:18] – [USP configuration file] mnovakusp:usp_spec [2015/04/16 16:27] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== USP serial protocol ====== ====== USP serial protocol ======
  
-USP is a serial communication protocol. The protocol is register based with 4 basic commands. Each protocol message contains Command ID, 2 levels of 8 bit addressing, data and checksum. Response message additionaly contains status byte.+USP is a serial communication protocol. The protocol is register based with 4 basic commands. Each protocol message contains Command ID, 1 or bytes of ModuleID used for device addressing, data and checksum. Response message additionaly contains status byte.
  
-The protocol is designed for communication between one master and multiple slaves. Typically the host (master) communicates with a device(slave) over serial connection. The connection can be wired: RS232, RS485, Ethernet or wireless: Zig-Bee, 802.11(Wi-Fi) etc.+The protocol is designed for communication between one master and multiple slaves. Typically the PC host (master) communicates with a device(slave) over serial connection. The connection can be wired: RS232, RS485, Ethernet or wireless: Zig-Bee, 802.11(Wi-Fi) etc. 
 + 
 +===== Terminology ===== 
 + 
 +  * Master - the device issuing commands. Master is running USP client software. Master is identified by ModuleID = 0.  
 +  * Slave - the device listening for USP commands. Slave is running USP server software.  
  
 ===== Default RS232 and RS485 interface Communication Parameters ===== ===== Default RS232 and RS485 interface Communication Parameters =====
Line 18: Line 23:
 ===== Generic Command format ===== ===== Generic Command format =====
 All commands are referenced from the Master to the Slave where the Master is the host PC or an embedded controlling program, which issues the commands to the slave - PIC microcontroller based module which carries out the command. The format of the commands is described below. All commands are referenced from the Master to the Slave where the Master is the host PC or an embedded controlling program, which issues the commands to the slave - PIC microcontroller based module which carries out the command. The format of the commands is described below.
 +
 ==== Master -> Slave Command Format ==== ==== Master -> Slave Command Format ====
  
 ^      bit 31-24  ^  bit 23-16  ^  bit 15-8  ^  bit 7-0  ^ ^      bit 31-24  ^  bit 23-16  ^  bit 15-8  ^  bit 7-0  ^
-^ Command Word 1 (required)  |  Command ID  |  Slave module ID-Hi  |  Slave module ID-Lo  |  Command Length in 32 Bit Words  |+^ Command Word 1 (required)  |  Command ID  |  ModuleID-Hi  |  ModuleID-Lo  |  Command Length in 32 Bit Words  |
 ^ Command Word 2 (Optional)  |  Data 1-3  |  Data 1-2  |  Data 1-1  |  Data 1-0  | ^ Command Word 2 (Optional)  |  Data 1-3  |  Data 1-2  |  Data 1-1  |  Data 1-0  |
 ^ Command Word 3 (Optional)  |  Data 2-3  |  Data 2-2  |  Data 2-1  |  Data 2-0  | ^ Command Word 3 (Optional)  |  Data 2-3  |  Data 2-2  |  Data 2-1  |  Data 2-0  |
Line 27: Line 33:
 ^ Checksum Word (required)  |  Data  |  Data  |  Data  |  Checksum  | ^ Checksum Word (required)  |  Data  |  Data  |  Data  |  Checksum  |
  
-  *A command consists of two or more 32-bit words. The first 32-bit word is divided into 4 fields. The highest 8 bits (bits 31-24) identify the command. The next 16 bits (bits 23-8) is the Unit ID or Address. The next 8 bits specify the number of 32 bit words in the command including the first and last word. +  *A command consists of two or more 32-bit words. The first 32-bit word is divided into 4 fields. The highest 8 bits (bits 31-24) identify the command. The next 16 bits (bits 23-8) is the ModuleID-Hi and ModuleID-Lo. The next 8 bits specify the number of 32 bit words in the command including the first and last word. 
   *The command word is followed by optional 1 – N data words. The interpretation of data depends on command.   *The command word is followed by optional 1 – N data words. The interpretation of data depends on command.
   *The last word contains 3 bytes of data (bits 21-16) and simple additive checksum (bits 7-0).   *The last word contains 3 bytes of data (bits 21-16) and simple additive checksum (bits 7-0).
Line 36: Line 42:
  
 ^      bit 31-24  ^  bit 23-16  ^  bit 15-8  ^  bit 7-0  ^ ^      bit 31-24  ^  bit 23-16  ^  bit 15-8  ^  bit 7-0  ^
-^ Response Word 1 (required)  |  Command ID + 0x80 |  Slave module ID-Hi  |  Slave module ID-Lo  |  Response Length in 32 Bit Words  |+^ Response Word 1 (required)  |  Command ID + 0x80 |  ModuleID-Hi  |  ModuleID-Lo  |  Response Length in 32 Bit Words  |
 ^ Response Word 2 (Optional)  |  Data 1-3  |  Data 1-2  |  Data 1-1  |  Data 1-0  | ^ Response Word 2 (Optional)  |  Data 1-3  |  Data 1-2  |  Data 1-1  |  Data 1-0  |
 ^ Response Word 3 (Optional)  |  Data 2-3  |  Data 2-2  |  Data 2-1  |  Data 2-0  | ^ Response Word 3 (Optional)  |  Data 2-3  |  Data 2-2  |  Data 2-1  |  Data 2-0  |
Line 57: Line 63:
 ===== Addressing ===== ===== Addressing =====
  
-Addess of the slave is carried in each packet in fields Slave module ID-Hi and Slave module ID-Lo. +Addess of the slave is carried in each packet in fields ModuleID-Hi and ModuleID-Lo. 
 The use of addreses is application dependent but should adhere to the following rules: The use of addreses is application dependent but should adhere to the following rules:
   *Address 0 is the address of the device directly attached to the master   *Address 0 is the address of the device directly attached to the master
   *Address 255 is the broadcast address, all devices will execute the command   *Address 255 is the broadcast address, all devices will execute the command
-  *In multi-layer network the Slave module ID-Hi is the layer closer to the master+  *In multi-layer network such as combined wireless and wired network the ModuleID-Hi is the layer closer to the master
  
 ===== Timeouts ===== ===== Timeouts =====
Line 308: Line 314:
  
 When the slave device needs to signal that it has a status change it may send break signal to the master device. The signal is one 32 bit word, it comprises break character command ID (0x55) and USP Slave module ID. When the slave device needs to signal that it has a status change it may send break signal to the master device. The signal is one 32 bit word, it comprises break character command ID (0x55) and USP Slave module ID.
-Master will recoginze break by checking that CommandID == 0x55 and the Lenght == 1+Master will recoginze break by checking that CommandID == 0x55 and the Length == 1
  
 **Command** **Command**
Line 362: Line 368:
  
 <code> <code>
-Command DeviceID  Parameters  ;Comment+Command ModuleID  Parameters  ;Comment
  
 </code> </code>
Line 368: Line 374:
 List of commands: List of commands:
 ^ Config name ^ Parameters  ^ Description | ^ Config name ^ Parameters  ^ Description |
-|  SR  | DeviceID RegisterAddress Value Mask | SetRegister | +|  SR  | ModuleID RegisterAddress Value Mask | SetRegister | 
-|  GR  | DeviceID RegisterAddress | GetRegister +|  GR  | ModuleID RegisterAddress | GetRegister 
-|  SB  | DeviceID RegisterAddress (NumberOfWords Words ... OR "text" ) | SetBlock +|  SB  | ModuleID RegisterAddress (NumberOfWords Words ... OR "text" ) | SetBlock 
-|  GB  | DeviceID RegisterAddress NumberOfWords | GetBlock  |+|  GB  | ModuleID RegisterAddress NumberOfWords | GetBlock  |
 |  DELAY  | Value((ms))  | Stop execution and wait Value miliseconds. |  |  DELAY  | Value((ms))  | Stop execution and wait Value miliseconds. | 
  
usp/usp_spec.txt · Last modified: 2015/04/16 16:27 by 127.0.0.1
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0