This week, we learn how to load programs onto our newly fabbed PCBs!
There are several ways to approach this. One, we can use our Fab ISPs (after they have been "programmed as programmers" ) and work with low-level hex and C files to program a new board. To do this, we need to hook the fabISP up to our computers over the USB connection, take a cable from the fabISP to the ISP header pins on our new boards, and power our new boards (if powered separately). You can see my fabISP board below. A second way, that I had most success with, is to "burn" the Arduino bootloader onto your board one time (via a programmer, like the fabISP or commercial Atmel ICE/AVRISP mkii), which then allows you to use the Arduino IDE to subsequently load other programs just directly over FTDI connection (rather than always requiring a separate, additional programmer between your computer and the board).
Unfortunately, I got stuck this week trying to use my fabISP as the programmer. I had not successfully "programmed it as a programmer" through the final steps (got stuck on one of the fuse steps), and have decided to come back to this in a later week. For my next attempt, I tried the Arduino bootloader method.
Programming the board!
Programming Steps for ATTiny chips
Although I did not ultimately use the ATTiny for my board, I did come across this very helpful tutorial (by way of Caroline Jaffe's recommendation!) from the old "high-low tech" group at the Media Lab that explains the custom config that must be added for the Arduino IDE to recognize the ATTiny chips.
Programming Steps for ATMEGA 328p
- You will need to burn the Arduino "bootloader" onto your board. To do this, you'll need a programmer (like the FabISPs we made in a prior week, or a commerical programmer like the AVRISP mkii).
- Make sure your board is separately powered (this is usually done over FTDI), and connected to the programmer over the ISP header. Then connect the programmer to the computer where you will be working with the arduino software.
- For the arduino software to recognize the type of chip you are working with, you'll need to add a new "board" in the "boards.txt" Ardunio config files. The text to add to the file is below. These entries define a custom board, with the internal clock speed and proper fuse settings. You can determine whether you'll want different fuse settings by reading the datasheet of your processor for which bits are used in the "Low", "High" and "Extended" fuse profiles. You can check the same for unlock bits. The text below assumes you are using an ATMEGA 328p chip, which is a chip commonly found on Arduino boards (like the Uno and Pro).
hello.name=hello.arduino, ATmega328P, 5V, 8MHz internal oscillator
- With the boards.text file edited, you should now be able to select the correct board, programmer and port selection as shown in the screen shots below and then "Burn Bootloader" onto your chip.
- For additional programming help and other approaches, I recommend these pages (actually from later weeks, that I have found useful throughout the class) Yuval's and Amanda's pages, which I found quite helpful in going through this and last week's assignment.
- If your prior step was successful, you should now be able to load programs onto your chip by just using the FTDI serial connection to your board and the Arduino IDE (i.e. you no longer need a separate programmer). Test this with the Blink Sketch provided in the Ardunio Examples library. Make sure to both Compile and Upload your new code, and check to see if the LED is blinking as expected.
Is the board successfully "programmed"?
Yes! After loading the arduino blink sketch, I was able to program the board to delay, lengthen, shorten, and otherwise manipulate the digital pin 13 LED!