Tag Archives: debug

Dual port RAM interface debugs NES games

While writing a game for his old-school NES console, Andrew Reitano realized that live debugging on real hardware would definitely be a step up from the usual software-based fare.

The original solution? Firing variable information out the second controller port to serial every NMI. However, Reitano ultimately decided to take a shot at designing a new Atmel-powered PCB to interface with the console.

“The board routes the left port of the dual port RAM (Cypress CY7C136) to the DIP footprint on the NES and the right port to an AVR (ATmega164 MCU), this allows me to read and write any location at runtime without bus conflicts,” Reitano explained in a recent blog post.

“Control is provided through the UART and two additional pins are soldered directly to the 2A03 to control /NMI and /RESET. AVR control code was written mainly in C with some assembly sprinkled across for the memory control portions.”

The ATmega164 – tasked with “waiting” for serial commands – performs a number of functions including:

  • Read/write of any memory location
  • Quick dump of an entire 256-byte page
  • Freezing of memory addresses (rewriting a single value constantly in the busy loop)
  • Single frame stepping by controlling the NMI
  • Remote reset of console
  • Applying auto increment to tables to a single variable (fun for sine waves on x/y positions)

“[I] had pretty great results with using 250000 baud with the Genesis flasher project which is plenty fast for what I’m trying to do here,” he added. “As far as I can tell from the datasheet leaving CE low shouldn’t have an effect on the opposite port but it most certainly does. Next revision could definitely use a few pullups on the AVR side, other than that I’m pretty happy with the layout.”

Interested in learning more? You can check out the project’s official page here.

ATmega328 external serial monitoring – sans PC



Serial monitors are typically used to help Makers and engineers more easily debug their projects.

However, as HackADay’s Will Sweatman notes, traditional serial monitors require a PC or laptop loaded with a terminal program.

“Most of the time this is not an issue, because the PC is used to compile the code and program the project at hand,” Sweatman explained.

“But what if you’re in the field, with a mission of fixing a headless system and in need a serial monitor? Why lug around your PC when you can make your own external serial monitor?”

And that is precisely why ARPix designed a barebones, albeit fully functional serial monitor around Atmel’s versatile ATmega328 microcontroller (MCU) and a 102 x 64 LCD display.

Although the minimalistic platform lacks a keyboard port like some other external monitors, tact switches facilitate access to the user interface (UI) for start and stop commands. As expected, the tact switches can also be used to set the baud rate.

Interested in learning more? You can check out the project’s official Instructables page here, which offers the relevant sketches and parts list.