Making a circuit by milling the PCB, soldering the components and then programming the microcontroller involves a lot of steps, usually not interchangeable. Hence, I have decided to put all these step in a ordered list for future reference (and I plan to improve this list week after week).
A list of all the components needed to completed the circuit follows:
So the board is now ready to host components...
I had never soldered SMD components, and I'm still thinking that it's weird and a bit crazy. Anyway, using the soldering station of FabLab Mantova I placed and soldered a few components.
In this process a third hand tool with a magnifying glass was really useful!
I realized too late that I inverted the polarity of the two zener diodes. Stupid mistake! For some strange reasons, I put (deliberately) the white line next to the ground in both cases - since the line it is on the cathode side, the zeners were not working in the breakdown region and so the signals were not regulated to 3.3. Hence, I had to reverse the two diodes, hoping the ATtiny44 has not been fried in the meantime.
The results is quite horrible, but I've checked all resistors, capacitors and circuit continuity with my multimeter, and everything seems fine.
Open the Arduino IDE, then under File > Examples > ArduinoISP open the example code that will transform your Arduino into an In-System Programmer
Then upload the code to your Arduino.
As you can see in the code, the sketch turns the Arduino into a AVRISP using the following Arduino pins:
So according to the code, connect Arduino to the FabISP
Following the instruction posted here, open a Terminal and install the required packages with
sudo apt-get install flex byacc bison gcc libusb-dev avrdude gcc-avr avr-libc libc6-dev build-essentialthen obtain the firmware with
cd /tmp wget http://academy.cba.mit.edu/classes/embedded_programming/firmware.zip unzip firmware.zip cd fabISP_mac.0.8.2_firmwarethen edit the Makefile and comment the lines
#AVRDUDE = avrdude -c usbtiny -p $(DEVICE) # edit this line for your programmer AVRDUDE = avrdude -c avrisp2 -P usb -p $(DEVICE) # edit this line for your programmerappending '#' at the beginning
#AVRDUDE = avrdude -c usbtiny -p $(DEVICE) # edit this line for your programmer #AVRDUDE = avrdude -c avrisp2 -P usb -p $(DEVICE) # edit this line for your programmerand set the correct programmer (check the name of the USB port, like /dev/ttyUSB0, with dmesg)
AVRDUDE = avrdude -c stk500v1 -b19200 -P /dev/ttyUSB0 -p $(DEVICE)Finally run
make clean && make hexand
sudo make fuseto program the microcontroller.
avrdude -c stk500v1 -b19200 -P /dev/ttyUSB0 -p attiny44 -U hfuse:w:0xDF:m -U lfuse:w:0xFF:m avrdude: ser_open(): can't open device "/dev/ttyUSB0": Input/output error avrdude done. Thank you. Makefile:119: recipe for target 'fuse' failed make: *** [fuse] Error 1 emanuele@Lenovo-G580:/tmp/fabISP_mac.0.8.2_firmware$ sudo make fuse avrdude -c stk500v1 -b19200 -P /dev/ttyUSB0 -p attiny44 -U hfuse:w:0xDF:m -U lfuse:w:0xFF:m avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x15 avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x15 avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x14 avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x01 avrdude: stk500_initialize(): (a) protocol error, expect=0x14, resp=0x10 avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check. avrdude: stk500_disable(): unknown response=0x12 avrdude done. Thank you. Makefile:119: recipe for target 'fuse' failed make: *** [fuse] Error 1try again after a few seconds. In the end you should finally see
avrdude -c stk500v1 -b19200 -P /dev/ttyUSB0 -p attiny44 -U hfuse:w:0xDF:m -U lfuse:w:0xFF:m avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.05s avrdude: Device signature = 0x1e9207 (probably t44) avrdude: reading input file "0xDF" avrdude: writing hfuse (1 bytes): Writing | ################################################## | 100% 0.02s 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.02s avrdude: verifying ... avrdude: 1 bytes of hfuse verified avrdude: reading input file "0xFF" avrdude: writing lfuse (1 bytes): Writing | ################################################## | 100% 0.06s 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.02s avrdude: verifying ... avrdude: 1 bytes of lfuse verified avrdude: safemode: Fuses OK (E:FF, H:DF, L:FF) avrdude done. Thank you.And then
make programshould result in
avrdude -c stk500v1 -b19200 -P /dev/ttyUSB0 -p attiny44 -U flash:w:main.hex:i avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.05s avrdude: Device signature = 0x1e9207 (probably t44) 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 (1986 bytes): Writing | ################################################## | 100% 3.40s avrdude: 1986 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 1986 bytes avrdude: reading on-chip flash data: Reading | ################################################## | 100% 2.35s avrdude: verifying ... avrdude: 1986 bytes of flash verified avrdude: safemode: Fuses OK (E:FF, H:DF, L:FF) avrdude done. Thank you. avrdude -c stk500v1 -b19200 -P /dev/ttyUSB0 -p attiny44 -U hfuse:w:0xDF:m -U lfuse:w:0xFF:m avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.05s avrdude: Device signature = 0x1e9207 (probably t44) avrdude: reading input file "0xDF" avrdude: writing hfuse (1 bytes): Writing | ################################################## | 100% 0.02s 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.02s avrdude: verifying ... avrdude: 1 bytes of hfuse verified avrdude: reading input file "0xFF" avrdude: writing lfuse (1 bytes): Writing | ################################################## | 100% 0.02s 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.02s avrdude: verifying ... avrdude: 1 bytes of lfuse verified avrdude: safemode: Fuses OK (E:FF, H:DF, L:FF) avrdude done. Thank you.
After you have programmed the board, unplug Arduino, disconnect the wires and plug the FabISP into the USB port. Type
lsusb
If your FabISP has been successfully programmed, you should see it into the list of USB connected device:
emanuele@Lenovo-G580:~$ lsusb ... Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 123: ID 1781:0c9f Multiple Vendors USBtiny <---- it works!!!! Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub ...Once the FabISP has been programmed, you can remove the two 0 ohm resistors