VSM004 BLE Communication Packet Command

VSM004 Data Flow

VSM004 is an USB serial port device. It helps to simplify the complicated BLE protocol to several serial port commands

  •  scan
  •  connect
  •  disconnect
  •  BLE command write and data receive

Here is a simple communiucation protocol chart to make you understand the command and data flow.

VS-ECG will send serial com port command to VSM004 and VSM004 will help to translate the simple serial com commands to complicated BLE protocols and send the request data to VSH101.

After the VSH101 finished the request and the data will be sent back via BLE to VS Dongle.

VSM004 Com Port Setting

In this case the connect to computer first, connect the BLE Dongle to the computer via USB. When viewed through the device administrator, the computer will have an additional ComPort (as shown in the figure below), which is the COM used by the computer. 

Example :

    Com port Setting 921600 8N1 – 921600 baud, 8 data bits, no parity, and 1 stop bit.

 

VSM004 BLE Communication Flow

The PC can communicate with the VSH101 device via the following instructions from VSM004

  •  BLE scan
  •  BLE connect
  •  BLE connect status 
  •  BLE disconnect
  •  BLE command write and data receive

PC begins communication with BLE via VSM004 connection

When VSM004 BLE is connected, BLE communication packet can be used to communicate。

VSM004 Packet Format:

PC send to VSM004 Packet Command format

Transmit Packet Format:

Transmit VSH101 BLE Packet Format: 

                           UPCode                : Transmit and receive the packet command is same value, set same the ‘Cmd’ data.

                           UGroup                 : The Group Command byte.

                           UCmd.                   : The Group sub Command byte.

                           UChkSum              : The (Check Sum) is the sum of bytes % 256 of the entire packet.

                           UMISO                   : Setting the notify receive length.(Little Endian)

                           UMOSI                   : Setting the write command data length.(Little Endian)

                           UParameter Data : The parameter setting.(Little Endian)

                          UCmd Data            : The data for command.(Little Endian)

Check Sum Data Get Example Code:

Create Transmit VSH101 Packet Data Flow :

1.Create [VSM004 -> VSH101] packet data : “BLE Command Data”

2.Calculate checksum of “BLE Command Data” packet : CheckSum

3.Insert the CheckSum to ”ChkSum” field of “BLE Command Data” packet

4.Create [PC -> VSM004] packet data : “UART Command Data”

5.Inset “BLE Command Data” to ”UCmdData” field of “UART Command Data” packet

6.Calculate checksum of “UART Command Data” packet : CheckSum

7.Insert the CheckSum to ”UChkSum” field of “UART Command Data” packet

PC receive form VSM004 Pcket Command format:

Receive Packet Format:

Receive VSH101 BLE Packet Format:

                             UPCode.       :  Received is the same as that transmitted.

                             UGroup         : The group same the write command.

                             UAck             : Confirm that the ‘Ack’ byte is ‘A’, then the command is correct this time and reply, otherwise will receive ‘N’.

                             UChkSum     : (check sum) is the sum of bytes % 256 of the entire packet.

                             UIndex          : The receive data memory index.(Little Endian)

                             ULength        : The packet data length.(Little Endian)

                             UCmd Data  : The data for command.(Little Endian)

VSM004 Packet Command Table

NamePCodeGroupCmdDescription
Dongle FW Version0x000xC00x00 VSM004 FW Version & module name
BLE Scan List Table0x100xC20x10get BLE scan table
BLE Connect Device0x200xC20x20Set BLE connect device
BLE Disconnect Device0x2F0xC20x2FSet BLE Disconnect device
BLE Connect Status0x660xC20x66Get BLE Connect status 1 : BLE connected 0: BLE disconnected
BLE Communication Packet0x610xC20x61BLE Communication packet command

1. Dongle FW Version Packet Command

Name

Hex Data

UPCode   

0x00

UGroup Id

0xC0

UCmd    

0x00

UCheck sum

0xE0

UMOSI   

0x0000

UMISO   

0x0020

UParameter Data

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

UCmd Data

 

2. BLE Scan List Table Packet Command

Name

Hex Data

UPCode   

0x10

UGroup Id

0xC2

UCmd    

0x10

UCheck sum

0xE6

UMOSI   

0x0000

UMISO   

0x0400

UParameter Data

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

UCmd Data

 

3. BLE Connect Device Packet Command

Name

Hex Data

UPCode   

0x20

UGroup Id

0xC2

UCmd    

0x20

UCheck sum

0xA3

UMOSI   

0x0006

UMISO   

0x0000

UParameter Data

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

UCmd Data

 47 4E DA 9F FD 90

4. BLE Connect Status Packet Command

Name

Hex Data

UPCode   

0x66

UGroup Id

