Design Files
Group Assignment
Arduino’s and other microcontrollers come pre-programmed to accept code and be recognized by the computer. When making your own microcontroller, you need to programme this yourself. You can either buy a programmer or make your own which is shown below.
This is the first time I've done surface mounted soldering so I used this video to get some tips:
Most of the Surface Mounted (SMD) components hadn’t arrived in time for this weeks tasks, so I used through hole components. There were no holes in the board, so I soldered the components on to the pads as if to do surface mounting.
When the SMD components arrived, I remade the board and with the extra practice managed to do the soldering neater.
The resonator didn’t fit the first board, so I removed some pads with a craft knife and used wire to connect to the centre pad on the resonator - messy but it worked. On the next board I edited the traces to fit the resonator.
It was fiddly to get to the connections of the Micro USB plug, so I snapped off the back plate with pliers. Also removed the two locator pins underneath the plug with pliers, so it lay flat on the board. I shorted two of the pins on the Micro USB plug and used desoldering braid to remove. It was very fiddly.
This step is based on the instructions from http://archive.fabacademy.org/archives/2016/doc/programming_FabISP.html. (I'm using the Mac operating system but there are also instructions for Windows and Ubuntu and earlier versions of MacOS).
Open Terminal and locate the folder that the firmware is saved in:
cd ~/Desktop/
Unzip the firmware:
unzip fabISP_mac.0.8.2_firmware.zip
Open the unzipped folder:
cd ~/Desktop/firmware
Power the board
Open the MakeFile in a text editor. Edit the following two lines ...
... by removing the "#" at the beginning of the line with "usbtiny" in it and adding a "#" to the beginning of the line with "avrisp2" in it.
Save the Makefile
Programming the boardIn terminal locate the firmware. The following command is if the firmware is saved on the desktop:
cd Desktop/fabISP_mac.0.8.2_firmware
Compile the firmware:
make clean
If successful, you will get this response:
[ln-mowifi-02-10:fabISP_mac.0.8.2_firmware poppy-laptop$ make clean
rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex
main.elf *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s
Type:
make hex
If successful, you will get this response:
[ln-mowifi-02-10:fabISP_mac.0.8.2_firmware poppy-laptop$ make hex
avr-gcc -Wall -Os -DF_CPU=20000000 -Iusbdrv -I. -DDEBUG_LEVEL=0
-mmcu=attiny44 -c usbdrv/usbdrv.c -o usbdrv/usbdrv.o
avr-gcc -Wall -Os -DF_CPU=20000000 -Iusbdrv -I. -DDEBUG_LEVEL=0
-mmcu=attiny44 -x assembler-with-cpp -c usbdrv/usbdrvasm.S -o usbdrv/usbdrvasm.o
avr-gcc -Wall -Os -DF_CPU=20000000 -Iusbdrv -I. -DDEBUG_LEVEL=0
-mmcu=attiny44 -c usbdrv/oddebug.c -o usbdrv/oddebug.o
avr-gcc -Wall -Os -DF_CPU=20000000 -Iusbdrv -I. -DDEBUG_LEVEL=0
-mmcu=attiny44 -c main.c -o main.o
avr-gcc -Wall -Os -DF_CPU=20000000 -Iusbdrv -I. -DDEBUG_LEVEL=0
-mmcu=attiny44 -o main.elf usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o
main.o
rm -f main.hex main.eep.hex
avr-objcopy -j .text -j .data -O ihex main.elf main.hex
avr-size main.hex
text data bss dec hex filename
0 2020 0 2020 7e4 main.hex
Set the fuses to uses the external clock (crystal):
make fuse
If successful, you will get this response:
[ln-mowifi-02-10:fabISP_mac.0.8.2_firmware poppy-laptop$ make fuse
avrdude -c usbtiny -p attiny44 -U hfuse:w:0xDF:m -U lfuse:w:0xFF:m
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9207
avrdude: reading input file "0xDF"
avrdude: writing hfuse (1 bytes):
Writing | ################################################## | 100% 0.00s
avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xDF:
avrdude: load data hfuse data from input file 0xDF:
avrdude: input file 0xDF contains 1 bytes
avrdude: reading on-chip hfuse data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.01s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: safemode: Fuses OK
avrdude done. Thank you.
Program the board to be an ISP:
make program
If successful, you will get this response:
[ln-mowifi-02-10:fabISP_mac.0.8.2_firmware poppy-laptop$ make program
avrdude -c usbtiny -p attiny44 -U flash:w:main.hex:i
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9207
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "main.hex"
avrdude: writing flash (2020 bytes):
Writing | ################################################## | 100% 5.68s
avrdude: 2020 bytes of flash written
avrdude: verifying flash memory against main.hex:
avrdude: load data flash data from input file main.hex:
avrdude: input file main.hex contains 2020 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 3.36s
avrdude: verifying ...
avrdude: 2020 bytes of flash verified
avrdude: safemode: Fuses OK
avrdude done. Thank you.
avrdude -c usbtiny -p attiny44 -U hfuse:w:0xDF:m -U lfuse:w:0xFF:m
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9207
avrdude: reading input file "0xDF"
avrdude: writing hfuse (1 bytes):
Writing | ################################################## | 100% 0.00s
avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xDF:
avrdude: load data hfuse data from input file 0xDF:
avrdude: input file 0xDF contains 1 bytes
avrdude: reading on-chip hfuse data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.00s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: safemode: Fuses OK
avrdude done. Thank you.
Check the ISP is working
On a Mac, go to the Apple symbol in the menu bar > About this Mac > System Report ... > USB > Check that the ISP appears on the USB Tree.
The programming worked on the second board successfully, but the board didn’t appear as a USB device on the computer. Turned out I had used the wrong resistors.