A Teensy Logic Analyzer For A 6502

[John] has an interesting, if old piece of tech sitting on his workbench. It’s an Ohio Scientific C3-8P computer from the late 70s by way of a few garages, basements, and attics. As with most tech of this vintage, there are some problems, and [John] found debugging a little frustrating without the ability to trace and watch the programs. He needed a logic analyzer, and found one in an unlikely piece of hardware. [John] built one using a Teensy microcontroller, and further refinement of this project could turn it into a full in-system emulator.

The old Ohio Scientific computer [John] is trying to bring back from the dead is based on the 6502 CPU. That’s sixteen address lines to monitor, eight data lines, and four control lines. These were wired directly to a Teensy 3.1.

Reading and controlling all the signals from a 6502 is a task that falls to Linux. A command line program controls the Teensy and is capable of reading memory, setting trigger addresses, dumping the entire address space to a file, or just recording the last 5,000 clock cycles. This kind of tech existed back in the late 70s and early 80s. It also cost a fortune. Now, with a $20 Teensy and probably another $30 in ribbon cables and test clips, anyone can build a logic analyser for a very old computer system.

Videos below.

Continue reading “A Teensy Logic Analyzer For A 6502”

Hackaday Links: September 27, 2015

Many moons ago, [Joe Grand] built an adapter that turns Atari 2600 joysticks to USB controllers. Now it’s open source.

Hackaday Overlord [Matt] is holding an SMT and BGA soldering workshop in San Francisco on October 4th. Teaching BGA soldering? Yes! He made a board where the BGA balls are connected to LEDs. Very, very clever.

Our ‘ol friend [Jeremey Cook] built a strandbeest out of MDF. It’s huge, heavy, about the size of a small car, and it doesn’t work. [Jeremy] has built beests before, but these were relatively small. The big MDF beest is having some problems with friction, and a tendency to shear along the joints. If anyone wants to fix this beest, give [Jeremy] a ring.

Everyone loves the Teensy, and [Paul] has released his latest design iteration. The Teensy 3.2 isn’t that much different from the Teensy 3.1; the bootloader has changed and now USB D+ and D- lines are broken out. Other than that, it’s just the latest iteration of the popular Teensy platform.

The DyIO is a pretty neat robotics controller, a semifinalist for the Hackaday Prize, and now a Kickstarter. The big win of the Kickstarter is an electronics board (with WiFi) that is able to control 24 servos for all your robotics needs.

[pighixxx] does illustrations of pinouts for popular electronics platforms. Everyone needs a hobby, I guess. He recently put together an illustration of the ESP8266. Neat stuff is hidden deep in this site.

You would not believe how much engineering goes into making snake oil. And then you need to do certifications!

[David] identified a problem, created a solution, got a patent, and is now manufacturing a product. The only problem is the name.

1-Pixel Pacman

I usually see retro-gaming projects using tiny screens with a fair number of pixels (64×64) but what I really like is the look of making every pixel count. With this in mind I built 1-Pixel Pac-Man, the classic coin-op experience but with characters that consist of just one pixel. Playing a throw-back like this wouldn’t be the same without some vintage controls so I picked up an Atari joystick, patched it into a microcontroller, and started coding. Check it out:

Smartmatrix Bundle

This piece of hardware made the project build really easy: the Smartmatrix. [Louis Beaudioin] developed the Smartmatrix and it’s been in the Hackaday Store for a while now. The display module itself is a commodity item that is used in LED billboards. There are shrouded headers on the back of the panels, to the left and right sides, which allow them to be daisy chained. The Smartmatrix PCB plugs into one of these shields, provides a soldering footprint for the Teensy 3.1 which drives the display, and gives you the wiring to connect screw terminals from the PCB to the power terminals on the module. Why the need for beefy power jumpers? At full white the thing can draw about 3.5A — don’t worry there’s a power supply included in the bundle.

Also integral to making this look good is the diffuser panel which is frosted acrylic. The Smartmatrix is designed to be housed in a shadowbox frame; it even includes a frame backer board with a cut-out for the Teensy 3.1 so it can be programmed without opening the thing up. I like looking at the guts so I’m leaving my free floating until I come up with an interesting way to mount everything as one unit.

Programming Pac-Man from the Ground Up

matrix-man-code

If you haven’t looked into it before, the ghost AI and gameplay details for Pac-Man are absolutely brilliant. [Toru Iwatani] did a masterful job with the original, and you should take a look at all of the analysis that has been done over the years. The best collection I could find was the Pac-Man Dossier and I based most of my code on the rules described there.

Basically the ghosts have two modes, chase and scatter. The modes set the enemy targets differently; to points at the four corners of the board in scatter, and to points relative to the player in chase. The relative part is key; only the red enemy actually chases you. Another one of them looks at the red enemy’s distance and angle, and targets the reflection of that vector. Really easy, really clever, and results in enemy behavior that’s believable. It isn’t just the enemy movement, little touches like a speed penalty (1/60 of a second) for each dot the player gobbles up means the enemies can catch up if you continuously eat, but you can escape by taking the path already-eaten.

Library, DMA, and Extra Hardware

The hardware and software running the Smartmatrix made the display portions of the project really simple. First off, the Teensy 3.1 is fast, running at 96MHz in this case. Second, it has Direct Memory Access (DMA) which [Louis] used in the Smartmatrix library. This means that driving the display takes almost no CPU time at all, leaving the rest for your own use. This example of a game is under-utilizing this power… it’s totally capable of full-motion video and calculating amazing visualizations on the fly.

