Lately, I have increased my microprocessor/gadget activity after a hiatus/slow down. A project that I have been (slowly) working on was developed and debugged on an Arduino NANO but the final target is a surface mounted SOIC ATtiny85-20SUR operating at 3-Volts. On an interim basis, I am testing with 8-DIP ATtiny85-20 chips. I have been programming the ATtiny85-20 chips with a USBasp programmer and a perf-board adapter that I made back in 2012. The perf-board adapter is shown in Figure 1, below.
In the same storage box as the perf-board adapter was a universal adapter that I also made in 2012. I needed it for some other, larger chips that I was programming, at the time. It has a 48-pin Zero Insertion Force socket (ZIF 250-3345).
The USBasp programmer in the photo is another story. I have two of these inexpensive Chinese programmers. I purchased the first one in 2012 and I liked it so much that I bought a second one as a maintenance spare. In the years that have passed I have changed my desktop workstation operating two or three times. I am now on Mint 17.3. Something in Linux has changed because this USBasp programmer originally created a /dev/ttyUSB0 port but – no longer! I tried every udev rule offered by the Internet pundits but nothing would work. I have the programmer working on /dev/ttyS0 but it bugs me that Linux’s behavior has changed. Since my two USBasp devices are Chinese-made and several years old, I suspect that their FTDI chips are probably counterfiet. I am growing suspicious that FTDI may have inserted some form of their malicious code into Linux. It is widely publicized about what they did to Linux drivers (http://hackaday.com/2016/02/01/ftdi-drivers-break-fake-chips-again/). Seeing that FTDI supplies the Linux kernel’s USB drivers, I went looking for the source to see what I could find out. Guess what – FTDI’s driver ReadMe file states “FTDI do not release the source code for libftd2xx. If you prefer to work with source code and are starting a project from scratch, consider using the open-source libFTDI.” Sure enough, Linux is using FTDI supplied compiled objects into the kernel. Oh well, I guess I’ll stick to using /dev/ttyS0.
My DIY universal programmer adapter was made on a quickie, somewhat crude one-sided printed circuit board. I was making quite a few PC boards in 2012/3. The artwork and schematic for this board is at the bottom of this post.
I just setup the Universal Programmer board and burned a ATtiny85-20 fused to run at 8MHz. I’m glad that the universal adapter still works well. The console output below is just a “blink” program to test the programmer. I have already tested my project’s code in a 3.3-volt adafruit trinket so I know that it is going to work well inside an ATtiny85.
ecomer@bergamont ~/Arduino/BlinkATTiny85 $ make upload ------------------------- Arduino.mk Configuration: - [AUTODETECTED] CURRENT_OS = LINUX - [USER] ARDUINO_DIR = /home/ecomer/arduino-1.6.9 - [USER] ARDMK_DIR = /home/ecomer/Arduino/Arduino-Makefile - [AUTODETECTED] ARDUINO_VERSION = 169 - [DEFAULT] ARCHITECTURE = avr - [DEFAULT] ARDMK_VENDOR = arduino - [AUTODETECTED] ARDUINO_PREFERENCES_PATH = /home/ecomer/.arduino15/preferences.txt - [AUTODETECTED] ARDUINO_SKETCHBOOK = /home/ecomer/Arduino (from arduino preferences file) - [USER] AVR_TOOLS_DIR = /home/ecomer/arduino-1.6.9/hardware/tools/avr - [COMPUTED] ARDUINO_LIB_PATH = /home/ecomer/arduino-1.6.9/libraries (from ARDUINO_DIR) - [COMPUTED] ARDUINO_PLATFORM_LIB_PATH = /home/ecomer/arduino-1.6.9/hardware/arduino/avr/libraries (from ARDUINO_DIR) - [USER] ALTERNATE_CORE = tiny - [COMPUTED] ALTERNATE_CORE_PATH = /home/ecomer/Arduino/hardware/tiny/avr (from ARDUINO_SKETCHBOOK and ALTERNATE_CORE) - [COMPUTED] BOARDS_TXT = /home/ecomer/Arduino/hardware/tiny/avr/boards.txt (from ALTERNATE_CORE_PATH) - [USER] USER_LIB_PATH = /home/ecomer/Arduino/lib - [DEFAULT] PRE_BUILD_HOOK = pre-build-hook.sh - [USER] BOARD_TAG = attiny85at8 - [COMPUTED] CORE = tiny (from build.core) - [COMPUTED] VARIANT = (from build.variant) - [USER] OBJDIR = /home/ecomer/Arduino/BlinkATTiny85/attiny85at8/bin - [USER] ARDUINO_CORE_PATH = /home/ecomer/Arduino/hardware/tiny/avr/cores/tiny - [USER] MONITOR_BAUDRATE = 115200 - [DEFAULT] OPTIMIZATION_LEVEL = s - [DEFAULT] MCU_FLAG_NAME = mmcu - [USER] CFLAGS_STD = -std=gnu11 - [USER] CXXFLAGS_STD = -std=gnu++11 - [COMPUTED] DEVICE_PATH = /dev/ttyS0 (from MONITOR_PORT) - [DEFAULT] FORCE_MONITOR_PORT = - [AUTODETECTED] Size utility: AVR-aware for enhanced output - [COMPUTED] BOOTLOADER_PARENT = /home/ecomer/arduino-1.6.9/hardware/arduino/avr/bootloaders (from ARDUINO_DIR) - [COMPUTED] ARDMK_VERSION = 1.5 - [COMPUTED] CC_VERSION = 4.8.1 (avr-gcc) ------------------------- mkdir -p /home/ecomer/Arduino/BlinkATTiny85/attiny85at8/bin make reset make: Entering directory `/home/ecomer/Arduino/BlinkATTiny85' /home/ecomer/Arduino/Arduino-Makefile/bin/ard-reset-arduino /dev/ttyS0 make: Leaving directory `/home/ecomer/Arduino/BlinkATTiny85' make do_upload make: Entering directory `/home/ecomer/Arduino/BlinkATTiny85' /usr/bin/avrdude -q -V -p attiny85 -C /home/ecomer/arduino-1.6.9/hardware/tools/avr/etc/avrdude.conf -D -c usbasp -b 9600 -P /dev/ttyS0 \ -U flash:w:/home/ecomer/Arduino/BlinkATTiny85/attiny85at8/bin/BlinkATTiny85.hex:i avrdude: warning: cannot set sck period. please check for usbasp firmware update. avrdude: AVR device initialized and ready to accept instructions avrdude: Device signature = 0x1e930b avrdude: reading input file "/home/ecomer/Arduino/BlinkATTiny85/attiny85at8/bin/BlinkATTiny85.hex" avrdude: writing flash (714 bytes): avrdude: 714 bytes of flash written avrdude: safemode: Fuses OK (H:FF, E:D7, L:E2) avrdude done. Thank you.
As you can see, I have also been fiddling with Make for Arduino compiling and burning. This particular Makefile is by Sudar Muthu of Chennai, India. You can download it at https://github.com/sudar/Arduino-Makefile. I gravitated to this Makefile because some of my semi-anonymous work is within. Sudar built upon Christopher Peplin’s previous work and I am a contributor to Peplin’s now depricated makefile. Consequentially, I knew this particular Makefile well. Nonetheless, things have changed since 2012. The format of “boards.txt”, a critical Arduino parameter file, has dramatically changed since 2012. Arduino has added a new structured “menu” version of “boards.txt” that can be very difficult to parse with a Makefile, especially since Arduino.cc has no published standard. Due to this, each Arduino “core” developer invented “tags” in “boards.txt” that are unique to their “core”. I frustratingly tested several and gave up and settled on the ONE that worked well. It is arduino-tine version 0150-0020in the Google code repository at https://code.google.com/archive/p/arduino-tiny/downloads Can I do what I need in the Arduino IDE? – Sure but I am a hands-on guy and the goal of the Arduino ide is to insulate the developer from what is happening. I don’t like that and usually pick the hands-on approach even if it isn’t always as easy.