From: Gareth M. <ga...@bl...> - 2011-10-26 09:39:53
|
Hi All As some of you know from IRC, I've been trying to capture a full-speed USB frame with Sigrok and the Openbench Logic Sniffer. My OLS is v1.04 (on the board silk-screen). If there's a way to read firmware version, I don't know it. It's as it ships from Seeed studio. I'm using two computers, both running Ubuntu 10.10, Linux 2.6.35-30. One is the host connected to the OLS, running Sigrok, the other is connected to a target USB device-under-test. The device is an STM32F105, running the HID demo from libopenstm32. I've cut the USB cable to connect the logic probes. Probe 1 is connected to the USB D- line, and probe 2 to D+. No special probes have been used. Just wires connected directly to the OLS. The bitrate on the wire is 12Mbit/s, so I want to sample at 48MHz. I first used this command line to capture to a file: sigrok-cli -d 0:samplerate=48MHz --time 1ms -p 1,2 > dump Decoding this dump with my eyeballs and an ascii viewer found two identical SOF packets in the output. I've since added code to the firmware on the STM32 to toggle a line in the interrupt handler when a USB start-of-frame (SOF) is received. This signal is now connected to OLS probe 3. This was added to allow me eliminate the possibility that the frame was not actually transmitted twice. >From recommendations I've also switched to binary output from Sigrok, and I've written a really rough python script (attached) to extract and partially decode USB packets from the Sigrok output. My command line has been amended to: sigrok-cli -d 0:samplerate=48MHz --time 1ms -p 1,2,3 -f binary | python usbdec.py I've also attached a typical binary dump that contains three repeated packets. The repeated sequences always appear to be 24576 samples apart. The output from my script is as follows: gareth@gareth-desktop:~/Projects/sigrok$ python usbdec.py dumpbin Trigger! i = 3079, frame = 0 Packet: KJKJKJKKKJJKJJKKJKJKJJKKKKJKKJJKSE0SE0 : 00000001101001010000010111001010 : SOF 00000101110 Trigger! i = 3242, frame = 0 Packet: KJKJKJKKKJKKJJJKJJJKJKJJKJKJKKJKSE0SE0 : 00000001100101100110000100000100 : IN 01100001000 Trigger! i = 3407, frame = 1 Packet: KJKJKJKKJJKKKJJKSE0SE0 : 0000000101011010 : NAK Trigger! i = 27655, frame = 0 Packet: KJKJKJKKKJJKJJKKJKJKJJKKKKJKKJJKSE0SE0 : 00000001101001010000010111001010 : SOF 00000101110 Trigger! i = 27818, frame = 0 Packet: KJKJKJKKKJKKJJJKJJJKJKJJKJKJKKJKSE0SE0 : 00000001100101100110000100000100 : IN 01100001000 Trigger! i = 27983, frame = 1 Packet: KJKJKJKKJJKKKJJKSE0SE0 : 0000000101011010 : NAK The number following the 'SOF' above is the USB frame number (LSB first). This should increment on every transmission, and we should only get one transmission in a 1ms interval. Monitoring the SOF toggle signal on probe 3 using a 'scope shows a frequency of 500Hz, so this is the case. This appears to be a bug in either Sigrok or the OLS, possibly resulting from limited buffer capacity. Any help would be appreciated. Thanks and regards, Gareth -- Black Sphere Technologies Ltd. Web: www.blacksphere.co.nz Mobile: +64 27 777 2182 Tel: +64 9 478 8885 Skype: gareth.mcmullin LinkedIn: http://nz.linkedin.com/in/gsmcmullin |