| 1 |
# Cotre DMR radio |
| 2 |
This is likely the cheapest DMR radio out there for about $45. |
| 3 |
|
| 4 |
The protocol appears to be a weird one: It is actually a stream of requests and responses that do not alternate. That is, the CPS bombards the radio with requests and the radio responses to it some time later. Consequently, it is harder to correlate a response to its request. Although such a protocol is common in networks (e.g., TCP) it is rather uncommon for USB devices as there is virtually no latency between request and response and thus, the bandwidth is not limited by the latency. Is this what happens when a network engineer writes embedded code? |
| 5 |
|
| 6 |
## Packet format |
| 7 |
Requests and responses appear to share the same packet format. Please note, that due to the nature of the chosen transport, a packet may be split over two USB transfer packets. |
| 8 |
|
| 9 |
``` |
| 10 |
0 8 16 24 |
| 11 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |
| 12 |
| Preamble, fixed to 0xad | 16 bit payload length, big endian | Payload, variable size ... |
| 13 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |
| 14 |
... However, only a few bytes are actually transferred here. | Checksum? | |
| 15 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |
| 16 |
``` |
| 17 |
### Checksum |
| 18 |
The checksum appears to be a simple XOR of all payload bytes. |
| 19 |
|
| 20 |
### Example |
| 21 |
The very first request sent to the device when reading is |
| 22 |
``` |
| 23 |
ad 00 07 ff 04 03 00 00 00 01 f9 |
| 24 |
``` |
| 25 |
The would then decode into |
| 26 |
* Preamble `ad` |
| 27 |
* Length `0007` |
| 28 |
* Payload `ff 04 03 00 00 00 01` |
| 29 |
* CRC `f9` = `ff ^ 04 ^ 03 ^ 01` |
| 30 |
|