8-bit SPI Video for ATmegas

[ Home ]


There is a slight problem with generating video with the SPI bus on an ATmega - every byte sent has a single clock cycle delay between them. This makes it impossible to make a uniform display when displaying things like graphics (alternating patterns are the worst offender). This solution fixes it by setting the SPI bus to slave mode and running the SCK input off a timer output set for CTC/toggle mode. The main problem is enabling the SPI bus and sending the first byte to it at the correct time. Not doing so will cause the display to go blank.

Source code (avra assembler): spivideo.asm

Schematic for an ATmega324PA (excluding clock and power sources)
Note: To connect an ISP dongle to this, you must connect MOSI to ground through a resistor, not directly.

Video output in 40 column mode

Video output in 80 column mode