0xC2

UCmd    

0x66

UCheck sum

0x95

UMOSI   

0x0000

UMISO   

0x0007

UParameter Data

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

UCmd Data

 

5. BLE Disconnect Packet Command

Name

Hex Data

UPCode   

0x2F

UGroup Id

0xC2

UCmd    

0x2F

UCheck sum

0x20

UMOSI   

0x0000

UMISO   

0x0000

UParameter Data

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

UCmd Data

 

6. BLE Communication Packet Command

Name

Hex Data

UPCode   

0x61

UGroup Id

0xC2

UCmd    

0x61

UCheck sum

0x84

UMOSI   

0x0018

UMISO   

0x0028

UParameter Data

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

UCmd Data

00 C0 00 E0 00 00 20 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00

7. Com port BLE Communication Packet (VSC Mode Type 1 Flow)

7.1 BLE Disconnect
 Com port Out Data count = 24
  0000 ~ 000F : 2F C2 2F 20 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – xx xx xx xx xx xx xx xx 
 
 Com port In Data count = 8
  0000 ~ 000F : 2F C2 41 32 00 00 00 00 – xx xx xx xx xx xx xx xx 
7.2 BLE Scan List Table
 Com port Out Data count = 24
  0000 ~ 000F : 10 C2 10 F4 00 00 0F 03 – 00 00 00 00 00 00 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – xx xx xx xx xx xx xx xx 
 
 Com port In Data count = 791
  0000 ~ 000F : 10 C2 41 90 00 00 0F 03 – 11 00 00 00 1F 00 00 00 
  0010 ~ 001F : 8F B9 90 CC CC CC F2 56 – 53 47 31 30 31 5F 30 31 
  0020 ~ 002F : 5F 33 30 32 30 30 30 32 – 00 00 00 00 00 00 00 F1 
  0030 ~ 003F : B9 90 CC CC CC D2 56 53 – 48 31 30 31 5F 30 34 33 
  0040 ~ 004F : 5F 32 32 30 39 30 30 30 – 32 38 00 00 00 00 2E 4B 
  0050 ~ 005F : 26 14 2E 84 C4 56 53 54 – 31 30 33 5F 30 5F 30 30 
  0060 ~ 006F : 30 30 32 36 00 00 00 00 – 00 00 00 00 00 B0 4A 26  
                                                               …
  02F0 ~ 02FF : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0300 ~ 030F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0310 ~ 031F : 00 00 00 00 00 00 00 xx – xx xx xx xx xx xx xx xx 
7.3 BLE Connect device
 Com port Out Data count = 30
  0000 ~ 000F : 20 C2 20 A6 06 00 00 00 – 00 00 00 00 00 00 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – F1 B9 90 CC CC CC xx xx 
 
 Com port In Data count = 8
  0000 ~ 000F : 20 C2 41 23 00 00 00 00 – xx xx xx xx xx xx xx xx 
7.4 BLE Connect Status
4. BLE Connect Status (interval 200 mSec fetch 1 time then check is connected) 
Com port Out Data count = 24
  0000 ~ 000F : 66 C2 66 95 00 00 07 00 – 00 00 00 00 00 00 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – xx xx xx xx xx xx xx xx 
 
 Com port In Data count = 15
  0000 ~ 000F : 66 C2 41 0E 00 00 07 00 – 00 F1 B9 90 CC CC CC xx 
                                                               …
 
 Com port Out Data count = 24
  0000 ~ 000F : 66 C2 66 95 00 00 07 00 – 00 00 00 00 00 00 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – xx xx xx xx xx xx xx xx 
 
 Com port In Data count = 15
  0000 ~ 000F : 66 C2 41 0F 00 00 07 00 – 01 F1 B9 90 CC CC CC xx 
7.5 BLE Communication Packet (Device Version Get)
 Com port Out Data count = 48
  0000 ~ 000F : 61 C2 61 84 18 00 28 00 – 00 00 00 00 00 00 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – 00 C0 00 E0 00 00 20 00 
  0020 ~ 002F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
 
 Com port In Data count = 48
  0000 ~ 000F : 61 C2 41 8C 00 00 28 00 – 00 C0 41 44 00 00 20 00 
  0010 ~ 001F : DA 00 00 00 56 53 48 31 – 30 31 5F 34 33 00 00 00 
  0020 ~ 002F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
 
7.6 BLE Communication Packet (Device Time Set)
 Com port Out Data count = 64
  0000 ~ 000F : 61 C2 61 D0 28 00 08 00 – 00 00 00 00 00 00 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – 40 C0 40 0E 10 00 00 00 
  0020 ~ 002F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0030 ~ 003F : E7 07 06 01 10 13 05 08 – 79 54 78 64 80 70 00 00 
 
 Com port In Data count = 16
  0000 ~ 000F : 61 C2 41 6C 00 00 08 00 – 40 C0 41 41 00 00 00 00 
