GithubHelp home page GithubHelp logo

ataradov / usb-sniffer Goto Github PK

View Code? Open in Web Editor NEW
751.0 751.0 78.0 3.54 MB

Low-cost LS/FS/HS USB sniffer with Wireshark interface

License: BSD 3-Clause "New" or "Revised" License

Makefile 1.20% C 71.46% Verilog 19.79% TeX 7.55%

usb-sniffer's People

Contributors

ataradov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

usb-sniffer's Issues

Request - JLPCB/LCSC BOM & CPL

For the less experienced folks (like myself) out there, would it be possible to provide a BOM & CPL suitable for use with a service like JLCPCB (which is integrated with LCSC and EasyEDA)?

LCMXO2-2000HC-5TG100C

Hello. Can I replace LCMXO2-2000HC-5TG100C with LCMXO2-2000HC-5TG100I ? LCSC has both of them but prices are 65$ vs 15$ correspondingly. Should I modify or recompile FPGA project if yes? Thank you!

Only syslog entries

I just assembled the board and followed the instructions to flash the device and get the desired speed of 40-50 MB/s - all good.

When connecting a usb device (mouse -> full speed) to the port I get data in wireshark, but no usb data, I only get "Syslog" entries. I have also tried different usb drives at high speed. Also the log stops after about about 1000 entries (only for high speed). I have selected the correct Capture Speed in wireshark.

All the devices I have tried works when connected through the usb-sniffer board.

I have also noticed I get VBUS OFF in one of the first entries as opposed to VBUS ON the examples under /doc.

Logs: wireshark.zip

Also only two LED's light up (LED 1 and LED 7), are the other LED supposed to light up?

As for the BOM I could not find the exact oscillators, but found others within 50 ppm:
DSC1001CI2-024.0000
DSC1001CI5-026.0000

The on-board LEDS

It would be useful to have through hole pad options for the on board LEDS, once the PCB is in an enclosure the LED's are no longer visible, I can obviously modify the hardware to provide these PTH holes, it's a 2 minute job, but I figure that it might be a useful thing for other people since an enclosure protects the PCB, so I figured I'd ask here to see if threres any interest in providing these pads in the origin repo. I could solder coil wire directly to the SMD pads, but my concern there would be that it would be relatively easy to rip the pad off during later disassembly if I forget about it.

The pictures here show my case design, I could put the leds on a surface on the main body or on the end caps.

Many thanks for the brilliant project!

IMG_1198
case v29

We need adaptive communication speed!

My device is compatible with HS and FS communication. It works in HS by default. When the HS handshake fails, it will automatically switch to the FS handshake.
I hope usb-sniffer can work in HS mode by default and be backward compatible with FS communication capture.
If working at a fixed communication speed, it will not meet my work needs in this case.

Are there any barriers to a MacOS version?

First, thank you for this project, this required a lot of research and work.
I see Infineon supports MacOS with the CY7C68013A MCU. You have done the heavy lifting on the FPGA, so it is a bitstream load and that seems to be through your firmware.
Are there USB requirements that are unique to MacOS?
I would just like to use my Mac with I am sniffing a connection to my Windows machine.

Thanks again for all the hard work.

Bob

Help flashing to eeprom

Hey @ataradov - I am trying to assemble this, but running into issues with the FPGA IDCODE. Is this something you have seen before? Any tips on what could be the issue?

$ ./usb_sniffer_linux --mcu-sram usb_sniffer.bin
Uploading 3187 bytes into the FX2LP SRAM
...done
$ ./usb_sniffer_linux  --mcu-eeprom usb_sniffer.bin
Error: incorrect FPGA IDCODE (0x00000000)
$

On kernel.log, I see

