Back to setting up the Gertduino.
Where was I? Ah, yes. When we last visited, I had just managed to successfully reboot the Pi with the Gertduino onboard, after moving one of the programming jumpers.
It looks like the instructions at http://friendsoftheunicorn.net/content/gertduino-setup set up the ATmega48 first and then do the same for the ATMega328P, whereas the instructions at https://projects.drogon.net/raspberry-pi/gertduino/atmega-setup/ do it in the opposite order, a critical distinction that I did not immediately pick up. Although I haven't confirmed it, based on the forum posts that I've read my guess is that the "can't access tty" error message stemmed from setting the jumpers to program the 328 before having programmed the 48.
Oh, BTW, did I mention that once I successfully booted up the Pi with the Gertduino attached, all six of the Gertduino's on-board LEDs lit up with an attractive blue glow? I wasn't exactly expecting that, not that it's a problem or anything like that, but without having a schematic to refer to I'm unsure of why that's the default behavior.
But I've now moved the jumper back to the 328 position, and have performed avrsetup on both the 328 and the 48.
Despite having programmed the 328 first and the 48 second, things seem to now be going swimmingly. I've returned the jumpers to the 328 position, returned my seatback and tray table to the upright and locked position, and I'm ready to try and run some demo programs.
Uh oh - I have just set the jumpers back to the 328 position, and now I'm getting the blasted sh: can't access tty: job control turned off / * message.
Rats.
Time to go back to the friendsoftheunicorn site - they say that I should try this:
If you have trouble booting at this point and get a sh: can't access tty; job control turned off message then shut down, put the jumpers back for the ATmega48 and start up the Pi again.
Then type the following
avrdude -c gpio -p m48p -e
shut down, move the jumpers back to the ATmega328 position and start up again. Make sure to run avrsetup when the Pi has booted.
OK, I'll bite. This is what I get:
pi@raspberrypi ~/gertduino/avrdude $ avrdude -c gpio -p m48p -e
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e920a
avrdude: erasing chip
avrdude: safemode: Fuses OK
avrdude done. Thank you.
Now I get to shutdown, move the jumpers to the 328 position, and try again. Yep, now I can boot the Pi with the Gertduino jumpered for 328 programming. But I think that I've just wiped the ATmega48 setup. Oh dear, I guess that I'm going to have to revisit the 48 in due course.
I am certainly getting a lot of practice swapping jumpers. Too much, actually. If this goes on much longer I'm going to try replacing the supplied jumpers with a set that comes with pull-tabs, instead of giving my needle-nose pliers a workout.
I'm also getting a lot of practice shutting down, powering off, powering on, and resetting my SSH session.
Did I mention that I'm actually accessing the Pi via several different methods?
Eventually my plan is to use a headless Pi in this application. After all, the Pi is going to be embedded within the all-sky camera housing, presumably sitting outside in the weather, far from my office. Using a directly-attached keyboard and monitor will obviously be out of the question. So instead I'll be accessing the Pi over the network.
Right now I'm using a Model B Pi, with a wired ethernet connection, but once I install the Pi in the camera housing I'll be using WiFi (via a WiPi adapter) for my network access. As far as network software goes, I've been using any or all of a Putty SSH client, Filezilla FTP client, and the tightvnc remote desktop viewer to do my work. Somewhere down the road my plan is to run a web server in the Pi and build a web-based UI to control the camera - but there's a lot to be done development-wise before I reach that stage.
It's a bit of a nuisance to restart my SSH session every time that I fiddle with the jumpers and reboot the Pi, but it's worth putting up with it simply for the convenience of being able to copy and paste the Gertduino setup commands from the friendsoftheunicorn site to the command line.
But that's not the only way that I'm accessing the Pi for setting up and programming the Gertduino. I'm also using the Motorola Atrix lapdock that I picked up through eBay, both for its HDMI connection as well as its built-in keyboard and mouse pad. It took quite a bit of effort (not to mention patience - well, OK, I guess that I just did mention 'patience', didn't I) to round up the needed cables and adapters to make it all work, but that effort was well worthwhile as it's much, much easier to lug around the lapdock and its cables and adapters than it is to carry my other Pi setup (with its separate USB keyboard, mouse, and 24" HDMI display):
So, back to my Gertduino setup saga.
Following along with the friendsoftheunicorn recipe, I follow the following instructions:
Now we can try one of the demo programs.
cd
cd Gertduino
cd blink
chmod +x program_328
./program_328 blink.hex
You should see all six leds blinking fairly rapidly in sequence.
Mirabile dictu - in fact the LEDs are blinking in sequence. I wouldn't exactly call it "fairly rapidly", though - more like "fairly lazily". I have a sneaking suspicion that the difference between "rapidly" and "lazily" means that my ATmega328P is running with a 1 MHz clock instead of the 16 MHz clock, and so I'm going to have to address that sooner rather than later.
But it does mean that I can now successfully program the ATmega328P on the Gertduino board with a .hex file. So it is a milestone of sorts. Wait, who am I kidding - it's a triumph of the human spirit that I've come this far this quickly.
I think that I'm going to fix myself a hot cup of Lapsang Souchong tea (with a dollop of half-and-half), and ponder my next step(s). Well, I don't need much in the way of pondering to figure out that my likely next move is to get the Arduino IDE working with the Gertduino. But a cup of Lapsang Souchong will be good for my sanity right now, regardless.