Difference between revisions of "Rigol VG1021"
(The bare bones protocol that maybe should work...) |
|||
(10 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
== | ==Overview== | ||
The Rigol VG1021 is a 20Mhz 100MS/s Function/Arbitrary waveform generator. | The Rigol VG1021 is a 20Mhz 100MS/s Function/Arbitrary waveform generator. | ||
Line 7: | Line 7: | ||
===Packet types=== | ===Packet types=== | ||
Packets seen so far (note that details differ from USBTMC specification): | |||
{| border="0" style="font-size: smaller" | |||
|- bgcolor="#6699ff" | |||
!Name | |||
!MsgID or bRequestType | |||
!bRequest | |||
!Endpoint or wIndex | |||
!Description | |||
|- bgcolor="#eeeeee" | |||
| DEV_DEP_MSG_OUT | |||
| 1 | |||
| | |||
| BULK-Out(0x01) | |||
| Prepare for a device dependent command. Header includes command length. | |||
|- bgcolor="#dddddd" | |||
| Command | |||
| | |||
| | |||
| BULK-In(0x82) | |||
| Write a command. | |||
|- bgcolor="#eeeeee" | |||
| REQUEST_DEV_DEP_MSG_IN | |||
| 2 | |||
| | |||
| BULK-Out(0x01) | |||
| Request a response for the previous command that requires one. | |||
|- bgcolor="#dddddd" | |||
| DEV_DEP_MSG_IN | |||
| 2 | |||
| | |||
| BULK-In(0x82) | |||
| Read the response for the previous command that requires one. | |||
|- bgcolor="#eeeeee" | |||
| Vendor Request 0x09 | |||
| 0xC2 | |||
| 0x09 | |||
| CTRL_MSG | |||
| Unknown vendor endpoint request, wLength = 0x04. So far always returns 01 00 00 00 | |||
|} | |||
====DEV_DEP_MSG_OUT==== | |||
Consists of a USBTMC DEV_DEP_MSG_OUT header: | |||
{| border="0" style="font-size: smaller" | |||
|- bgcolor="#6699ff" | |||
** | !Offset | ||
* | !Field | ||
!Value | |||
!Description | |||
|- bgcolor="#eeeeee" | |||
| 0 | |||
| MsgID | |||
| 1 | |||
| Identifies as DEV_DEP_MSG_OUT. | |||
|- bgcolor="#dddddd" | |||
| 1 | |||
| bTag | |||
| Number | |||
| Per USBTMC specification, bTag is incremented by host every time a USBTMC message is sent. Rolls over from 255 -> 1. | |||
|- bgcolor="#eeeeee" | |||
| 2 | |||
| bTagInverse | |||
| Number | |||
| Per USBTMC specification, bTagInverse is the one's complement of bTag. | |||
|- bgcolor="#dddddd" | |||
| 3 | |||
| Reserved | |||
| 0x00 | |||
| Must be 0x00. | |||
|- bgcolor="#eeeeee" | |||
| 4-7 | |||
| TransferSize | |||
| LSByte first | |||
| Length of command without header or alignment bytes. | |||
|- bgcolor="#dddddd" | |||
| 8 | |||
| bmTransferAttributes | |||
| 0x01 | |||
| EOM, indicating that the last message byte (excluding alignment bytes) in the transfer is the last byte of the message (used for USBTMC Split messages that use multiple transfers. Yet to see one on this device, don't know if it supports them. Probably not.) | |||
|- bgcolor="#eeeeee" | |||
| 9-11 | |||
| Reserved | |||
| 0xCDCDCD | |||
| According to USBTMC spec, must be 0x000000. I interpret as Command Data to follow. | |||
|} | |||
====Command==== | |||
Consists of a BULK-Out transfer with command without header, leading ":", newline or alignment bytes. Does not follow the PacketSize = n*4 bytes requirement. | |||
====REQUEST_DEV_DEP_MSG_IN==== | |||
Consists of a USBTMC REQUEST_DEV_DEP_MSG_IN header to BULK-Out(0x01) endpoint. The command is not sent with this packet or message, instead, the command is sent using the DEV_DEP_MSG_OUT and Command packets. This packet only requests the response. | |||
Consists of a USBTMC Message DEV_DEP_MSG_OUT header: | |||
{| border="0" style="font-size: smaller" | |||
|- bgcolor="#6699ff" | |||
!Offset | |||
!Field | |||
!Value | |||
!Description | |||
|- bgcolor="#eeeeee" | |||
| 0 | |||
| MsgID | |||
| 2 | |||
| Identifies as REQUEST_DEV_DEP_MSG_IN. | |||
|- bgcolor="#dddddd" | |||
| 1-3 | |||
| bTag, bTagInverse, Reserved | |||
| Number | |||
| See [[#DEV_DEP_MSG_OUT]] | |||
|- bgcolor="#eeeeee" | |||
| 4-7 | |||
| TransferSize | |||
| LSByte first | |||
| Maximum response data bytes. Only seen 0x40. | |||
|- bgcolor="#dddddd" | |||
| 8 | |||
| bmTransferAttributes | |||
| 0x01 | |||
| According to USBTMC spec, should be 0x02 (use TermChar from byte 9) or 0x00 (ignore TermChar)) | |||
|- bgcolor="#eeeeee" | |||
| 9 | |||
| TermChar | |||
| 0x0A | |||
| See USBTMC spec. For this device, not important. | |||
|- bgcolor="#dddddd" | |||
| 10-11 | |||
| Reserved | |||
| 0x0000 | |||
| As specified. | |||
|} | |||
====DEV_DEP_MSG_IN==== | |||
Compliant with USBTMC, assuming wMaxPacketLength is 64. Header and data from BULK-In(0x82). If more than 52 bytes of data (plus 12 header) is needed, then rest of the data is sent in following packets without header or alignment bytes, compliant with USBTMC. | |||
{| border="0" style="font-size: smaller" | |||
|- bgcolor="#6699ff" | |||
!Offset | |||
!Field | |||
!Value | |||
!Description | |||
|- bgcolor="#eeeeee" | |||
| 0 | |||
| MsgID | |||
| 2 | |||
| Identifies as DEV_DEP_MSG_IN. | |||
|- bgcolor="#dddddd" | |||
| 1-3 | |||
| bTag, bTagInverse, Reserved | |||
| Number | |||
| See [[#DEV_DEP_MSG_OUT]] | |||
|- bgcolor="#eeeeee" | |||
| 4-7 | |||
| TransferSize | |||
| LSByte first | |||
| Length of returned data without header or alignment bytes. | |||
|- bgcolor="#dddddd" | |||
| 8 | |||
| bmTransferAttributes | |||
| 0x01 | |||
| See USBTMC Specifications. | |||
|- bgcolor="#eeeeee" | |||
| 9-11 | |||
| Reserved | |||
| 0x0000 | |||
| As specified. | |||
|} | |||
====Vendor Request 0x09==== | |||
Vendor Endpoint In control message, always returns 0x01000000. | |||
*bmRequestType = 0xC2 | |||
*bRequest = 0x09 | |||
*wValue = 0x00 | |||
*wIndex = 0x00 | |||
*wLength = 0x04 | |||
Assuming first byte of response to be USBTMC_Status byte<sup>[[#References|4]]</sup>. If left out from command sequences, the device will occasionally return the same answer packet to the next query. | |||
====TRIGGER==== | |||
Not implemented, uses standard command sending method with command "<nowiki>*</nowiki>TRG" | |||
===Transfer sequences=== | |||
Transfer sequences as performed by bundled software. | |||
====Command sequence==== | |||
#DEV_DEP_MSG_OUT | |||
#Command | |||
#*If the command requires no response, the process ends here. | |||
#Vendor Request 0x09 | |||
#Vendor Request 0x09 | |||
#REQUEST_DEV_DEP_MSG_IN | |||
#DEV_DEP_MSG_IN | |||
====Startup sequence==== | |||
Here commands are in '''bold''' and responses from device in ''italics''. Commands can be abbreviated to uppercase portions (per VISA specifications). Commands are sent and responses read using [[#Command sequence]] | |||
#'''*IDN?''' - ''RIGOL TECHNOLOGIES,VG1021, <nowiki><serial>,<firmware></nowiki> | |||
#'''SYSTem:BEEPer:STATe ON''' | |||
#'''VOLTage:RANGe:AUTO ON''' | |||
#'''OUTPut:LOAD INFinity''' | |||
#'''OUTPut:POLarity NORMal''' | |||
#'''PHASe 0''' | |||
#'''OUTPut OFF''' | |||
#'''OUTPut:SYNC OFF''' | |||
#'''FREQuency 1000''' | |||
#'''VOLTage 5Vpp''' | |||
#'''VOLTage:OFFSet 0V''' | |||
#'''FUNCtion:SQUare:DCYCle 50''' | |||
#'''FUNCtion::SYMMetry 50''' | |||
#'''PULSe:DCYCle 50''' | |||
#'''FUNCtion:USER EXP_RISE''' | |||
#'''AM:SOURce INTernal''' | |||
#'''AM:DEPTh 100''' | |||
#'''AM:INTernal:FREQuency 100''' | |||
#'''AM:INTernal:FUNCtion SINusoid''' | |||
#'''FM:SOURce INTernal''' | |||
#'''FM:DEViation 100''' | |||
#'''FM:INTernal:FREQuency 100''' | |||
#'''FM:INTernal:FUNCtion SINusoid''' | |||
#'''FSKey:SOURce INTernal''' | |||
#'''FSKey:FREQuency 100''' | |||
#'''FM:INTernal:RATE 100''' | |||
#'''PM:SOURce INTernal''' | |||
#'''PM:DEViation 100''' | |||
#'''PM:INTernal:FREQuency 100''' | |||
#'''PM:INTernal:FUNCtion SINusoid''' | |||
#'''SWEep:SPACing LINear''' | |||
#'''FREQuency:STARt 100''' | |||
#'''FREQuency:STOP 1000''' | |||
#'''SWEep:TIME 1''' | |||
#'''TRIGger:SOURce IMMediate''' | |||
#'''BURSt:NCYCles 1''' | |||
#'''BURSt:PHASe 0''' | |||
#'''TRIGger:SOURce IMMediate''' | |||
#'''BURSt:INTernal:PERiod 0.01''' | |||
#'''TRIGger:DELay 0''' | |||
#'''COUNter:COUPling AC''' | |||
#'''COUNter:HFRState OFF''' | |||
#'''COUNter:SENSitivity HIGH''' | |||
#'''FUNCtion SINusoid''' | |||
#'''FREQuency 1000''' | |||
#'''VOLTage 5Vpp''' | |||
#'''VOLTage:OFFSet 0V''' | |||
#'''AM:STATe?''' - ''OFF'' | |||
#'''FM:STATe?''' - ''OFF'' | |||
#'''FSKey:STATe?''' - ''OFF'' | |||
#'''PM:STATe?''' - ''OFF'' | |||
#'''SWEep:STATe?''' - ''OFF'' | |||
#'''BURSt:STATe?''' - ''OFF'' | |||
#'''FUNCtion SINusoid''' | |||
==References== | ==References== | ||
*<sup>[[#Protocol|1]]</sup> [http://www.usb.org/developers/defined_class#BaseClassFEh USB.org - Defined 1.0 Class Codes] | *<sup>[[#Protocol|1]]</sup> [http://www.usb.org/developers/defined_class#BaseClassFEh USB.org - Defined 1.0 Class Codes] | ||
*<sup>[[#Protocol|2]]</sup> [http://www.usb.org/developers/devclass_docs/USBTMC_1_006a.zip USB.org - Approved Class Specification Documents - TMC Specifications] USBTMC 1.00 | *<sup>[[#Protocol|2]], [[#Vendor Request 0x09|4]]</sup> [http://www.usb.org/developers/devclass_docs/USBTMC_1_006a.zip USB.org - Approved Class Specification Documents - TMC Specifications] USBTMC 1.00 | ||
*<sup>[[#Protocol|3]]</sup> [http://www.usb.org/developers/devclass_docs/USBTMC_1_006a.zip USB.org - Approved Class Specification Documents - TMC Specifications] USBTMC-USB488 1.00 | *<sup>[[#Protocol|3]]</sup> [http://www.usb.org/developers/devclass_docs/USBTMC_1_006a.zip USB.org - Approved Class Specification Documents - TMC Specifications] USBTMC-USB488 1.00 | ||
[[Category:Device]] | |||
[[Category:Signal generator]] |
Latest revision as of 18:26, 27 September 2014
Overview
The Rigol VG1021 is a 20Mhz 100MS/s Function/Arbitrary waveform generator.
Protocol
Device Class code implies compatibility with USBTMC USB488 (USB Class 0xFE, Subclass 0x03, Protocol 0x01)1, but deviates significantly from specification.2,3. It fails to heed the "multiple of four" transaction length, sends commands in a nonstandard way and uses reserved bytes that should be zero. Any general purpose USBTMC driver will time out when trying to read an answer from the device, because the command requiring response didn't register as such.
Packet types
Packets seen so far (note that details differ from USBTMC specification):
Name | MsgID or bRequestType | bRequest | Endpoint or wIndex | Description |
---|---|---|---|---|
DEV_DEP_MSG_OUT | 1 | BULK-Out(0x01) | Prepare for a device dependent command. Header includes command length. | |
Command | BULK-In(0x82) | Write a command. | ||
REQUEST_DEV_DEP_MSG_IN | 2 | BULK-Out(0x01) | Request a response for the previous command that requires one. | |
DEV_DEP_MSG_IN | 2 | BULK-In(0x82) | Read the response for the previous command that requires one. | |
Vendor Request 0x09 | 0xC2 | 0x09 | CTRL_MSG | Unknown vendor endpoint request, wLength = 0x04. So far always returns 01 00 00 00 |
DEV_DEP_MSG_OUT
Consists of a USBTMC DEV_DEP_MSG_OUT header:
Offset | Field | Value | Description |
---|---|---|---|
0 | MsgID | 1 | Identifies as DEV_DEP_MSG_OUT. |
1 | bTag | Number | Per USBTMC specification, bTag is incremented by host every time a USBTMC message is sent. Rolls over from 255 -> 1. |
2 | bTagInverse | Number | Per USBTMC specification, bTagInverse is the one's complement of bTag. |
3 | Reserved | 0x00 | Must be 0x00. |
4-7 | TransferSize | LSByte first | Length of command without header or alignment bytes. |
8 | bmTransferAttributes | 0x01 | EOM, indicating that the last message byte (excluding alignment bytes) in the transfer is the last byte of the message (used for USBTMC Split messages that use multiple transfers. Yet to see one on this device, don't know if it supports them. Probably not.) |
9-11 | Reserved | 0xCDCDCD | According to USBTMC spec, must be 0x000000. I interpret as Command Data to follow. |
Command
Consists of a BULK-Out transfer with command without header, leading ":", newline or alignment bytes. Does not follow the PacketSize = n*4 bytes requirement.
REQUEST_DEV_DEP_MSG_IN
Consists of a USBTMC REQUEST_DEV_DEP_MSG_IN header to BULK-Out(0x01) endpoint. The command is not sent with this packet or message, instead, the command is sent using the DEV_DEP_MSG_OUT and Command packets. This packet only requests the response. Consists of a USBTMC Message DEV_DEP_MSG_OUT header:
Offset | Field | Value | Description |
---|---|---|---|
0 | MsgID | 2 | Identifies as REQUEST_DEV_DEP_MSG_IN. |
1-3 | bTag, bTagInverse, Reserved | Number | See #DEV_DEP_MSG_OUT |
4-7 | TransferSize | LSByte first | Maximum response data bytes. Only seen 0x40. |
8 | bmTransferAttributes | 0x01 | According to USBTMC spec, should be 0x02 (use TermChar from byte 9) or 0x00 (ignore TermChar)) |
9 | TermChar | 0x0A | See USBTMC spec. For this device, not important. |
10-11 | Reserved | 0x0000 | As specified. |
DEV_DEP_MSG_IN
Compliant with USBTMC, assuming wMaxPacketLength is 64. Header and data from BULK-In(0x82). If more than 52 bytes of data (plus 12 header) is needed, then rest of the data is sent in following packets without header or alignment bytes, compliant with USBTMC.
Offset | Field | Value | Description |
---|---|---|---|
0 | MsgID | 2 | Identifies as DEV_DEP_MSG_IN. |
1-3 | bTag, bTagInverse, Reserved | Number | See #DEV_DEP_MSG_OUT |
4-7 | TransferSize | LSByte first | Length of returned data without header or alignment bytes. |
8 | bmTransferAttributes | 0x01 | See USBTMC Specifications. |
9-11 | Reserved | 0x0000 | As specified. |
Vendor Request 0x09
Vendor Endpoint In control message, always returns 0x01000000.
- bmRequestType = 0xC2
- bRequest = 0x09
- wValue = 0x00
- wIndex = 0x00
- wLength = 0x04
Assuming first byte of response to be USBTMC_Status byte4. If left out from command sequences, the device will occasionally return the same answer packet to the next query.
TRIGGER
Not implemented, uses standard command sending method with command "*TRG"
Transfer sequences
Transfer sequences as performed by bundled software.
Command sequence
- DEV_DEP_MSG_OUT
- Command
- If the command requires no response, the process ends here.
- Vendor Request 0x09
- Vendor Request 0x09
- REQUEST_DEV_DEP_MSG_IN
- DEV_DEP_MSG_IN
Startup sequence
Here commands are in bold and responses from device in italics. Commands can be abbreviated to uppercase portions (per VISA specifications). Commands are sent and responses read using #Command sequence
- *IDN? - RIGOL TECHNOLOGIES,VG1021, <serial>,<firmware>
- SYSTem:BEEPer:STATe ON
- VOLTage:RANGe:AUTO ON
- OUTPut:LOAD INFinity
- OUTPut:POLarity NORMal
- PHASe 0
- OUTPut OFF
- OUTPut:SYNC OFF
- FREQuency 1000
- VOLTage 5Vpp
- VOLTage:OFFSet 0V
- FUNCtion:SQUare:DCYCle 50
- FUNCtion::SYMMetry 50
- PULSe:DCYCle 50
- FUNCtion:USER EXP_RISE
- AM:SOURce INTernal
- AM:DEPTh 100
- AM:INTernal:FREQuency 100
- AM:INTernal:FUNCtion SINusoid
- FM:SOURce INTernal
- FM:DEViation 100
- FM:INTernal:FREQuency 100
- FM:INTernal:FUNCtion SINusoid
- FSKey:SOURce INTernal
- FSKey:FREQuency 100
- FM:INTernal:RATE 100
- PM:SOURce INTernal
- PM:DEViation 100
- PM:INTernal:FREQuency 100
- PM:INTernal:FUNCtion SINusoid
- SWEep:SPACing LINear
- FREQuency:STARt 100
- FREQuency:STOP 1000
- SWEep:TIME 1
- TRIGger:SOURce IMMediate
- BURSt:NCYCles 1
- BURSt:PHASe 0
- TRIGger:SOURce IMMediate
- BURSt:INTernal:PERiod 0.01
- TRIGger:DELay 0
- COUNter:COUPling AC
- COUNter:HFRState OFF
- COUNter:SENSitivity HIGH
- FUNCtion SINusoid
- FREQuency 1000
- VOLTage 5Vpp
- VOLTage:OFFSet 0V
- AM:STATe? - OFF
- FM:STATe? - OFF
- FSKey:STATe? - OFF
- PM:STATe? - OFF
- SWEep:STATe? - OFF
- BURSt:STATe? - OFF
- FUNCtion SINusoid