Jan 31 13:04:14 mbradmin-System-Product-Name kernel: [938797.213555] usb 1-6: new high-speed USB device number 25 using xhci_hcd
Jan 31 13:04:15 mbradmin-System-Product-Name kernel: [938797.361730] usb 1-6: New USB device found, idVendor=04b4, idProduct=8613, bcdDevice=a0.01
Jan 31 13:04:15 mbradmin-System-Product-Name kernel: [938797.361733] usb 1-6: New USB device strings: Mfr=0, Product=0, SerialNumber=0
Jan 31 13:04:15 mbradmin-System-Product-Name kernel: [938797.362149] usbtest 1-6:1.0: FX2 device
Jan 31 13:04:15 mbradmin-System-Product-Name kernel: [938797.362152] usbtest 1-6:1.0: high-speed {control bulk-in bulk-out} tests (+alt)
Jan 31 13:04:57 mbradmin-System-Product-Name kernel: [938840.009639] usb 1-6: USB disconnect, device number 25
Jan 31 13:04:58 mbradmin-System-Product-Name kernel: [938840.529418] usb 1-6: new high-speed USB device number 26 using xhci_hcd
Jan 31 13:04:58 mbradmin-System-Product-Name kernel: [938840.680478] usb 1-6: New USB device found, idVendor=6666, idProduct=6620, bcdDevice= 1.00
Jan 31 13:04:58 mbradmin-System-Product-Name kernel: [938840.680481] usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jan 31 13:04:58 mbradmin-System-Product-Name kernel: [938840.680482] usb 1-6: Product: USB Sniffer
Jan 31 13:04:58 mbradmin-System-Product-Name kernel: [938840.680483] usb 1-6: Manufacturer: Alex Taradov
Jan 31 13:04:58 mbradmin-System-Product-Name kernel: [938840.680484] usb 1-6: SerialNumber: [-----SN-----]

Improvement: please move GND and 3V3 vias from FPGA pins

Hi Alex, first of all thank you for this great project.

I had a hard time doing hardware debug because of these vias near FPGA pins:

image

Because I'm soldering manually with hot iron, the solder move very easily to these vias. I removed many components until I found this issue. After cutting the wire from C8 to 3V3 in the other side of the board the issue disappeared.

Maybe you could move the vias from C5, C7 and C9 too, because they also could end up causing similar issue.

[hardware]IC Obsolete

DSC6101CI2A series OSC labled Obsolete in Digikey
and IC6,IC10 are using them
IC6 using 26Mhz only have few stock in Digikey
and the 24Mhz one currently have no stock in Digikey and Mouser

any replacement?I am currently using YXC's OSC and get some problem
in HS device,the sniffer can only detect as FS,and get a lot of error
but with ./usb_sniffer --test I can get 44-45M/s

Issue with high speed devices

Hi,

I've built two boards and both works fine with low-speed and full-speed devices. However if I try to connect any high-speed device such as a android smartphone, the device cannot be enumerated (neither adb, fastboot nor serial). I checked the oscillators and they deliver 24 mhz and 26 mhz as expected, 60 mhz at the usb_clk of the usb3343. Voltage measured at vdd18 is 1.78V. Doesn't matter if the capture is on or not, the usb enumeration fails all the time and the device isn't detected.

Any ideas why the usb enumeration fails ?

usblog.zip

[BUG]usb-sniffer software cannot write firmware unless sudo in linux

In windows10(22H2 19045.3086),after driver loaded,
./usb_sniffer --mcu-sram usb_sniffer.bin cannot write firmware

got: Error: libusb_open(): LIBUSB_ERROR_NOT_SUPPORTED

with elevate(run as admin), still got same error
win

in linux,got: Error: libusb_open(): LIBUSB_ERROR_ACCESS
but sudo will work
linux

USB failing during the enumeration

Hi Alex, because that short-circuit issue under the FPGA I decided to take a different approach: starts from basic and get USB Host working first!

I soldered only the USB Host on another board (all the components of Kicad schematic page 3, the J1 connector and its resistors and IC2 regulators and its components), after that I tried to connect it to computer it was detected and almost immediately it was disconnected:

[35566.856268] usb 3-5: new high-speed USB device number 5 using xhci_hcd
[35567.072707] usb 3-5: New USB device found, idVendor=04b4, idProduct=8613, bcdDevice=a0.01
[35567.072721] usb 3-5: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[35567.224368] usbtest 3-5:1.0: FX2 device
[35567.224373] usbtest 3-5:1.0: high-speed {control bulk-in bulk-out} tests (+alt)
[35567.224434] usbcore: registered new interface driver usbtest
[35571.954145] usb 3-5: USB disconnect, device number 5
[35572.328136] usb 3-5: new high-speed USB device number 6 using xhci_hcd
[35572.544706] usb 3-5: New USB device found, idVendor=04b4, idProduct=8613, bcdDevice=a0.01
[35572.544718] usb 3-5: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[35572.545598] usbtest 3-5:1.0: FX2 device
[35572.545605] usbtest 3-5:1.0: high-speed {control bulk-in bulk-out} tests (+alt)
[35575.855084] usb 3-5: USB disconnect, device number 6