The PCB hosting the Teensy 3.1 breaks out several pins to one side. I’m not sure what I’ll add in the future so I actually used the extra surface-mount IO pins on the bottom of the Teensy to connect the Atari joystick (which is simply a set of switches). The are enough pads for two joysticks so I used pin sockets to interface the Teensy to the PCB so that I can get to it again later.

The kit also includes an IR receiver and remote, and also a microSD card to loading animations (there’s an SD socket on the PCB). The bundle in the Hackaday Store is a kit you solder yourself, but [Louis’] company, Pixelmatix, has a Kickstarter running for fully-assembled versions that come with a black remote and sound-visualization hardware.

Future Improvements

The game is fully working, but there are a few key things that I really want to add. The Teensy 3.1 has a single DAC pin available. I’m fairly certain the original coin-op game had mono audio. It should be possible to reproduce the sound quite accurately with this board. That would really make the project pop.

There are also a bunch of touch-ups that need to happen. I’d like to add an animation when the player is eaten by an enemy, and a countdown before the level restarts. The score, shown in binary on the right column, should be scrolled out in decimal when the game ends, and what’s a coin-op recreation without a high-score screen?

Improving Active Loads

[Texane]’s job requires testing a few boards under a set of loads, and although the lab at work has some professional tools for this it seemed like a great opportunity to try out the Re:load 2. It’s a nifty little active load that’s available can of course be improved with an injection of solder and silicon.

While the Re:load 2 is a nice, simple device that can turn up to 12 Watts directly into heat, it’s not programmable. The ability to create and save load profiles would be a handy feature to have, so [Texane] took a Teensy 3.1 microcontroller and installed a resistor divider in front of the Re:load’s amplifier. A simple script running on a computer allows [Texane] to set the amount of current dumped and automate ramps and timers.

There is a more fundamental problem with the Re:load; the lowest possible current that can be dumped into a heat sink is 90mA. [Texane] replace the amplifier with a zero-drift amp that brought that 90mA figure down to 7mA.

Of course the Re:load and Teensy 3.1 are sold in the Hackaday store, but if you’re looking for a ready-built solution for a computer-controlled active load you can always check out the Re:load Pro, a fancy-smanchy model that has an LCD. The Pro costs more, and [Texane] just told you how to get the same features with the less expensive model we’re selling, though…

An RGB Word Clock, Courtesy Of WS2812s

A word clock – a clock that tells the time with illuminated letters, and not numbers – has become standard DIY electronics fare; if you have a soldering iron, it’s just what you should build. For [Chris]’ word clock build, he decided to build an RGB word clock.

A lot has changed since the great wordclock tsunami a few years back. Back then, we didn’t have a whole lot of ARM dev boards, and everyone’s grandmother wasn’t using WS2812 RGB LED strips to outshine the sun. [Chris] is making the best of what’s available to him and using a Teensy 3.1, the incredible OctoWS2812 library and DMA to drive a few dozen LEDs tucked behind a laser cut stencil of words.

The result is blinding, but the circuit is simple – just a level shifter and a big enough power supply to drive the LEDs. The mechanical portion of the build is a little trickier, with light inevitably leaking out of the enclosure and a few sheets of paper working just enough to diffuse the light. Still, it’s a great project and a great way to revisit a classic project.

The Teensy LC. LC Means Low Cost.

For one reason or another, we’ve been seeing a lot of builds featuring the Teensy 3.1 filtering in on the tip line recently. In retrospect, it’s somewhat obvious; it’s a good board that’s cheap and fast. Yes, somehow [Paul] hit all three in the good/cheap/fast mutually exclusive triumvirate.

Now, there’s a new Teensy. It’s the Teensy LC – Low Cost. It’s not as powerful as the Teensy 3.1, but it does give you the power of an ARM for something that’s just about as cheap as a board with an ATMega.

The chip [Paul] chose for the Teensy LC is the Freescale MKL26Z64 (datasheet here and 876-page reference manual here. PDFs of course). This is a 32-bit Cortex-M0+ running at 48 MHz with 64k of Flash and 8k of RAM. There are 27 digital I/O pins on this one, and the Teensy LC has been designed to be pin-compatible with the Teensy 3.0 and 3.1.

On board are 13 analog inputs, 8 PWM outputs, on 12-bit DAC output, three serial ports, two SPI ports, and two I2C ports. Most of the pins can drive 5mA with a few capable of driving 20mA, and there is a single 5v output pin for driving WS2812 Neopixel LEDs.

Since this is a cut-down version of the Teensy, everything available on the Teensy 3.1 just can’t fit into the BOM of the Teensy LC. The pins aren’t 5V tolerant, there’s no CAN bus, and there are only 4 DMA channels instead of 16 on the Teensy 3.1. Still, it’s a great ARM answer to the ATMega Trinket or other small dev boards.

Casing Up The Teensy SDR

[Rich, VE3MKC] has made a lot of progress on his Software Defined Radio (SDR) which is based on a Teensy. His latest update shows off the hardware in an enclosure and a few new features.

When we looked at this in April of last year it was pretty much a proof-of-concept with components hanging loose from jumper wires. The new case mounts everything securely in a plastic Hammond enclosure with copper clad for the front and rear panels. The SoftRock SDR unit was yanked from its case and retrofitted with connectors to make it swappable for other units.

A little help goes a long way and [Rich] thanks his friend [Loftur, VE2LJX] for contributing numerous code improvements and feature additions which can be viewed in the repository. Check out the video below where these features are shown off.

In its present state the radio draws 80 mA at 12V in receive mode. It doesn’t transmit yet but we’ll keep our eyes open for another update on that. [Rich] plans to populate the input circuitry and write the transmit code next.

Continue reading “Casing Up The Teensy SDR”