PETRONE_V2 / Protocol / Intro
Modified : 2018.2.13
1. Introduce PETRONE V2
PETRONE V2 is Changed communication module from PETRONE and include controller.
2. Data transfer structure.
PETRONE V2 uses serial communication with external devices, In most cases, the controller and the PC are connected while communicating. The sending and receiving data are structured as follows :
0 |
1 |
2 |
3 |
4 |
5 |
... |
N-1 |
N |
Start code |
Header |
Data |
CRC16 |
|||||
DataType |
Length |
From |
To |
|||||
0x0A |
0x55 |
- |
- |
- |
- |
- |
- |
- |
Each item is explained as follows.
Area |
Description |
|
Start code |
Start data transmission |
|
Header |
DataType |
Data yype |
Length |
Data length |
|
From |
Data transfer device's DeviceType |
|
To |
Data receive device's DeviceType |
|
Data |
Send data |
|
CRC16 |
Check whether the header and the data were delivered correctly http://www.menie.org/georges/embedded/crc16.html |
Data and the CRA16 zone use Little Endian. When Little Endian is present, If more than two bytes, low byte is front of the array. You can change it conveniently using Bitconverter in C#.
HEX value |
0x1234 |
|
Array index |
0 |
1 |
Big Endian |
12 |
34 |
Little Endian |
34 |
12 |
HEX value |
0x12345678 |
|||
Array index |
0 |
1 |
2 |
3 |
Big Endian |
12 |
34 |
56 |
78 |
Little Endian |
78 |
56 |
34 |
12 |
3. Precautions in use
-
All devices only send data in response when requested.
-
If a device is specified to receive data, the device will send Ack when it is not requested.
-
If the data is transmitted via broadcast, If a command is not a data request but a typical one, the device that can process it runs the received command.
-
If the data is transmitted via broadcast a data requests, the device can be respond data. If more than one device responds to the same data, this can cause conflicts between sending and receiving data. Be careful when you use it.
-
Ack is not answered for the broadcast.
4. 시리얼 통신 설정
Area | Setting value |
---|---|
Baud Rate | 115200 |
Parity | None |
Data Bits | 8 |
Stop Bits | 1 |
5. Driver install
- PETRONE V2 controller is automatically recognized in Windows 10. Do not need additional driver.
- If the device is not recognized, you need to install device driver.