Difference between revisions of "Das Oszi Protocol"
(→0x02 Read sample data) |
(→0x11 DSO Einstellungen schreiben: translation) |
||
Line 301: | Line 301: | ||
<br/> | <br/> | ||
− | === 0x11 DSO | + | === 0x11 Write DSO settings === |
− | + | To write settings, the data format specified in [[#0x01_Read_DSO_settings|Read DSO settings]] must be used: | |
− | |||
{| style="color:white" border="0" cellpadding="4" | {| style="color:white" border="0" cellpadding="4" | ||
|- | |- | ||
| bgcolor="red" align="center" rowspan="2" | 0x53 | | bgcolor="red" align="center" rowspan="2" | 0x53 | ||
− | | bgcolor="darkyellow" align="center" colspan="2" | | + | | bgcolor="darkyellow" align="center" colspan="2" | Length |
| bgcolor="darkblue" align="center" rowspan="2" | 0x11 | | bgcolor="darkblue" align="center" rowspan="2" | 0x11 | ||
| width="300" bgcolor="blue" align="center" rowspan="2" colspan="2"|SYSData | | width="300" bgcolor="blue" align="center" rowspan="2" colspan="2"|SYSData | ||
− | | bgcolor="green" align="center" rowspan="2" | | + | | bgcolor="green" align="center" rowspan="2" |Checksum |
|- | |- | ||
|bgcolor="darkyellow" align="center" | LSB | |bgcolor="darkyellow" align="center" | LSB | ||
Line 318: | Line 317: | ||
|} | |} | ||
− | + | The response contains a status byte, where 0x00 denotes success and anything else is an error: | |
− | |||
− | |||
− | |||
− | |||
{| style="color:white" border="0" cellpadding="4" | {| style="color:white" border="0" cellpadding="4" | ||
Line 329: | Line 324: | ||
| bgcolor="darkyellow" align="center" | 0x00 | | bgcolor="darkyellow" align="center" | 0x00 | ||
| bgcolor="darkblue" align="center" | 0x91 | | bgcolor="darkblue" align="center" | 0x91 | ||
− | | bgcolor="blue" align="center" | 0x.. | + | | bgcolor="blue" align="center" | 0x.. status |
− | | bgcolor="green" align="center" | | + | | bgcolor="green" align="center" | Checksum |
|} | |} | ||
− | + | <br/> | |
=== 0x12 DSO Start/Stop - Bedienfeld sperren/freischalten === | === 0x12 DSO Start/Stop - Bedienfeld sperren/freischalten === |
Revision as of 05:47, 31 March 2012
The Hantek DSO5xxxB series oscilloscopes, rebadged under various other names, have a USB interface intended for communicating with software running on a PC. A proprietary protocol is used by the Hantek Windows software. This page documents that protocol.
This is needed because Hantek has been promising a Windows SDK for years, but has delivered only the Windows software TTScope, which is a joke. For Linux, expect nothing at all from Hantek. Even though the device itself runs Linux, a Linux SDK has also not been made available.
Contents
- 1 Credits
- 2 Introduction
- 3 Basic Structure
- 4 0x53 normal messages
- 5 0x43 Debugging Meldungen
- 5.1 0x00 FPGA Register lesen
- 5.2 0x01 FPGA FIFO Inhalt auslesen
- 5.3 0x02 Read DSO firmware variables
- 5.4 0x03 DSO Selbstkalibrierung auslesen
- 5.5 0x10 Datei lesen
- 5.6 0x11 Virtual remote shell
- 5.7 0x40 DSO Firmware Variablen schreiben
- 5.8 0x41 DSO Selbstkalibrierung schreiben
- 5.9 0x42 FPGA Register beschreiben
- 5.10 0x43 Keycode senden
- 5.11 0x44 DSO Buzzer
- 5.12 0x45 Interpolation anpassungen
- 5.13 0x50 Datei senden
- 5.14 0x60 Datei updaten
- 5.15 0x7F Init DSO
- 6 References
Credits
- The initial import of this documentation comes from the work "tinhead" has done over on the www.mikrocontroller.net pages.
Introduction
The USB protocol and implementation are pretty bad. DSOs are identifiable only by the USB VID:PID 049f:505a [1] and the bus and device address. When operating several DSO5xxxBs on a PC they cannot be distinguished by their serial number as Hantek sets the iSerial field in the USB descriptor to 0.
The CPU is the MIZI Research/Samsung S3C2410 SMDK. It contains the USB char driver (usb-char.c, Linux 2.4.18), and which uses the VID:PID 049f:505a. Although the DSO is based on a newer kernel (2.6.13), this driver was taken from the previous model Tekway DST1000 (not B!).
Apparently the DSO5xxxBM/BMV models, running Linux 2.6.30.4, use the "serial gadget" driver. Whether this is an improvement is currently not known.
Another effect of this driver is that the DSO briefly shows up at boot with another VID:PID on the USB bus. The bootloader (vivi) uses a SoC monitor, such as the Samsung S3C2440 SMDK (u2440mon), which when booting reports its own VID:PID on the USB port. While this may be very useful for hacking, backup or similar, changing the VID:PID causes BSODs on Win64 PCs.
The protocol uses USB bulk transfers (outbound endpoint 1, inbound endpoint 2) with a maximum packet size of 64 bytes. DSO protocol messages longer than 64 bytes are split up over several bulk packets.
Hantek's DSO protocol is layered directly on top of the USB bulk transfers. It is request/response oriented, meaning the USB host sends a request and receives a list of answers. The protocol can therefore be used in a single-threaded application using synchronous USB communication, even though Hantek's TTScope application uses separate transmit and receive threads.
Basic Structure
Marker 0x43 or 0x53 |
Length | Command | Data bytes | Checksum | ||
LSB | MSB | |||||
Marker 0x43 or 0x53 |
Length | Command | Subcommand | Data bytes | Checksum | |
LSB | MSB | |||||
Marker 0x43 or 0x53 |
Length | Command | Checksum | |||
LSB | MSB |
The message format is the same for requests and responses. Each message begins with a marker byte. There are two different markers:
- 0x53: normal message
- 0x43: debug message
This is followed by two bytes indicating the length of the message, LSB first, excluding the marker and length fields.
The word length is followed by the command byte. The reply to this command will have bit 7 set in the command byte. Therefore command bytes from PC to device are always smaller than 0x80, and the responses are always greater than or equal to 0x80.
The command byte is followed by command-specific data bytes. Some commands use the first data byte as a sub-command. The number of data bytes can be zero.
The data byte is followed by a primitive checksum byte. It is about the dumbest way to calculate a checksum: all the bytes of the message are added up, and the LSB of the sum is used as the checksum.
0x53 normal messages
Most 0x53 messages are used by the TTScope software.
0x00 Echo
All data bytes in the request are simply returned unchanged.
0x01 Read DSO settings
This gives a long record in which the current settings of the DSO are binary encoded.
The request:
0x53 | 0x02 | 0x00 | 0x01 | 0x56 |
The reply contains the DSO settings (SYSData):
0x53 | Length | 0x81 | SYSData | Checksum | ||
LSB | MSB |
Details of the SYSData format can be found at http://www.mikrocontroller.net/articles/Datei:SysDATA_v1.0.zip
To ensure that the SYSData structure is decoded correctly it is recommended to read the /protocol.inf file immediately after connecting (see Read file).
If the protocol.inf file on the DSO is not readable or available the reply will be empty, i.e. it will contain no data byte:
0x53 | 0x02 | 0x00 | 0x81 | 0xD6 |
0x02 Read sample data
Only the sample data of the two channels (CH1/CH2) can be retrieved. The REF, MATH and FFT data can not be accessed, which is probably why Hantek's TTScope software shows nonsense data under "PowerSpectrum" and "WaveTabulator".
The request:
0x53 | 0x04 | 0x00 | 0x02 | 0x01 | 0x00 for CH1 or 0x01 for CH2 | Checksum |
The DSO responds with at least 3 and at most 202 packets. The first packet (subcommand 0x00) describes the total length of the sample data. The second packet (subcommand 0x01) contains a channel number and the sample data itself. If the sample data is longer than 10000 bytes, further packets with subcommand 0x01 are sent.
This is an example of a small transfer from a DSO5xxxB set to 4ns/DIV and 4K buffer:
0x53 | 0x06 | 0x00 | 0x82 | 0x00 | Sample data length (3 bytes) | Checksum |
0x53 | 0x5c | 0x02 | 0x82 | 0x01 | CHn + 0x..0x.. (600 bytes of sample data) | Checksum |
0x53 | 0x04 | 0x00 | 0x82 | 0x02 | CHn (0x00 for CH1 or 0x01 for CH2) | Checksum |
Here's an example with more data (150 packets with 10000 sample bytes per packet) from a DSO1202BV with 2ms/DIV and 2M buffer:
0x53 | 0x06 | 0x00 | 0x82 | 0x00 | Sample data length (3 byte) | Checksumme |
0x53 | 0x14 | 0x27 | 0x82 | 0x01 | CHn + 0x..0x.. (10000 bytes of sample data) | Checksum |
148 more packets with subcommand 0x01 and CHn sample data | ||||||
0x53 | 0x14 | 0x27 | 0x82 | 0x01 | CHn + 0x..0x.. (10000 bytes of sample data) | Checksum |
0x53 | 0x04 | 0x00 | 0x82 | 0x02 | CHn (0x00 for CH1 or 0x01 for CH2) | Checksum |
If an errors occurs during transmission, a special packet is sent with subcommand 0x03. This can also be sent if the DSO is in STOP mode, in which case there is no data available.
0x53 | 0x04 | 0x00 | 0x82 | 0x03 | CHn (0x00 for CH1 or 0x01 for CH2) | Checksum |
Since the sample data contains no information about the current DSO settings (channel, volts/DIV, timebase), it is important to read the settings first. The following commands ensure a consistency data set:
- 0x12 Lock panel
- 0x01 Read DSO settings
- 0x12 Unlock panel
- 0x02 Read sample data
- 0x00 or 0x01 can be used as "idle" commands
If both channels need to be read, the samples can be read sequentially:
- 0x12 Lock panel
- 0x01 Read DSO settings
- 0x12 Unlock panel
- 0x02 Read CH1 sample data
- 0x02 Read CH2 sample data
- 0x00 or 0x01 can be used as "idle" commands
Originally (in the Tekway DST1000 with 2.5Kpoint memory) the panel was also locked during the sample data transmission. This is not recommended for the current DSOs, since the data volumes are much higher than in this original model.
The sample data are post-processed from the image memory. The values are 10 DIV vertical (-127 to 127) and 20 DIV horizontal.
If the window timebase is smaller than the main timebase, only the visible part of the data is transmitted (see http://www.mikrocontroller.net/topic/205820?page=4#2613537).
0x10 Read file
This function can be used to read any file on the DSO, but is primarily intended to read the protocol.inf (see Read DSO settings) and keyprotocol.inf (see Keypress trigger) files.
The request must include the complete file path.
0x53 | Length | 0x10 | 0x00 | File path | Checksum | ||
LSB | MSB |
The response uses two subcommands:
- 0x01: Data
- 0x02: Checksum of all data
If the contents of the file don't fit in one response packet, further packets with the subcommand 0x01 are sent. The packet with subcommand 0x02 marks the end of the file transfer, and contains a checksum of the entire file.
0x53 | Length | 0x90 | 0x01 | File contents | Checksum | |
LSB | MSB | |||||
... | ||||||
0x53 | 0x04 | 0x00 | 0x90 | 0x02 | File contents checksum (1 byte) | Checksum |
0x11 Write DSO settings
To write settings, the data format specified in Read DSO settings must be used:
0x53 | Length | 0x11 | SYSData | Checksum | ||
LSB | MSB |
The response contains a status byte, where 0x00 denotes success and anything else is an error:
0x53 | 0x03 | 0x00 | 0x91 | 0x.. status | Checksum |
0x12 DSO Start/Stop - Bedienfeld sperren/freischalten
Erlaubt es, das DSO-Bedienfeld zu sperren oder zu entsperren und die DSO Akquisition starten/stoppen.
DSO Akquisition stoppen
0x53 | 0x04 | 0x00 | 0x12 | 0x00 | 0x01 | Checksumme 0x6A |
DSO Akquisition starten
0x53 | 0x04 | 0x00 | 0x12 | 0x00 | 0x00 | Checksumme 0x69 |
In der Antwort enthält man jeweils die gesendeten Datenbytes zurück:
0x53 | 0x04 | 0x00 | 0x92 | 0x00 | 0x01 oder 0x00 | Checksumme |
Soweit bekannt verursacht die "DSO Akquisition start/stop" funktion genau die selber (interne) Aktion wie die Start/Stop Taste auf dem Bedienfeld. Allerdings scheint diese funkton etwas buggy zu sein oder falsch verstanden (da die eigentlich gedacht ist? die acq. zu stoppen bevor Sample-Daten über USB übertragen werden).
Bedienfeld sperren
0x53 | 0x04 | 0x00 | 0x12 | 0x01 | 0x01 | Checksumme 0x6B |
Bedienfeld entsperren
0x53 | 0x04 | 0x00 | 0x12 | 0x01 | 0x00 | Checksumme 0x6A |
Ist dass Bedienfeld gesperrt, erscheint ein roter Schlüssel in der oberen Statusleiste auf dem DSO-Bildschirm und die Bedienelemente haben keine Funktion mehr.
In der Antwort enthält man jeweils die gesendeten Datenbytes zurück:
0x53 | 0x04 | 0x00 | 0x92 | 0x01 | 0x01 oder 0x00 | Checksumme |
0x13 Tastendruck auslösen
Erlaubt es das Drücken fast aller DSO-Tasten zu simulieren. Die gewünschte Taste wird durch jeweils zwei Datenbytes ausgewählt:
0x53 | 0x04 | 0x00 | 0x13 | 0x.. | 0x.. | Checksumme |
Das erste Byte ist das eigentliche Keycode, das zweite Byte die Anzahl der Klicks (aussage Hantek). Anscheinend wird aber bei der Anzahl der Klicks dennoch nur einmal "geklickt", es macht also wenig sinn Werte die höher als 0x01 sind zu benutzen.
Für die bench DSO Hantek DSO5xxxB/BM/BMV, Tekway DST1xxxB und Voltcraft DSO-3062C gelten folgende Keycodes:
0x00 0x01 - F0 Taste 0x01 0x01 - F1 Taste 0x02 0x01 - F2 Taste 0x03 0x01 - F3 Taste 0x04 0x01 - F4 Taste 0x05 0x01 - F5 Taste 0x06 0x01 - F6 Taste 0x07 0x01 - F7 Taste 0x08 0x01 - V0 links drehen 0x09 0x01 - V0 rechts drehen 0x0A 0x01 - V0 drücken 0x0B 0x01 - Save/Recall Taste 0x0C 0x01 - Measure Taste 0x0D 0x01 - Acquire Taste 0x0E 0x01 - Utility Taste 0x0F 0x01 - Cursor Taste 0x10 0x01 - Display Taste 0x11 0x01 - Autoset Taste 0x12 0x01 - Single Seq Taste 0x13 0x01 - Run/Stop Taste 0x14 0x01 - Help Taste 0x15 0x01 - Default Setup Taste 0x16 0x01 - Save to USB Taste 0x17 0x01 - Math Menu Taste 0x18 0x01 - CH1 Menu Taste 0x19 0x01 - CH1 Position links drehen 0x1A 0x01 - CH1 Position rechts drehen 0x1B 0x01 - CH1 Position drücken 0x1C 0x01 - CH1 Volts/Div links drehen 0x1D 0x01 - Ch1 Volts/Div rechts drehen 0x1E 0x01 - CH2 Menu Taste 0x1F 0x01 - CH2 Position links drehen 0x20 0x01 - CH2 Position rechts drehen 0x21 0x01 - CH2 Position drücken 0x22 0x01 - CH2 Volts/Div links drehen 0x23 0x01 - Ch2 Volts/Div rechts drehen 0x24 0x01 - Horz Menu Taste 0x25 0x01 - Horizontal Position rechts drehen 0x26 0x01 - Horizontal Position links drehen 0x27 0x01 - Horizontal Position drücken 0x28 0x01 - Horizontal Sec/Div links drehen 0x29 0x01 - Horizontal Sec/Div rechts drehen 0x2A 0x01 - Trig Menu Taste 0x2B 0x01 - Trigger Level links drehen 0x2C 0x01 - Trigger Level rechts drehen 0x2D 0x01 - Trigger Level drücken 0x2E 0x01 - Set to 50% Taste 0x2F 0x01 - Force Trig Taste 0x30 0x01 - Probe Check Taste
Für die Hantek Handheld DSO1xxxB/BV gelten folgende Keycodes:
0x00 0x01 - Fx NULL Taste 0x01 0x01 - Menu An/Aus 0x02 0x01 - F1 Taste 0x03 0x01 - F2 Taste 0x04 0x01 - F3 Taste 0x05 0x01 - F4 Taste 0x06 0x01 - F5 Taste 0x07 0x01 - DMM V 0x08 0x01 - DMM A 0x09 0x01 - DMM Ohm 0x0A 0x01 - DMM Diode 0x0B 0x01 - DMM Durchgangsprüfer 0x0C 0x01 - DMM Kapazität 0x0D 0x01 - DMM/DSO umschaltung 0x0E 0x01 - Save/Recall Taste 0x0F 0x01 - Measure Taste 0x10 0x01 - Utility Taste 0x11 0x01 - Cursor Taste 0x12 0x01 - CH1 Menu Taste 0x13 0x01 - Math Menu Taste 0x14 0x01 - CH2 Menu Taste 0x15 0x01 - Default Setup Taste 0x16 0x01 - Save to USB Taste 0x17 0x01 - Math Menu Taste 0x18 0x01 - CH1 Volts/Div + 0x19 0x01 - CH1 Volts/Div - 0x1A 0x01 - CH1 Position + 0x1B 0x01 - CH1 Position - 0x1C 0x01 - CH2 Position + 0x1D 0x01 - CH2 Position - 0x1E 0x01 - CH2 Volts/Div + 0x1F 0x01 - CH2 Volts/Div - 0x20 0x01 - Horizontal Sec/Div - 0x21 0x01 - Horizontal Sec/Div + 0x22 0x01 - Horizontal Position + 0x23 0x01 - Horizontal Position - 0x24 0x01 - Trigger Level + 0x25 0x01 - Trigger Level - 0x26 0x01 - Run/Stop Taste 0x27 0x01 - Autoset Taste 0x28 0x01 - Multifunktion Zero 0x29 0x01 - Multifunktion nach oben 0x2A 0x01 - Multifunktion nach unten 0x2B 0x01 - Multifunktion nach links 0x2C 0x01 - Multifunktion nach rechts
Um sicherstellen das ein passendes Tastenkommando/Keycode zuordnung benutzt wird ist empfehlenswert die /keyprotocol.inf von dem jeweiligen DSO direkt nach Verbindungsaufbau einzulesen (siehe Datei lesen)
Die keyprotocol.inf ist als folgend aufgebaut:
- in erster Zeile steht die Anzahl aller Keycodes - zweite Zeile markiert den Anfang der Liste - in den nächsten Zeilen folgen die Tastenkommandos (eigentlich deren Namen verwendet durch die firmware) und die Anzahl der Bytes die von jeweiligen Keycode benutzt sind. - die letzte Zeile markiert das Ende der Liste. - das jeweilige Zeilennummer -1 nach dem [START] Marker entspricht dem Keycode des Tastenkommandos.
Hier die keyprotocol.inf vom Hantek DSO5202B
[TOTAL] 49 [START] [FN-0-KEY] 1 [FN-1-KEY] 1 [FN-2-KEY] 1 [FN-3-KEY] 1 [FN-4-KEY] 1 [FN-5-KEY] 1 [FN-6-KEY] 1 [FN-7-KEY] 1 [FN-MLEFT-KEY] 1 [FN-MRIGHT-KEY] 1 [FN-MZERO-KEY] 1 [MENU-SR-KEY] 1 [MENU-MEASURE-KEY] 1 [MENU-ACQUIRE-KEY] 1 [MENU-UTILITY-KEY] 1 [MENU-CURSOR-KEY] 1 [MENU-DISPLAY-KEY] 1 [CT-AUTOSET-KEY] 1 [CT-SINGLESEQ-KEY] 1 [CT-RS-KEY] 1 [CT-HELP-KEY] 1 [CT-DS-KEY] 1 [CT-STU-KEY] 1 [VT-MATH-MENU-KEY] 1 [VT-CH1-MENU-KEY] 1 [VT-CH1-PSUB-KEY] 1 [VT-CH1-PADD-KEY] 1 [VT-CH1-PZERO-KEY] 1 [VT-CH1-VBSUB-KEY] 1 [VT-CH1-VBADD-KEY] 1 [VT-CH2-MENU-KEY] 1 [VT-CH2-PSUB-KEY] 1 [VT-CH2-PADD-KEY] 1 [VT-CH2-PZERO-KEY] 1 [VT-CH2-VBSUB-KEY] 1 [VT-CH2-VBADD-KEY] 1 [HZ-MENU-KEY] 1 [HZ-PSUB-KEY] 1 [HZ-PADD-KEY] 1 [HZ-PZERO-KEY] 1 [HZ-TBSUB-KEY] 1 [HZ-TBADD-KEY] 1 [TG-MENU-KEY] 1 [TG-PSUB-KEY] 1 [TG-PADD-KEY] 1 [TG-PZERO-KEY] 1 [TG-PHALF-KEY] 1 [TG-FORCE-KEY] 1 [TG-PROBECHECK-KEY] 1 [END]
Die Antwort zu einem Tastenkommando enthält ein Datenbyte, dass das selektierte Menü bezeichnet, bevor der Tastendruck simuliert wurde. Das Menü muss nicht notwendigerweise angezeigt sein. Auch wenn es ausgeblendet ist, enthält die Antwort ein entsprechendes Datenbyte, dass des Menüs das angezeigt worden wäre, wenn es nicht ausgeblendet wäre.
0x53 | 0x03 | 0x00 | 0x93 | 0x.. | Checksumme |
0x14 Set system time
Lets you set the system time.
0x53 | 0x09 | 0x00 | 0x14 | Data bytes (YYMDHMS) | Checksum |
The data bytes:
- Byte 1: Year (LSB)
- Byte 2: Year (MSB)
- Byte 3: Month (1...12)
- Byte 4: Day (1...31)
- Byte 5: Hour (0...23)
- Byte 6: Minute (0...59)
- Byte 7: Second (0...59)
The reply is a packet without data bytes:
0x53 | 0x02 | 0x00 | 0x94 | Checksumme |
0x20 Screenshot
After receiving this command, the DSO sends a screenshot image without size or color palette information. It is sent back in multiple reply messages, up to a total of 384000 bytes. This corresponds to the 800x480 resolution of the display, with a color depth of 8 bits.
The PC sends a request without data bytes:
0x53 | 0x02 | 0x00 | 0x20 | 0x75 |
The DSO responds with 37 packets of 10208 bytes, with subcommand 0x01. The 38th packet is a little shorter, containing only 6304 bytes. After this another packet is sent with subcommand 0x02, containing a primitive checksum.
0x53 | 0xE3 | 0x27 | 0xA0 | 0x01 | 0x.. 0x.. 0x.. .. .. .. (10208 bytes) | Checksum |
... | ||||||
0x53 | 0xA3 | 0x18 | 0xA0 | 0x01 | 0x.. 0x.. 0x.. .. .. .. (6304 bytes) | Checksum |
0x53 | 0x04 | 0x00 | 0xA0 | 0x02 | Image checksum (1 byte) | Checksum |
These DSO protocol packets are split up into multiple USB packets, but your USB library should resolve this transparently.
The received image is in the format of a windows bitmap with 256 colors. The image is flipped vertically, i.e. the bottom line is sent first. The color palette is compiled into the dso.exe
program on the DSO, and TTScope on the PC, and has a length of 1024 bytes.
In the handheld Hantek DSO1202B/BV, DSO1102B/BV and DSO1062B/BV the display has a 640x480 resolution. This results in a total 307200 bytes of data transmitted for the screenshot.
The PC sends a request without data bytes:
0x53 | 0x02 | 0x00 | 0x20 | 0x75 |
The DSO responds with 30 packets containing 10208 bytes, subcommand 0x01. The 31st packet contains only 960 bytes, and is again followed by a final packet containing a checksum for the screenshot data:
0x53 | 0xE3 | 0x27 | 0xA0 | 0x01 | 0x.. 0x.. 0x.. .. .. .. (10208 bytes) | Checksum |
... | ||||||
0x53 | 0xA3 | 0x18 | 0xA0 | 0x01 | 0x.. 0x.. 0x.. .. .. .. (960 bytes) | Checksum |
0x53 | 0x04 | 0x00 | 0xA0 | 0x02 | Image Checksum (1 byte) | Checksum |
0x21 Read system time
Lets you read the device's system time.
The PC sends a request without data bytes:
0x53 | 0x02 | 0x00 | 0x21 | 0x76 |
The reply contains seven data bytes:
0x53 | 0x09 | 0x00 | 0xA1 | Data bytes (YYMDHMS) | Checksum |
The data bytes:
- Byte 1: Year (LSB)
- Byte 2: Year (MSB)
- Byte 3: Month (1...12)
- Byte 4: Day (1...31)
- Byte 5: Hour (0...23)
- Byte 6: Minute (0...59)
- Byte 7: Second (0...59)
0x43 Debugging Meldungen
Die 0x43 Meldungen werden nicht von der PC Software benutzt, jedoch bieten die einige interessante Funktionen. Eventuell wird Hantek ein paar Fragen zu den 0x43 Meldungen beantworten.
0x00 FPGA Register lesen
Ermöglicht einzelnes oder mehrere FPGA Register zu lesen
Die Abfrage für einzelnes Register
0x43 | 0x04 | 0x00 | 0x00 | 0x00 | 0x00 bis 0xFF (Register Nummer) | Checksumme |
Die Antwort dazu beinhaltet 4 Byte Register Daten
0x43 | 0x06 | 0x00 | 0x80 | 0x.. 0x.. 0x.. 0x.. (Register Daten) | Checksumme |
Die Abfrage für mehrere Register beinhaltet der Start Register und die Anzahl der zu abfragenden Register. Dabei darf der letzte Register (Start Register + Anzahl der Register) nicht höher sein als 0x4F
0x43 | 0x05 | 0x00 | 0x00 | 0x01 | 0x.. (Start Register) | 0x.. (Anzahl der Register) | Checksumme |
Die Antwort dazu beinhaltet die Register Daten, jeweils 4 Byte per Register.
0x43 | Länge | 0x80 | X * 0x.. 0x.. 0x.. 0x.. (Register Daten) | Checksumme | ||
LSB | MSB |
Intern wird die Firmware Funktion "PcUartReadFpgaReg" aufgerufen. Die mögliche Verwendung muß noch erörtert werden
Bitte beachten - der Syntax ist temporär, evt. auch falsch.
0x01 FPGA FIFO Inhalt auslesen
Erlaubt direktes auslesen des FIFO Speichers. Die Abfrage beinhaltet die Buffer größ in Bytes
0x43 | 0x08 | 0x00 | 0x01 | 0x.. 0x.. (Buffer größe) | Checksumme |
Die Antwort beinhaltet die FIFO Daten
0x43 | Länge | 0x81 | FIFO Daten | Checksumme | ||
LSB | MSB |
Bitte beachten - der Syntax ist temporär, evt. auch falsch.
0x02 Read DSO firmware variables
The PC sends a request without data bytes:
0x43 | 0x02 | 0x00 | 0x02 | 0x47 |
The reply contains the DSO firmware variable values. These are stored on the DSO in the file
/param/sav/run1kb_yymmdd
and are loaded at boot time. If the file chk1kb
is not available at boot time, default values are used. These default values are also used when the "Default" button is pressed on the DSO. The stored setups also include these values.
The DSO variables themselves are not yet documented; but at least the following information is stored:
- current UI (current menu, all user-selectable settings)
- DSO serial number
- Firmware version
- PCB hardware revision
0x43 | Length | 0x82 | DSO firmware values | Checksum | ||
LSB | MSB |
0x03 DSO Selbstkalibrierung auslesen
Die Anfrage ist leer. D.h. sie enthält kein Datenbyte.
0x43 | 0x02 | 0x00 | 0x03 | 0x48 |
Die Antwort beinhaltet die Selbstkalibrierung Informationen, gelesen aus dem DSO Speicher. Die sind auf dem DSO in der Datei /param/sav/chk1kb_yymmdd gespeichert (Aktuell chk1kb_091023, der Zeitstempel kann sich ändern) und werden beim den Bootvorgang geladen. Sollte die Datei "chk1kb" nicht vorhanden sein wird automatisch den Bootvorgang eine leere "Vorlage" im Speicher erstellt.
0x43 | Länge | 0x83 | chk1kb Daten | Checksumme | ||
LSB | MSB |
0x10 Datei lesen
siehe 0x53 Normale Meldungen Datei_lesen
0x11 Virtual remote shell
Allows you to run shell commands. The command sent is stored on the DSO in a temporary file, which is then executed and the output is sent back in the reply packet. Instructions such as "cd / tmp" therefore do not make sense.
Commands that output over 10239 bytes cause the main "dso.exe" process to crash. If you have a shell on the DSO via the UART, you can run "/dso.exe" to restart it. Otherwise, powercycling the unit is necessary.
The request contains only the command:
0x43 | Length | 0x11 | Remote command | Checksum | ||
LSB | MSB |
The reply contains the shell output, followed by LF:
0x43 | Length | 0x91 | Shell output + LF | Checksum | ||
LSB | MSB |
0x40 DSO Firmware Variablen schreiben
Die Anfrage beinhaltet die DSO Firmware Variablen, siehe DSO_Firmware_Variablen_auslesen
0x43 | Länge | 0x40 | DSO F.V. Daten | Checksumme | ||
LSB | MSB |
Die Antwort ist leer. D.h. sie enthält kein Datenbyte.
0x43 | 0x02 | 0x00 | 0xC0 | 0x05 |
Um die Einstellungen zu aktivieren sollte das DSO_Init aufgerufen werden.
0x41 DSO Selbstkalibrierung schreiben
Die Anfrage beinhaltet die Selbstkalibrierung Informationen, siehe DSO_Selbstkalibrierung_auslesen
0x43 | Länge | 0x41 | chk1kb Daten | Checksumme | ||
LSB | MSB |
Die Antwort ist leer. D.h. sie enthält kein Datenbyte.
0x43 | 0x02 | 0x00 | 0xC1 | 0x06 |
Um die Einstellungen zu aktivieren sollte das DSO_Init aufgerufen werden.
0x42 FPGA Register beschreiben
Die Anfrage beinhaltet Register Nummer und die Register Daten, siehe auch FPGA_Register_lesen
0x43 | Länge | 0x42 | 0x00 bis 0xFF (Register Nummer) | 0x.. 0x.. 0x.. 0x.. (Register Daten) | Checksumme | |
LSB | MSB |
Die Antwort ist leer. D.h. sie enthält kein Datenbyte.
0x43 | 0x02 | 0x00 | 0xC2 | 0x07 |
Intern wird die Firmware Funktion "PcUartWriteFpgaReg" aufgerufen, die mögliche Verwendung muß noch erörtert werden.
Bitte beachten - der Syntax ist temporär, evt. auch falsch.
0x43 Keycode senden
Ermöglicht einen Keycode zu senden. Der Unterschied zum 0x53 Normales Meldung Tastendruck_auslösen ist dabei sehr einfach, es werden auch speziele Keycodes unterstüzt und nicht nur die die Tasten representieren.
Beispiel1 (DST1xxxB/BV) : Die Taste F6 während sie gedrückt wird hat den debug Keycode <66> (Keycode 0x06 aus der 0x53 Normale MeldungTastendruck_auslösen) + 0x3C). Während die losgelassen wird hat die Taste F6 den debug Keycode <194> (Keycode 0x06 aus der 0x53 Normale MeldungenTastendruck_auslösen) + 0xBB). Vereinfacht gesagt - jeweilige Zeilennummer auf keyprotocol.inf + 0x3B beim Taste drücken und jeweilige Zeilennummer + 0xBA beim loslassen.
Beispiel2 (Hantek DSO5xxxB, Voltcraft DSO-3062C, Tekway DST1xxxB) : Die Taste F6 während sie gedrückt wird hat den debug Keycode <7> (Keycode 0x06 aus der 0x53 Normale MeldungTastendruck_auslösen) + 1). Während die losgelassen wird hat die Taste F6 den debug Keycode <135> (Keycode 0x06 aus der 0x53 Normale MeldungenTastendruck_auslösen) + 1 + 0x80). Vereinfacht gesagt - jeweilige Zeilennummer aus der keyprotocol.inf beim Taste drücken und jeweilige Zeilennummer + 0x80 beim loslassen.
Diese beiden Beispiele zeigen wie unübersichtlich Hantek programmiert.
Die "0x43 Keycode senden" Funktion erlaubt beide debug Keycodes zu senden. Es ist sogar möglich mehrere "clicks" zu senden was sehr interessant für Remote Control sein kann (2 x Utility, 2 x Page, 1 x F1 drucken).
0x43 | Länge | 0x43 | 0x.. (debug Keycode) | 0x.. (Anzahl der clicks) | Checksumme | |
LSB | MSB |
Die Antwort ist leer. D.h. sie enthält kein Datenbyte.
0x43 | 0x02 | 0x00 | 0xC3 | Checksumme 0x08 |
0x44 DSO Buzzer
Aktiviert den Buzzer für die Zeit "BT" (1bit=100ms)
0x43 | 0x03 | 0x00 | 0x44 | 0x01 BT | Checksumme |
Sobald die Zeit abgelaufen ist schaltet sich der Buzzer selbständig aus.
Die Antwort ist leer. D.h. sie enthält kein Datenbyte.
0x43 | 0x02 | 0x00 | 0xC4 | 0x09 |
0x45 Interpolation anpassungen
Erlaubt (temporär) änderungen in der Lagrangeschen Interpolation. Soweit ich verstanden habe kann man die Abgrenzungen (0 bis 1000ps) setzen und die Phasen aller ADCs (eigentlich die Daten aus im FIFOs werden phasenverschoben und nicht die ADCs) ändern (0=0° bis FFFF=360°).
0x43 | 0x14 | 0x00 | 0x45 | 0x.. init LSB | 0x.. init MSB | 0x.. 0x.., 0x.. 0x.., 0x.. 0x.., 0x.. 0x.., 0x.. 0x.., 0x.. 0x.., 0x.. 0x.., 0x.. 0x.. (Phasen ADC 1 bis 8) | Checksumme |
Die Antwort ist leer. D.h. sie enthält kein Datenbyte.
0x43 | 0x02 | 0x00 | 0xC5 | 0x0A |
Die Lagrangesche Interpolation ist nur in den TBID < 3 (also Horizontal Ablenkung 2ns/DIV, 4ns/DIV und 8ns/DIV) eingeschaltet. Die mögliche Verwendung muß noch erörtert werden.
Bitte beachten - der Syntax ist temporär, evt. auch falsch
0x50 Datei senden
Diese Funktion kann benutzt werden um eine beliebige Datei auf das DSO zu übertragen.
Die Anfrage besteht aus drei Paketen wobei das erste Paket (mit Subkommando 0) den vollständigen Dateipfad (Zielpfad), das zweite Paket (mit Subkommando 1) beinhaltet die Daten selber. Sollte die Datei länger als 10000 Bytes sein, werden ein oder mehrere weitere Pakete (mit Subkommando 1) gesendet, solange bis die gesamte Datei gesendet ist. Zum Abschluß wird noch ein Paket gesendet (mit Subkommando 2). Es markiert das Ende der Übertragung und beinhaltet eine Checksumme über alle Bytes der gesendeten Datei.
0x43 | Länge | 0x50 | 0x00 | Dateipfad | Checksumme | |
LSB | MSB | |||||
... | ||||||
0x43 | Länge | 0x50 | 0x01 | Dateiinhalt | Checksumme | |
LSB | MSB | |||||
... | ||||||
0x43 | 0x04 | 0x00 | 0x50 | 0x02 | Dateiprüfsumme (1 Byte) | Checksumme |
Nach jedem dieser Pakete sollte einmal die Antwort abgefragt werden. Die Antwort ist leer. D.h. sie enthält kein Datenbyte.
0x43 | 0x02 | 0x00 | 0xD0 | 0x15 |
0x60 Datei updaten
Diese Funktion kann benutzt werden um eine beliebige Datei auf dem DSO zu ersetzen.
Die Anfrage besteht aus drei Paketen wobei das erste Paket (mit Subkommando 0) den vollständigen Dateipfad (Zielpfad), das zweite Paket (mit Subkommando 1) beinhaltet die Daten selber. Sollte die Datei länger als 10000 Bytes sein, werden ein oder mehrere weitere Pakete (mit Subkommando 1) gesendet, solange bis die gesamte Datei gesendet ist. Zum Abschluß wird noch ein Paket gesendet (mit Subkommando 2). Es markiert das Ende der Übertragung und beinhaltet eine Checksumme über alle Bytes der gesendeten Datei.
0x43 | Länge | 0x60 | 0x00 | Dateipfad | Checksumme | |
LSB | MSB | |||||
... | ||||||
0x43 | Länge | 0x60 | 0x01 | Dateiinhalt | Checksumme | |
LSB | MSB | |||||
... | ||||||
0x43 | 0x04 | 0x00 | 0x60 | 0x02 | Dateiprüfsumme (1 Byte) | Checksumme |
Nach jedem dieser Pakete sollte einmal die Antwort abgefragt werden. Die Antwort ist leer. D.h. sie enthält kein Datenbyte.
0x43 | 0x02 | 0x00 | 0xE0 | 0x25 |
Warum auch immer, aber nach dem ersten Paket kommt bei mir eine Antwort mit Fehler = 0x11
0x43 | 0x03 | 0x00 | 0xE0 | 0x11 (<- Fehler Code) | 0x37 |
was eigentlich für "Datei nicht gefunden" steht. Dennoch wird die angegebene Datei korrekt ersetzt.
0x7F Init DSO
Die Anfrage ist leer. D.h. sie enthält kein Datenbyte.
0x43 | 0x02 | 0x00 | 0x7F | 0xC4 |
Dies ruft folgende DSO Subroutinen in der Firmware:
PauseSysAcq Acq_InitAcqParam Acq_SyncEqualAcq SyncChDispWhenEnterX SyncBodeAssiant SyncDsoScanSwitch InitCalculationManageParam InitAcqWaveEvent InitDispWaveEvent InitWaveSoftEvent Init_SwapTrig Tdc_SyncTdcTable Limites_Init InitLcdUnwaveareaShow InitLcdWaveAreaShow InitDsoOtherStat UpdateSysRunParam Fpga_SetTrigHoldTime Sync_AutoDispInterval ContinueSysAcq ForceShowWinBar
Die Auswirkung ist nicht die selbe wie bei einem Neustart da nicht alle Init Subroutinen aufgerufen werden, allerdings ausreichend um z.b. DSO Variablen (siehe DSO_Firmware_Variablen_schreiben) oder DSO Selbstkalibrierung Daten (siehe DSO_Selbstkalibrierung_schreiben) zu aktivieren.
Die Antwort ist leer. D.h. sie enthält kein Datenbyte.
0x43 | 0x02 | 0x00 | 0xFF | 0x44 |
.
References
- ↑ This VID is actually assigned to Compaq.