Simple Logic Analyzer for Teensy

This side-project started while trying to figure out oTurtlez Leading Edge DC-2014. The main purpose was simply to see what signals were output from it when, like many people, all he had was a Teensy at hand.

The Analyzer's primary use is really to assist in diagnosing problems when building my converter - you can simply load the 'portD' hex file, run hid_listen, press some keys, and copy-paste the output into the Windows app (or send it to me). Thus you can quickly see if either clock or data is dead, or if they are swapped, etc.

It can also be used more generally. The 'portB' version tracks all changes on all 8 pins of port B, while the 'portD' version tracks the state of the 8 pins of port D, but only when changes occur on PD0 to PD3. It can track changes as close together as about 1.5us, which should be enough for analyzing any keyboard related stuff. The main limit is in how the output is sent to the PC as text, so it is best suited to fairly short sequences of events (such as serial keyboard protocols!), although there is a fairly large buffer which helps.

Each sample consists of a 16-bit timestamp, the 8-bit sampled data, and a flag to indicate whether the sample was the result of a change or the timestamp wrapping past 0. Since the timebase is running at 16MHz, the resolution is 62.5ns - as long as no other interrupts get in the way! So if two transitions are more than 1.5us apart, the measured time between them will in most cases be accurate to approx +/-125ns.

IBM_PC_XT--Z_release.png


LeadingEdge--Z_release.png


Notes:
  • The portD version of sctrace outputs a keyboard reset signal on PB7 (for the Leading Edge).
  • In scla, you can zoom in by highlighting a section of the trace with the mouse left button.
  • Currently the x-axis scale is always relative to the first transition in the view.

Full source is provided. Don't laugh at the very quick and dirty nature of scla - it does the job!! The project files are for VS2003, but should easily convert to any later version. Most Windows boxes are likely to have the required DLLs (msvcr71.dll, msvcp71.dll, MFC71.dll, MFCENU71.dll) already, so I haven't included them.
Attachments
scla_v1.00_win32_exe.zip
(37.1 KiB) Downloaded 215 times
scla_v1.00_win32_src.zip
(40.43 KiB) Downloaded 127 times
sctrace_v1.01_ATmega32U4.zip
(5.17 KiB) Downloaded 185 times
sctrace_v1.01_src.zip
(18.42 KiB) Downloaded 155 times
Soarer
User avatar

Unread post08 Dec 2012, 15:33

User avatar
X
Soarer
 
Posts: 999
Joined: 03 Jul 2011, 01:03
Location: UK
Favorite switch: F
Club member: -
 
