So I'm still banging my head against the difficulty of making a simple serial connection between my Raspberry Pi and an ATMega chip on a daughter board. And I still have not got it working properly.
Overnight it occurred to me that I ought to have turned off the serial port login on the Raspberry Pi. I'm sure this was getting in the way and confusing things, so I followed some steps I found from a quick Google search.
Next, I have begun to distrust my soldering, and continually messing with the serial wiring is not doing the rest of the joints much good, so it was back to a breadboard to try and work out what was going on. I quickly built the circuit from last time, and tested it by running the Arduino GUI on the Pi and re-burning my test program: a version of the ASCII table example which repeatedly generates the table, waits for half a second then does it all again. This time I have also added a new feature. I switch on "Pin 13" when I am sending data, and switch it off while waiting, so that I can visually confirm that the program is running just by attaching a LED.
With the Pi and Duino connected, at least enough to report a success in programming, I attached the LED and saw it happily flashing away. Good!
Now time to try the terminal. I started Microcom on the Raspberry Pi using
sudo microcom -p /dev/ttyAMA0 -s 9600 and at last saw something. Not useful characters, mind, but something. It seems there is a problem with the baud rate of the text.
I tried a few other baud rate settings, but with no extra clarity. I then plugged in my Saleae Logic, and set it to "auto baud rate". It had a think, then showed that it had found valid characters at a baud rate of 13157 baud. This is a very weird speed, and nothing like the 9600 baud the code claims it is using. This made me think, so I also measured the supposedly 500ms wait between characters and saw that it measures as roughly 350ms, a long way off from what I would expect.
This hints to me that there is something wrong either with the crystal clock or with the way the AVR has been set up to expect a different clock frequency. While writing this it suddenly occurred to me that maybe my "boards.txt" setting was wrong. I guess the Gertboard uses a 12MHz crystal or something, because when I looked back at my settings, there it was:
The MCU is set to think it has only a 12MHz clock, when it actually has a 16MHz crystal. That'll teach me for blindly copying someone else's config file :(
Now I just need to put everything on my proto-board back where it should be, and see if I can finally get serial communication to work.