7.7 BLE Communication Packet (Device Time Get)
 Com port Out Data count = 48
  0000 ~ 000F : 61 C2 61 58 18 00 18 00 – 00 00 00 00 00 00 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – 41 C0 41 52 00 00 10 00 
  0020 ~ 002F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
 
 Com port In Data count = 32
  0000 ~ 000F : 61 C2 41 7C 00 00 18 00 – 41 C0 41 0A 00 00 10 00 
  0010 ~ 001F : E7 07 06 01 10 13 06 00 – 7A 54 78 64 80 70 00 00 
7.8 BLE Communication Packet (VSC MODE Type 1 Set)
 Com port Out Data count = 52
  0000 ~ 000F : 61 C2 61 F6 1C 00 08 00 – 00 00 00 00 00 00 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – 70 C2 70 A7 04 00 00 00 
  0020 ~ 002F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0030 ~ 003F : 01 00 00 00 xx xx xx xx – xx xx xx xx xx xx xx xx 
 
 Com port In Data count = 16
  0000 ~ 000F : 61 C2 41 6C 00 00 08 00 – 70 C2 41 73 00 00 00 00 
7.9 BLE Communication Packet (VSC MODE Measuemenet Start)
 Com port Out Data count = 48
  0000 ~ 000F : 61 C2 61 B8 18 00 08 00 – 00 00 00 00 00 00 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – 64 C2 64 8A 00 00 00 00 
  0020 ~ 002F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
 
 Com port In Data count = 16
  0000 ~ 000F : 61 C2 41 6C 00 00 08 00 – 64 C2 41 67 00 00 00 00 
7.10 BLE Communication Packet (VSC MODE Read)
VSC Mode Read (interval 100 ~ 200 mSec read 1 time) 
10. VSC Mode Read Index: 0
 Com port Out Data count = 48
  0000 ~ 000F : 61 C2 61 80 18 00 40 02 – 00 00 00 00 00 00 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – 6A C2 6A D1 00 00 38 02 
  0020 ~ 002F : 00 00 00 00 01 00 00 00 – 00 00 00 00 00 00 00 00 
 
 Com port In Data count = 584
  0000 ~ 000F : 61 C2 41 A6 00 00 40 02 – 6A C2 41 03 00 00 38 02 
  0010 ~ 001F : EC 8C AE 3F A0 2D AF 3F – F8 B1 AF 3F F0 81 B0 3F 
  0020 ~ 002F : 48 06 B1 3F 8C 35 B1 3F – FC A6 B1 3F 34 0E B3 3F 
  0030 ~ 003F : 50 F0 B4 3F 20 73 B7 3F – B4 F6 B8 3F C0 1B BA 3F 
                                                                        …
  0220 ~ 022F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0230 ~ 023F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0240 ~ 024F : 00 00 00 00 00 00 00 00 – xx xx xx xx xx xx xx xx 
 
10. VSC Mode Read Index: 1
 Com port Out Data count = 48
  0000 ~ 000F : 61 C2 61 82 18 00 40 02 – 00 00 00 00 00 00 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – 6A C2 6A D2 00 00 38 02 
  0020 ~ 002F : 01 00 00 00 01 00 00 00 – 00 00 00 00 00 00 00 00 
 
 Com port In Data count = 584
  0000 ~ 000F : 61 C2 41 A6 00 00 40 02 – 6A C2 41 2F 01 00 38 02 
  0010 ~ 001F : 94 7C B7 3F 98 14 B7 3F – E8 68 B8 3F 3C 55 B9 3F 
  0020 ~ 002F : 84 1C B9 3F F0 98 B7 3F – 54 E5 B6 3F B0 01 B7 3F 
  0030 ~ 003F : 28 A3 B6 3F 98 14 B7 3F – 7C 8F B7 3F 90 E4 B7 3F 
                                                                        …
  0220 ~ 022F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0230 ~ 023F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0240 ~ 024F : 00 00 00 00 00 00 00 00 – xx xx xx xx xx xx xx xx 
 
