Secons Microvga dumb terminal.

I got my MicroVGA in the mail today. After quite a lot of mucking around I got it to work.

Wiring:

uVGA
Pin
1 GND     Arduino GND
2 +5V     Arduino +5V
3 +3V3 output NOT CONNECTED
4 /SS     Arduino Digital 10
5 SCK     Arduino Digital 13
6 /RDY    Arduino Digital 9
7 MISO    Arduino Digital 12
8 MOSI    Arduino Digital 11

Switch to SPI mode

Plug in a PS2 keyboard (it only goes into one socket), power up the device, and short the "setup" pad (on the edge near the keyboard socket) with a screwdriver. It should enter "setup" mode.

  • Select "Communication -> SPI Mode"
  • Hit Enter
  • (Note, if you go back in 1000000 baud is still selected, that is the default, not the current mode)
  • Select "Save settings"
  • Wait for confirmation
  • Power device off (unplug Arduino from power)

Sketch

// MicroVGA demo
// Author: Nick Gammon
// Date: 16th April 2012
// Licence: Released into the public domain.

#include <SPI.h>
const byte readyPin = 9;
const byte ssPin = 10;

void setup()  
{                
  SPI.begin ();
  pinMode (ssPin, OUTPUT);
  SPI.setDataMode (SPI_MODE1); 
}  // end of setup

// send a byte to the uVGA
void sendByte (const byte c)
  {
  // wait till device ready
  while (digitalRead (readyPin) == HIGH)
    {}  
  SPI.transfer (c); 
  }  // end of sendByte
  
// send a null-terminated string to the uVGA
void sendString (const char * str)
  {
char c;
  digitalWrite (ssPin, LOW);   // select device
  for (const char * p = str; c = *p; p++)
    sendByte (c);
  digitalWrite (ssPin, HIGH);  // deselect 
  }  // end of sendString
  
const char messageStr [] = "Hello, world!\r\n";

void loop()                     
{
  sendString (messageStr);

  char buf [30];
  sprintf (buf, "Time elapsed: %ld\r\n", millis ());
  sendString (buf);
  
  delay (200);
}  // end of loop

Tricky aspects:

  • The device samples the SPI signal on high-to-low transition of SCK which is SPI mode 1.
  • You must check the "ready" pin before sending or data will be lost