Raspberry Pi Stand-Alone Programmer
Lessons Learned - As a Raspberry Pi Newbie
I had not used a Raspberry Pi for any project before this and wow, was I surprised at how awesome they are! It took me a little while to get used to doing so much work in command line (the file permissions stuff was painful at first), but once I started typing
sudo in front of everything, I was up and running! Here are some tips that I would recommend to any newbie to Raspberry Pis. There is so much more so learn, and it's usually only a Google search away. I hope these will come in handy.
Superuser Do -- Use “
sudo” in front of every command.
Pi GPIO -- GPIO control/read in python rocks. Check out the tutorial here.
"Batch" Files -- “.sh” files on a Pi are like “.bat” files in MSDOS.
Useful Command -- "
sudo killall python" is very handy. "
sudo killall avrdude" also! This ended up being a key ingredient for fixing a sneaky little problem that popped up later in production.
Invisible Characters -- Don’t edit files on a windows machine. The darn invisible characters (NL and CF). Grimlens I tell you!! Some really strange behavior happens when these extra invisible characters exist in the pi_program.sh file.
I eventually just committed to editing all files on the Raspberry Pi to avoid these problems. The built-in text editor is pretty nice. One of my staff on the QC team is way into VIM, and can rock some serious shortcuts.
Headless Pis -
rc.localis a pretty cool way to launch some stuff on bootup. We call a python module called test.py for all of our programming needs. You could really put any commands in there that you want. We find this really handy because we run these Pi_grammers in production without a monitor, keyboard or mouse - “headless” as they say.
Serial Upload Timeout -- If something is wrong during a serial upload, avrdude can take FOREVER to timeout. This can look like the headless pi is frozen. We eventually fixed this by taking a snapshot of the upload_results.txt file, parsing it, and then calling "
sudo killall avrdude" if it looked like it was gonna fail.
** Hardware SPI** -- Opening up SPI lines in
raspi-config. Check out the tutorial here.
Keyboard to US English -- Beware, there are oh-so-many windows to click/select through, but eventually you can have a standard English US keyboard if you like. It's in
GPIO Drive/Sink Limitations -- Beware that there are I/O pins that cannot drive/sink an LED. On a my first proto of the HAT, I chose some I/Os that weren't good for LEDs, and had to swap them out. I still don't have a definitive list, but I do know for sure that the 9 GPIOs on the current design work great!