Difference between revisions of "Saleae Logic/Info"
Uwe Hermann (talk | contribs) m |
Uwe Hermann (talk | contribs) (Moved protocol docs.) |
||
Line 500: | Line 500: | ||
(Bus Powered) | (Bus Powered) | ||
</small> | </small> | ||
== Vendor USB protocol == | |||
The original Saleae firmware, no longer used in sigrok, announces itself on the USB bus with the same vendor and product IDs, but with two endpoints: '''endpoint 1 (out)''' is used for sending commands to the logic analyzer, '''endpoint 2 (in)''' is for transfers of sample sets. Both endpoints are of type '''bulk'''. | |||
The Saleae Logic does no analysis in hardware at all. Processing triggers, protocol analysis and so on is all done on the software side; the hardware unit merely sends the requested number of samples at a given sample rate. The device has 8 probes, all of which are always probed and sent along. A full sample is thus always exactly one byte. | |||
=== Setting the samplerate, starting an acquisition === | |||
There is only one command the software sends to the Saleae Logic on '''endpoint 1''': a '''two-byte command''' to set the samplerate. The '''first byte''' is always '''0x01''' ('''0xd5''' on more recent firmware versions). This is likely a command opcode meaning "set sample rate". | |||
The '''second byte''' indicates the samplerate. The samplerate is given in the form of a divider based on the FX2LP's clock, which runs at 48MHz. The following formula is used: | |||
samplerate = 48 / (1 + divider) | |||
Thus, a samplerate of 2 MHz (for example) is selected by using 23 as the divider: | |||
{| border="0" style="font-size: smaller" | |||
|- bgcolor="#6699ff" | |||
!1st byte | |||
!2nd byte | |||
|- bgcolor="#eeeeee" | |||
| 0x01 (1) | |||
| 0x17 (23) | |||
|} | |||
=== Supported samplerates === | |||
The following samplerates are supported in older firmware versions: | |||
{| border="0" style="font-size: smaller" | |||
|- bgcolor="#6699ff" | |||
!Samplerate | |||
!Divider (hex) | |||
!Divider (int) | |||
|- bgcolor="#eeeeee" | |||
| 200 kHz | |||
| 0xef | |||
| 239 | |||
|- bgcolor="#dddddd" | |||
| 250 kHz | |||
| 0xbf | |||
| 191 | |||
|- bgcolor="#eeeeee" | |||
| 500 kHz | |||
| 0x5f | |||
| 95 | |||
|- bgcolor="#dddddd" | |||
| 1 MHz | |||
| 0x2f | |||
| 47 | |||
|- bgcolor="#eeeeee" | |||
| 2 MHz | |||
| 0x17 | |||
| 23 | |||
|- bgcolor="#dddddd" | |||
| 4 MHz | |||
| 0x0b | |||
| 11 | |||
|- bgcolor="#eeeeee" | |||
| 8 MHz | |||
| 0x05 | |||
| 5 | |||
|- bgcolor="#dddddd" | |||
| 12 MHz | |||
| 0x03 | |||
| 3 | |||
|- bgcolor="#eeeeee" | |||
| 16 MHz | |||
| 0x02 | |||
| 2 | |||
|- bgcolor="#dddddd" | |||
| 24 MHz | |||
| 0x01 | |||
| 1 | |||
|} | |||
Recent versions of the vendor software have additional samplerate settings of '''100 kHz''', '''50 kHz''', and '''25 kHz'''. However, these result in the same divider value of '''239''' (and the software likely just uses every 2nd/4th/8th sample) as with the 200 kHz samplerate, so they're not really too useful. | |||
The following samplerates are supported in newer firmware versions: | |||
{| border="0" style="font-size: smaller" | |||
|- bgcolor="#6699ff" | |||
!Samplerate | |||
!Divider (hex) | |||
!Divider (int) | |||
|- bgcolor="#eeeeee" | |||
| 200 kHz | |||
| 0x4e | |||
| 78 | |||
|- bgcolor="#dddddd" | |||
| 250 kHz | |||
| 0x9e | |||
| 158 | |||
|- bgcolor="#eeeeee" | |||
| 500 kHz | |||
| 0xfe | |||
| 254 | |||
|- bgcolor="#dddddd" | |||
| 1 MHz | |||
| 0x8e | |||
| 142 | |||
|- bgcolor="#eeeeee" | |||
| 2 MHz | |||
| 0xe6 | |||
| 230 | |||
|- bgcolor="#dddddd" | |||
| 4 MHz | |||
| 0xda | |||
| 218 | |||
|- bgcolor="#eeeeee" | |||
| 8 MHz | |||
| 0xd4 | |||
| 212 | |||
|- bgcolor="#dddddd" | |||
| 12 MHz | |||
| 0xe2 | |||
| 226 | |||
|- bgcolor="#eeeeee" | |||
| 16 MHz | |||
| 0xd5 | |||
| 213 | |||
|- bgcolor="#dddddd" | |||
| 24 MHz | |||
| 0xe0 | |||
| 224 | |||
|} | |||
=== Getting samples === | |||
Samples are read off '''endpoint 2'''. The Saleae Logic receives a read request from the host, and responds by sending the requested number of samples. The maximum number of samples transferred at a time is 4096, a constraint in the USB protocol. A sample is one byte, with each bit representing the state of one of the probes. Probe 1 (black wire) is in the MSB of the sample, probe 8 (purple wire) is the LSB. | |||
__FORCETOC__ | __FORCETOC__ |
Latest revision as of 20:18, 16 December 2012
lsusb before firmware upload
This is the lsusb output on Linux, before any FX2 firmware is uploaded:
$ lsusb -vvv Bus 001 Device 114: ID 0925:3881 Lakeview Research Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 255 Vendor Specific Class bDeviceSubClass 255 Vendor Specific Subclass bDeviceProtocol 255 Vendor Specific Protocol bMaxPacketSize0 64 idVendor 0x0925 Lakeview Research idProduct 0x3881 bcdDevice 0.01 iManufacturer 0 iProduct 0 iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 171 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 0 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 255 Vendor Specific Subclass bInterfaceProtocol 255 Vendor Specific Protocol iInterface 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 1 bNumEndpoints 6 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 255 Vendor Specific Subclass bInterfaceProtocol 255 Vendor Specific Protocol iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x04 EP 4 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x86 EP 6 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x88 EP 8 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 2 bNumEndpoints 6 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 255 Vendor Specific Subclass bInterfaceProtocol 255 Vendor Specific Protocol iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x04 EP 4 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x86 EP 6 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x88 EP 8 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 3 bNumEndpoints 6 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 255 Vendor Specific Subclass bInterfaceProtocol 255 Vendor Specific Protocol iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 1 Transfer Type Isochronous Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x04 EP 4 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x86 EP 6 IN bmAttributes 1 Transfer Type Isochronous Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x88 EP 8 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 255 Vendor Specific Class bDeviceSubClass 255 Vendor Specific Subclass bDeviceProtocol 255 Vendor Specific Protocol bMaxPacketSize0 64 bNumConfigurations 1 Device Status: 0x0000 (Bus Powered)
lsusb after firmware upload (old firmware)
This is the lsusb output on Linux, after the old Saleae Logic FX2 firmware is uploaded:
$ lsusb -vvv Bus 001 Device 116: ID 0925:3881 Lakeview Research Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 255 Vendor Specific Class bDeviceSubClass 255 Vendor Specific Subclass bDeviceProtocol 255 Vendor Specific Protocol bMaxPacketSize0 64 idVendor 0x0925 Lakeview Research idProduct 0x3881 bcdDevice 0.00 iManufacturer 1 Saleae LLC iProduct 2 Logic iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 32 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 255 Vendor Specific Subclass bInterfaceProtocol 255 Vendor Specific Protocol iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x82 EP 2 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 255 Vendor Specific Class bDeviceSubClass 255 Vendor Specific Subclass bDeviceProtocol 255 Vendor Specific Protocol bMaxPacketSize0 64 bNumConfigurations 1 Device Status: 0x0002 (Bus Powered) Remote Wakeup Enabled
lsusb after firmware upload (new firmware)
This is the lsusb output on Linux, after the new Saleae Logic FX2 firmware is uploaded:
$ lsusb -vvv Bus 002 Device 004: ID 0925:3881 Lakeview Research Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 255 Vendor Specific Class bDeviceSubClass 255 Vendor Specific Subclass bDeviceProtocol 255 Vendor Specific Protocol bMaxPacketSize0 64 idVendor 0x0925 Lakeview Research idProduct 0x3881 bcdDevice 0.00 iManufacturer 1 Saleae LLC iProduct 2 Logic iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 46 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 4 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 255 Vendor Specific Subclass bInterfaceProtocol 255 Vendor Specific Protocol iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x82 EP 2 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x06 EP 6 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 255 Vendor Specific Class bDeviceSubClass 255 Vendor Specific Subclass bDeviceProtocol 255 Vendor Specific Protocol bMaxPacketSize0 64 bNumConfigurations 1 Device Status: 0x0002 (Bus Powered) Remote Wakeup Enabled
lsusb after firmware upload (fx2lafw 1.0)
This is the lsusb output on Linux, after the fx2lafw 1.0 firmware is uploaded:
$ lsusb -vvv Bus 002 Device 057: ID 0925:3881 Lakeview Research Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 255 Vendor Specific Class bDeviceSubClass 255 Vendor Specific Subclass bDeviceProtocol 255 Vendor Specific Protocol bMaxPacketSize0 64 idVendor 0x0925 Lakeview Research idProduct 0x3881 bcdDevice 0.01 iManufacturer 1 sigrok iProduct 2 fx2lafw iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 25 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 255 Vendor Specific Subclass bInterfaceProtocol 255 Vendor Specific Protocol iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x82 EP 2 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 255 Vendor Specific Class bDeviceSubClass 255 Vendor Specific Subclass bDeviceProtocol 255 Vendor Specific Protocol bMaxPacketSize0 64 bNumConfigurations 1 Device Status: 0x0000 (Bus Powered)
Vendor USB protocol
The original Saleae firmware, no longer used in sigrok, announces itself on the USB bus with the same vendor and product IDs, but with two endpoints: endpoint 1 (out) is used for sending commands to the logic analyzer, endpoint 2 (in) is for transfers of sample sets. Both endpoints are of type bulk.
The Saleae Logic does no analysis in hardware at all. Processing triggers, protocol analysis and so on is all done on the software side; the hardware unit merely sends the requested number of samples at a given sample rate. The device has 8 probes, all of which are always probed and sent along. A full sample is thus always exactly one byte.
Setting the samplerate, starting an acquisition
There is only one command the software sends to the Saleae Logic on endpoint 1: a two-byte command to set the samplerate. The first byte is always 0x01 (0xd5 on more recent firmware versions). This is likely a command opcode meaning "set sample rate".
The second byte indicates the samplerate. The samplerate is given in the form of a divider based on the FX2LP's clock, which runs at 48MHz. The following formula is used:
samplerate = 48 / (1 + divider)
Thus, a samplerate of 2 MHz (for example) is selected by using 23 as the divider:
1st byte | 2nd byte |
---|---|
0x01 (1) | 0x17 (23) |
Supported samplerates
The following samplerates are supported in older firmware versions:
Samplerate | Divider (hex) | Divider (int) |
---|---|---|
200 kHz | 0xef | 239 |
250 kHz | 0xbf | 191 |
500 kHz | 0x5f | 95 |
1 MHz | 0x2f | 47 |
2 MHz | 0x17 | 23 |
4 MHz | 0x0b | 11 |
8 MHz | 0x05 | 5 |
12 MHz | 0x03 | 3 |
16 MHz | 0x02 | 2 |
24 MHz | 0x01 | 1 |
Recent versions of the vendor software have additional samplerate settings of 100 kHz, 50 kHz, and 25 kHz. However, these result in the same divider value of 239 (and the software likely just uses every 2nd/4th/8th sample) as with the 200 kHz samplerate, so they're not really too useful.
The following samplerates are supported in newer firmware versions:
Samplerate | Divider (hex) | Divider (int) |
---|---|---|
200 kHz | 0x4e | 78 |
250 kHz | 0x9e | 158 |
500 kHz | 0xfe | 254 |
1 MHz | 0x8e | 142 |
2 MHz | 0xe6 | 230 |
4 MHz | 0xda | 218 |
8 MHz | 0xd4 | 212 |
12 MHz | 0xe2 | 226 |
16 MHz | 0xd5 | 213 |
24 MHz | 0xe0 | 224 |
Getting samples
Samples are read off endpoint 2. The Saleae Logic receives a read request from the host, and responds by sending the requested number of samples. The maximum number of samples transferred at a time is 4096, a constraint in the USB protocol. A sample is one byte, with each bit representing the state of one of the probes. Probe 1 (black wire) is in the MSB of the sample, probe 8 (purple wire) is the LSB.