2
\$\begingroup\$

I'd like to reverse-engineer a certain 2-wire digital circuit. I'm looking for the cheapest possible logic analyzer. I don't know the exact frequency of the circuit, but it's sub-1MHz. (Likely in the range of 50kHz-500kHz.)

Obviously, I've heard about Bus Pirate, but I thought - hey, why not just use a serial port on my laptop? I have a UART-to-USB dongle based on a FT232-family chip, which is supposed to work with non-standard baud-rates, up to 1Mbd and beyond (depending which specific model you look up).

There are two challenges I can immediately see:

  1. Voltage. I assume a simple two-resistor voltage divider will suffice?
  2. Clock. Since I don't know the subject baud rate, I won't see the proper signal immediately. Maybe I could oversample initially and figure out the actual frequency from the observed signal?
\$\endgroup\$
  • \$\begingroup\$ FTDI chips, even FT232 have a bitbang mode, which you may be able to use to sample a digital signal at a specified rate. However, you would likely have to write your own software, and I'm not sure you can sample continuously over time. but if you have much more time than money, or much more sense than money, it could be worth trying over buying something like a Bus Pirate. \$\endgroup\$ – nitro2k01 Mar 31 '15 at 18:40
5
\$\begingroup\$

There's more to serial than just the baud rate. RS-232 is a framed protocol. That is, each byte of data is framed by identifying markers - namely the start and stop bits. Only when a valid RS-232 packet delineated by these marker bits has been detected will it be sent to your laptop as a valid byte.

Unless your unknown data stream happens to be RS-232 in its format the FT232 chip won't be able to identify valid packets and thus won't be able to tell you what's going on.

There are other FT* chips available that can work with arbitrary data streams or raw IO pins, and you may be able to find a chip that is a suitable match, but finding one in a simple to use dongle may be more tricky.

You really want something more generic, like a Bus Pirate, but in fact anything which is able to inspect the state of digital signal lines fast enough and convert that into a form the computer can read (USB) would do the job.

I often use a generic microcontroller based board to do the job (I use 80MHz PIC32MX or 200MHz PIC32MZ chips and the chipKIT platform mostly). These boards have the advantage that you can use them for other things as well. Arduino is popular, but the low end ones may be a bit slow for reliable sensing without using fancy tricks (interrupts etc).

\$\endgroup\$
  • \$\begingroup\$ One can try to use the control signals of UART with some custom timing. But it will be a mess. \$\endgroup\$ – Eugene Sh. Mar 31 '15 at 14:53
  • \$\begingroup\$ @EugeneSh. And also possibly too slow for reliable sensing. \$\endgroup\$ – Majenko Mar 31 '15 at 14:54
  • \$\begingroup\$ Thank you for an immediate answer! :) Would a Raspberry Pi GPIO do the job? (I have a RPi somewhere at home.) EDIT: No! RPi GPIO is too slow. \$\endgroup\$ – Billy Bob Mar 31 '15 at 15:02
  • \$\begingroup\$ Well, it turns out, if you use the right software, maybe RPi GPIO can work?! codeandlife.com/2012/07/03/benchmarking-raspberry-pi-gpio-speed \$\endgroup\$ – Billy Bob Mar 31 '15 at 15:32
  • 1
    \$\begingroup\$ An RPi is certainly a possibility, yes. Especially if you run your analysis software direct on the Pi so you don't have any issues of transferring the data fast enough to your PC. \$\endgroup\$ – Majenko Mar 31 '15 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.