1 |
2 |
ultra_embe |
### USB Sniffer
|
2 |
|
|
|
3 |
|
|
Github: [https://github.com/ultraembedded/core_usb_sniffer](https://github.com/ultraembedded/core_usb_sniffer)
|
4 |
|
|
|
5 |
|
|
This core is a HS/FS USB2.0 analyzer (USB bus sniffer).
|
6 |
|
|
The core monitors a UTMI interface and logs the traffic seen to a memory buffer via an AXI-4 bus master interface.
|
7 |
|
|
The log format can be extracted continuously (continuous capture mode) or the core can stop capturing when the memory buffer is full (one-shot mode).
|
8 |
|
|
|
9 |
|
|
Configuration of the IP is performed using an AXI4-Lite slave interface.
|
10 |
|
|
|
11 |
|
|
This core has been used to produce a [USB 2.0 Capture Device](https://github.com/ultraembedded/usb2sniffer).
|
12 |
|
|
|
13 |
|
|
#### Features
|
14 |
|
|
|
15 |
|
|
* Option of filtering based on device ID and/or endpoint.
|
16 |
|
|
* Option of filtering out SOF packets.
|
17 |
|
|
* Option of filtering out IN+NAK packets.
|
18 |
|
|
* Dense logging format.
|
19 |
|
|
* Supports continuous streaming or one-shot mode.
|
20 |
|
|
* Detection of buffer overruns.
|
21 |
|
|
|
22 |
|
|
##### Register Map
|
23 |
|
|
|
24 |
|
|
| Offset | Name | Description |
|
25 |
|
|
| ------ | ---- | ------------- |
|
26 |
|
|
| 0x00 | USB_BUFFER_CFG | [RW] Configuration Register |
|
27 |
|
|
| 0x04 | USB_BUFFER_STS | [R] Status Register |
|
28 |
|
|
| 0x08 | USB_BUFFER_BASE | [RW] Buffer Base Address |
|
29 |
|
|
| 0x0c | USB_BUFFER_END | [RW] Buffer End Address |
|
30 |
|
|
| 0x10 | USB_BUFFER_CURRENT | [R] Buffer Current address |
|
31 |
|
|
|
32 |
|
|
##### Register: USB_BUFFER_CFG
|
33 |
|
|
|
34 |
|
|
| Bits | Name | Description |
|
35 |
|
|
| ---- | ---- | -------------- |
|
36 |
|
|
| 31 | CONT | Continuous capture - overwrite on wrap (0 = Stop on full, 1 = cont) |
|
37 |
|
|
| 30:24 | DEV | Device ID to match (only if MATCH_DEV = 1) |
|
38 |
|
|
| 19:16 | EP | Endpoint to match (only if MATCH_EP = 1) |
|
39 |
|
|
| 15 | PHY_DMPULLDOWN | UTMI PHY D+ Pulldown Enable (valid if SPEED=manual) |
|
40 |
|
|
| 14 | PHY_DPPULLDOWN | UTMI PHY D+ Pulldown Enable (valid if SPEED=manual) |
|
41 |
|
|
| 13 | PHY_TERMSELECT | UTMI PHY Termination Select (valid if SPEED=manual) |
|
42 |
|
|
| 12:11 | PHY_XCVRSELECT | UTMI PHY Transceiver Select (valid if SPEED=manual) |
|
43 |
|
|
| 10:9 | PHY_OPMODE | UTMI PHY Output Mode (valid if SPEED=manual) |
|
44 |
|
|
| 8:7 | SPEED | USB bus speed (0 = HS, 1 = FS, 2 = LS, 3=manual) |
|
45 |
|
|
| 6 | EXCLUDE_EP | Exclude specific endpoint |
|
46 |
|
|
| 5 | MATCH_EP | Match specific endpoint |
|
47 |
|
|
| 4 | EXCLUDE_DEV | Exclude specific device ID |
|
48 |
|
|
| 3 | MATCH_DEV | Match specific device ID |
|
49 |
|
|
| 2 | IGNORE_SOF | Drop SOF packets (0 = Log SOF, 1 = Drop SOF) |
|
50 |
|
|
| 1 | IGNORE_IN_NAK | Drop IN + NAK sequences |
|
51 |
|
|
| 0 | ENABLED | Capture enabled |
|
52 |
|
|
|
53 |
|
|
##### Register: USB_BUFFER_STS
|
54 |
|
|
|
55 |
|
|
| Bits | Name | Description |
|
56 |
|
|
| ---- | ---- | -------------- |
|
57 |
|
|
| 2 | DATA_LOSS | Data lost due to stream backpressure |
|
58 |
|
|
| 1 | WRAPPED | Capture wrapped |
|
59 |
|
|
| 0 | TRIG | Capture triggered |
|
60 |
|
|
|
61 |
|
|
##### Register: USB_BUFFER_BASE
|
62 |
|
|
|
63 |
|
|
| Bits | Name | Description |
|
64 |
|
|
| ---- | ---- | -------------- |
|
65 |
|
|
| 31:0 | ADDR | Address of buffer base |
|
66 |
|
|
|
67 |
|
|
##### Register: USB_BUFFER_END
|
68 |
|
|
|
69 |
|
|
| Bits | Name | Description |
|
70 |
|
|
| ---- | ---- | -------------- |
|
71 |
|
|
| 31:0 | ADDR | Address of buffer end |
|
72 |
|
|
|
73 |
|
|
##### Register: USB_BUFFER_CURRENT
|
74 |
|
|
|
75 |
|
|
| Bits | Name | Description |
|
76 |
|
|
| ---- | ---- | -------------- |
|
77 |
|
|
| 31:0 | ADDR | Current buffer address - last entry written |
|
78 |
|
|
|
79 |
|
|
#### References
|
80 |
|
|
|
81 |
|
|
* [UTMI+ Low Pin Interface (ULPI) Specification](https://www.sparkfun.com/datasheets/Components/SMD/ULPI_v1_1.pdf)
|
82 |
|
|
* [SMSC USB3300 USB PHY Datasheet](http://ww1.microchip.com/downloads/en/DeviceDoc/3300db.pdf)
|
83 |
|
|
* [ULPI Wrapper](https://github.com/ultraembedded/core_ulpi_wrapper)
|
84 |
|
|
|