AVR Pong – Peggy2 & Danger Shield

This post should really be titled “AVR Pong, and some other non-firsts”.


I saw the Peggy2LE and decided that it was something that I just had to have. I mean, 625 LEDs on one board can’t be bad, right? Well at least that was what I thought, until I tried to solder 1250 LED leads in one night.


Anyway, to make a point out of this, I decided to make a Pong game, using the Peggy2 and a Danger Shield courtesy of Little Bird Electronics

So why is this interesting? Well there are somes significant firsts in there for me.

  1. Not just multi tasking (using freeRTOS), but real multi-processing using 2 AVR devices. The two AVRs communicate using the I2C bus.
  2. Developing an I2C code base that can simultaneously be Master and Slave, and is interrupt driven. I hope that the code can do MultiMaster too, but I haven’t fully tested it.
  3. Building a robust efficient video transfer protocol between the game mechanics AVR and the video (Peggy2) AVR. Using prioritised row updating and a CRC8, which I think it is pretty robust.
  4. Building a buzzer routine that can play melodies, with real notes, again fully interrupt driven, using Timer 2 (the Danger Shield buzzer is connected to PD3).

None of these things are original. In fact most of the code is borrowed from elsewhere, and the sources can be found in the files. But, I’m pretty stoked to have made it all work together, under freeRTOS. Small things, as they say, amuse small minds.

Code at AVRfreeRTOS at Sourceforge.

Updates with more detail when it is not so late.