$ sudo lsusb 
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 004: ID 8087:0026 Intel Corp. AX201 Bluetooth
Bus 003 Device 003: ID 0c45:672e Microdia Integrated_Webcam_HD
Bus 003 Device 002: ID 27c6:63ac Shenzhen Goodix Technology Co.,Ltd. Goodix USB2.0 MISC
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
$

Initially I was thinking my 24MHz oscillator was faulty, because I'm using the ECS-3225MVLC-240-CN-TR that @casandra9 suggested, but I looked at CKOUT pin in the oscilloscope and it is generating 12MHz as expected.

Did you face similar issue in the past? How to debug/fix this issue?

USB high speed capture lost some packets

Hi,
I captured a device like usb printer with high speed. If I print one page with simple content, it is OK. But if I print one page with complex content,some packet lost, And some syslog message said "Hardware buffer overflow".
I have also done a transfer rate test, result is about 48MB/s.
USB 2.0 high speed can mostly reach 60MB/s, but README recommend transfer rate 40~50MB/s. If printer usb high speed transfer rate reach 60MB/s, I will always lost some packets?

Issue with high speed devices

Hi,

I've built 5pcs boards, works fine with full-speed devices.

I try to connect any high-speed device, e.g: Udisk or Card Reader。

The PC can enumeration and read/write disk, but Wireshark can't capture data.

test hardware

$ sudo ./usb_sniffer_linux --test
Starting speed test
Transfer rate: 48.05 MB/s
Transfer rate: 48.26 MB/s
Transfer rate: 48.25 MB/s
Transfer rate: 48.12 MB/s

Transfer rate: 0.00 MB/s

Hi, and thanks for this cool project. I have build the hardware and programmed the MCU und FPGA. Everything worked fine until the test procedure.
I got 0.00 MB/s at the transfer speed, and i have no clue what i can do to fix that!
Could you give me a hint?

I used 4TG100C, Transfer rate: 0.00 MB/s

I used diamonds to regenerate the jet file of 4TG100C, and initially everything was normal. However, when I tried to measure the speed, I got a result of 0 on Windows, and Linux would directly report an error.

Windows:

PS E:\USB\usb-sniffer-main\usb-sniffer-main\bin> .\usb_sniffer_win.exe --mcu-sram .\usb_sniffer.bin
Uploading 3187 bytes into the FX2LP SRAM
...done

PS E:\USB\usb-sniffer-main\usb-sniffer-main\bin> .\usb_sniffer_win.exe --mcu-eeprom .\usb_sniffer.bin
Programming 3187 bytes into the FX2LP EEPROM (SN: 443602XXXXXXXX)
...done

PS E:\USB\usb-sniffer-main\usb-sniffer-main\bin> .\usb_sniffer_win.exe --fpga-flash ..\fpga\impl\usb_sniffer_impl.jed
Programming FPGA flash
Erasing flash
Programming configuration data .....
Verifying configuration data
Programming and verifying Feature Row
Programming and verifying FEABITS
Exiting programming mode
...done

PS E:\USB\usb-sniffer-main\usb-sniffer-main\bin> .\usb_sniffer_win.exe --test
Starting speed test
Transfer rate:  0.00 MB/s
Transfer rate:  0.00 MB/s
Transfer rate:  0.00 MB/s
Transfer rate:  0.00 MB/s
Transfer rate:  0.00 MB/s
Transfer rate:  0.00 MB/s
Transfer rate:  0.00 MB/s
Transfer rate:  0.00 MB/s
Transfer rate:  0.00 MB/s
Transfer rate:  0.00 MB/s

Ubuntu 20.04:

$ ./usb_sniffer --test
Starting speed test
Error: usb_capture_callback(): 4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.