10. VSC Mode Read Index: 2
 Com port Out Data count = 48
  0000 ~ 000F : 61 C2 61 84 18 00 40 02 – 00 00 00 00 00 00 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – 6A C2 6A D3 00 00 38 02 
  0020 ~ 002F : 02 00 00 00 01 00 00 00 – 00 00 00 00 00 00 00 00 
 
 Com port In Data count = 584
  0000 ~ 000F : 61 C2 41 A6 00 00 40 02 – 6A C2 41 89 02 00 38 02 
  0010 ~ 001F : 34 E1 8A 3F A8 8D 88 3F – 6C 8E 87 3F F8 84 87 3F 
  0020 ~ 002F : 18 A2 86 3F 50 AC 85 3F – F8 27 85 3F 88 B6 84 3F 
  0030 ~ 003F : 58 7F 82 3F E0 80 80 3F – 18 CC 7C 3F B8 5D 78 3F  
                                                                     
  0220 ~ 022F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0230 ~ 023F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0240 ~ 024F : 00 00 00 00 00 00 00 00 – xx xx xx xx xx xx xx xx 
 
10. VSC Mode Read Index: 3 (Fetch invalid index)
 Com port Out Data count = 48
  0000 ~ 000F : 61 C2 61 86 18 00 40 02 – 00 00 00 00 00 00 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – 6A C2 6A D4 00 00 38 02 
  0020 ~ 002F : 03 00 00 00 01 00 00 00 – 00 00 00 00 00 00 00 00 
 
 Com port In Data count = 584
  0000 ~ 000F : 61 C2 41 6C 00 00 08 00 – 6A C2 41 CC 40 1F 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0020 ~ 002F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0030 ~ 003F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00  
                                                                       
  0220 ~ 022F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0230 ~ 023F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0240 ~ 024F : 00 00 00 00 00 00 00 00 – xx xx xx xx xx xx xx xx 
 
10. VSC Mode Read Index: 3
 Com port Out Data count = 48
  0000 ~ 000F : 61 C2 61 86 18 00 40 02 – 00 00 00 00 00 00 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – 6A C2 6A D4 00 00 38 02 
  0020 ~ 002F : 03 00 00 00 01 00 00 00 – 00 00 00 00 00 00 00 00 
 
 Com port In Data count = 584
  0000 ~ 000F : 61 C2 41 A6 00 00 40 02 – 6A C2 41 C0 03 00 38 02 
  0010 ~ 001F : 80 0D 7E 3F A8 B7 7E 3F – 10 5B 80 3F 50 F2 80 3F 
  0020 ~ 002F : 4C 5A 81 3F E0 DD 82 3F – F0 9A 83 3F 68 99 85 3F 
  0030 ~ 003F : 38 1C 88 3F 58 F3 8B 3F – D8 7E 8F 3F F0 C8 91 3F 
                                                                       
  0220 ~ 022F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0230 ~ 023F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0240 ~ 024F : 00 00 00 00 00 00 00 00 – xx xx xx xx xx xx xx xx 
 
10. VSC Mode Read Index: 4
 Com port Out Data count = 48
  0000 ~ 000F : 61 C2 61 88 18 00 40 02 – 00 00 00 00 00 00 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – 6A C2 6A D5 00 00 38 02 
  0020 ~ 002F : 04 00 00 00 01 00 00 00 – 00 00 00 00 00 00 00 00 
 
 Com port In Data count = 584
  0000 ~ 000F : 61 C2 41 A6 00 00 40 02 – 6A C2 41 94 04 00 38 02 
  0010 ~ 001F : 0C C1 B4 3F 9C 4F B4 3F – 70 0D B4 3F 18 89 B3 3F 
  0020 ~ 002F : 38 A6 B2 3F A0 8A B1 3F – 50 D9 AD 3F 80 56 AB 3F 
  0030 ~ 003F : 64 74 A9 3F 48 92 A7 3F – 18 5B A5 3F D8 C3 A4 3F 
                                                                       
  0220 ~ 022F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0230 ~ 023F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
  0240 ~ 024F : 00 00 00 00 00 00 00 00 – xx xx xx xx xx xx xx xx 
7.11 BLE Communication Packet (VSC MODE Stop)
11. VSC Mode Stop
 Com port Out Data count = 48
  0000 ~ 000F : 61 C2 61 BC 18 00 08 00 – 00 00 00 00 00 00 00 00 
  0010 ~ 001F : 00 00 00 00 00 00 00 00 – 65 C2 65 8C 00 00 00 00 
  0020 ~ 002F : 00 00 00 00 00 00 00 00 – 00 00 00 00 00 00 00 00 
 
 Com port In Data count = 16
  0000 ~ 000F : 61 C2 41 6C 00 00 08 00 – 65 C2 41 68 00 00 00 00 
7.12 BLE Disconnect
   Com port Out Data count = 24
    0000 ~ 000F : 2F C2 2F 20 00 00 00 00 – 00 00 00 00 00 00 00 00 
    0010 ~ 001F : 00 00 00 00 00 00 00 00 – xx xx xx xx xx xx xx xx 
 
   Com port In Data count = 8
    0000 ~ 000F : 2F C2 41 32 00 00 00 00 – xx xx xx xx xx xx xx xx