A bunch of downloads, but no replies :(

Has anyone tried sctrace recompiled for Teensy++ 2.0, and/or scla on Linux under Wine?
Soarer
User avatar

Unread post18 Jan 2014, 14:19

User avatar
X
Soarer
 
Posts: 999
Joined: 03 Jul 2011, 01:03
Location: UK
Favorite switch: F
Club member: -
 
this totally flew under my radar. thanks for your great work Soarer. I'm working on a very nice side project myself based on teensy. It's basically a switch analyzer, it presses the keys and gives a graph and a series of info regarding actuation point, weight, travel, etc... So many projects... so little time.
matt3o
User avatar
-[°_°]-

Unread post18 Jan 2014, 14:42

User avatar
X
matt3o
-[°_°]-
 
Posts: 8175
Joined: 03 Sep 2012, 15:14
Location: Italy
Main keyboard: WhiteFox
Main mouse: Anywhere MX
Favorite switch: Anything, really
Club member: 0030
 
 
This signature intentionally left blank...
Always the way :( I've got a stack of 4066 chips here waiting for a project to test/analyze keyboard controllers :evilgeek:
Soarer
User avatar

Unread post18 Jan 2014, 14:50

User avatar
X
Soarer
 
Posts: 999
Joined: 03 Jul 2011, 01:03
Location: UK
Favorite switch: F
Club member: -
 
Soarer wrote:A bunch of downloads, but no replies :(

Has anyone tried sctrace recompiled for Teensy++ 2.0, and/or scla on Linux under Wine?

I've tried both.

What works: sctrace compiled for Teensy++ 2.0
What doesn't: scla under Wine - complains about issues with DLL's even when they are present.
sethstorm

Unread post19 Jan 2014, 11:16

X
sethstorm
 
Posts: 5
Joined: 24 Jul 2012, 02:20
Main keyboard: 6110668 Terminal F ANSI w/ M13 blacks
Main mouse: Logitech G700
Favorite switch: IBM F Capacitive
Club member: -
 
You guys scare me... :? I don't understand a word of the first post apart from what that thing is meant to do. :shock:
That however is enough to say: wow, thanks you took the effort! :)
kint
User avatar

Unread post19 Jan 2014, 13:17

User avatar
X
kint
 
Posts: 585
Joined: 15 May 2012, 17:04
Location: northern Germany
Main keyboard: g80-8200/ FK-2002
Main mouse: genius netscroll optical gen1
Favorite switch: MX clear/ Alps white comp
Club member: -
 
Yeah, but... pretty colourful pictures :lol:

Right, I just tried installing Wine on Linux Mint 14 (nadia), and at first scla.exe didn't run due to missing MFC71.dll.
The solution is to run winetricks and install vcrun2003 :ugeek:
Soarer
User avatar

Unread post19 Jan 2014, 13:51

User avatar
X
Soarer
 
Posts: 999
Joined: 03 Jul 2011, 01:03
Location: UK
Favorite switch: F
Club member: -
 
Sorry for the necro bump but I am attempting to use this to reverse engineer an odd ball F and I am getting output from the teensy with hid_listen but am not getting anything in scla. I am running this on a laptop with XP SP3 as my windows 8 rig lacked the requisite dll file.
Rotti

Unread post22 Dec 2014, 20:56

X
Rotti
 
Posts: 61
Joined: 17 Feb 2013, 20:24
Location: Iowa, USA
Main keyboard: F XT
Main mouse: Razer Naga Epic
Favorite switch: Buckling spring over PCB
Club member: -
 
Soarer's been offline since summer, so don't hold your breath on an answer. It is an interesting project though, like so much of his stuff.
Muirium
User avatar
µ

Unread post22 Dec 2014, 21:16

User avatar
X
Muirium
µ
 
Posts: 22409
Joined: 03 Feb 2013, 10:11
Location: Edinburgh, Scotland
Main keyboard: IBM 4704 Kishsaver
Main mouse: Apple Magic Trackpad
Favorite switch: Gotta Try 'Em All
Club member: -
 
 
Muirium wrote:Soarer's been offline since summer, so don't hold your breath on an answer. It is an interesting project though, like so much of his stuff.

Yeah I have noticed his absence on GH as well. Its a shame with the quality of his work. I hope everything is fine on his end.

I did notice that matt30 and sethstrom might have had some luck with it and was hoping one of those two could chime in.
Rotti

Unread post22 Dec 2014, 22:02

X
Rotti
 
Posts: 61
Joined: 17 Feb 2013, 20:24
Location: Iowa, USA
Main keyboard: F XT
Main mouse: Razer Naga Epic
Favorite switch: Buckling spring over PCB
Club member: -
 
FWIW, I'm planning to dust this off and test it out once my Pro Micro (ATMEGAu32) boards arrive.

Come back Soarer!
XMIT
User avatar
[ XMIT ]

Unread post25 Mar 2015, 16:40

User avatar
X
XMIT
[ XMIT ]
 
Posts: 3144
Joined: 21 Dec 2014, 15:32
Location: Austin, TX, USA
Main keyboard: XMIT Hall Effect
Main mouse: Logitech Marble Mouse
Favorite switch: XMIT 50g Hall Effect
Club member: 0093
 
Did you ever got around that XMIT ? I've got a space invaders that needs figuring out and only got pro micro's available.
gogusrl
User avatar

Unread post01 Nov 2015, 09:54

User avatar
X
gogusrl
 
Posts: 1176
Joined: 13 Sep 2014, 09:21
Location: Romania
Main keyboard: Cherry G80-1851
Main mouse: Logitech G9x
Favorite switch: linear stuff
Club member: 0168
 
Nothing yet, sorry. I ended up buying some Saleae clones for my logic analyzer needs.
XMIT
User avatar
[ XMIT ]

Unread post01 Nov 2015, 10:34

User avatar
X
XMIT
[ XMIT ]
 
Posts: 3144
Joined: 21 Dec 2014, 15:32
Location: Austin, TX, USA
Main keyboard: XMIT Hall Effect
Main mouse: Logitech Marble Mouse
Favorite switch: XMIT 50g Hall Effect
Club member: 0093
 
Was anyone able to get this to work I am in the same state as Rotti. I can see data on hid_listen but no data in scla. If only I understood what hid_listen was printing I could just use that data and forget about scla. Looking at the scla source code that is posted, it does not seem to do anything. There isn't any interesting code that would be interpreting the data from usb and displaying the graphs.
inyourgroove
User avatar

Unread post22 Feb 2016, 22:40

User avatar
X
inyourgroove
 
Posts: 8
Joined: 18 Jan 2016, 23:04
Location: California, USA
Main keyboard: KBP V80, IBM Model M
Main mouse: M510
Favorite switch: BS
Club member: -
 
So I need to read more carefully. The OP says to copy paste the output of hid_listen into scla. Once you know to do that it works great.
scla.png

Seems I have my clock and data lines reversed.
inyourgroove
User avatar

Unread post23 Feb 2016, 01:26

User avatar
X
inyourgroove
 
Posts: 8
Joined: 18 Jan 2016, 23:04
Location: California, USA
Main keyboard: KBP V80, IBM Model M
Main mouse: M510
Favorite switch: BS
Club member: -
 

Who is online

Users browsing this forum: Ir0n, llliiili, takthemon and 50 guests