0

Another Ice Tube Clock Design for the Holidays
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Another Ice Tube Clock Design for the Holidays

by nix_clk_dd on Sun Jul 28, 2019 1:29 pm

jarchie wrote:It turns out that I only get the "Could not find USBtiny device" error when I use the version of avrdude that comes with CrossPack. When I use the version that comes with MacPorts, everything works fine. So it looks like the MacOS 10.14.6 update only broke the CrossPack-supplied avrdude, and the USBtinyISP still works.

Perhaps the older avrdude is attempting to access the USBtinyISP in a way that is no longer supported by OS X. If I don't find a workaround, I might have to switch to the MacPorts AVR tools. Oh well.

Last night I managed to get my Mac to detect the USBtiny device inside of terminal, but I'm also getting the "avrdude: initialization failed, rc=-1" error with the most recent version of avrdude available from MacPorts.

For the sake of copying your exact setup, I might uninstall everything and then install all necessary software from scratch.
1. OS X: 10.14.6
2. Xcode version: ?
3. CrossPack 2013-12-16
4. MacPorts 2.5.4
5. $ sudo port install avrdude

How do ensure that the avrdude version from MacPorts will be used rather than the one from CrossPack?

nix_clk_dd
 
Posts: 36
Joined: Tue May 21, 2019 2:15 pm

Re: Another Ice Tube Clock Design for the Holidays

by jarchie on Sun Jul 28, 2019 4:00 pm

nix_clk_dd wrote:Last night I managed to get my Mac to detect the USBtiny device inside of terminal, but I'm also getting the "avrdude: initialization failed, rc=-1" error with the most recent version of avrdude available from MacPorts.

Since you're getting the same error on Windows and MacOS now, I suspect that the problem is hardware. It seems like something must be going wrong between the ATtiny in the programmer and the ATmega in the clock.

Something else might be worth keeping in mind. If I do something wrong with the programmer, it can be left in a state where no matter what I do I see an error like "avrdude: initialization failed, rc=-1". Disconnecting the programmer--both from the computer and clock--waiting a couple seconds, and reconnecting it to the computer first is sufficient to restart the programmer and fix the issue.

(The most common way for me to get the programmer into this broken state is to leave the programmer's power jumper installed, connect the programmer to an unpowered project, and have the project attempt to draw too much power from the programmer.)

nix_clk_dd wrote:For the sake of copying your exact setup, I might uninstall everything and then install all necessary software from scratch.
1. OS X: 10.14.6
2. Xcode version: ?
3. CrossPack 2013-12-16
4. MacPorts 2.5.4
5. $ sudo port install avrdude

Correct on everything. The xcode version shouldn't matter, but I think I'm using the most recent version:

Code: Select all | TOGGLE FULL SIZE
$ xcodebuild -version
Xcode 10.3
Build version 10G8
The version of the other command line tools are

Code: Select all | TOGGLE FULL SIZE
$ /usr/local/CrossPack-AVR/bin/avr-gcc --version
avr-gcc (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or [CENSORED] FOR A PARTICULAR PURPOSE.

$ /usr/local/CrossPack-AVR/bin/avr-size --version
GNU size (GNU Binutils) 2.23.2
Copyright 2012 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.
$ /opt/local/bin/avrdude
Usage: avrdude [options]
Options:
  -p <partno>                Required. Specify AVR device.
  -b <baudrate>              Override RS-232 baud rate.
  -B <bitclock>              Specify JTAG/STK500v2 bit clock period (us).
  -C <config-file>           Specify location of configuration file.
  -c <programmer>            Specify programmer type.
  -D                         Disable auto erase for flash memory
  -i <delay>                 ISP Clock Delay [in microseconds]
  -P <port>                  Specify connection port.
  -F                         Override invalid signature check.
  -e                         Perform a chip erase.
  -O                         Perform RC oscillator calibration (see AVR053).
  -U <memtype>:r|w|v:<filename>[:format]
                             Memory operation specification.
                             Multiple -U options are allowed, each request
                             is performed in the order specified.
  -n                         Do not write anything to the device.
  -V                         Do not verify.
  -u                         Disable safemode, default when running from a script.
  -s                         Silent safemode operation, will not ask you if
                             fuses should be changed back.
  -t                         Enter terminal mode.
  -E <exitspec>[,<exitspec>] List programmer exit specifications.
  -x <extended_param>        Pass <extended_param> to programmer.
  -y                         Count # erase cycles in EEPROM.
  -Y <number>                Initialize erase cycle # in EEPROM.
  -v                         Verbose output. -v -v for more.
  -q                         Quell progress output. -q -q for less.
  -l logfile                 Use logfile rather than stderr for diagnostics.
  -?                         Display this usage.

avrdude version 6.3, URL: <http://savannah.nongnu.org/projects/avrdude/>
$ /usr/local/CrossPack-AVR/bin/avr-objcopy --version
GNU objcopy (GNU Binutils) 2.23.2
Copyright 2012 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.

nix_clk_dd wrote:How do ensure that the avrdude version from MacPorts will be used rather than the one from CrossPack?

One way is to change the Makefile to specify the exact location of each tool in your filesystem. CrossPack installs, by default, to "/usr/local/CrossPack-AVR/bin"; MacPorts installs, by default, to "/opt/local/bin". Here's an example excerpt to use the CrossPack build tools and the MacPorts version of avrdude:

Code: Select all | TOGGLE FULL SIZE
# avr programming utilities
AVRCPP     ?= /usr/local/CrossPack-AVR/bin/avr-gcc
AVRSIZE    ?= /usr/local/CrossPack-AVR/bin/avr-size
AVRDUDE    ?= /opt/local/bin/avrdude
AVROBJCOPY ?= /usr/local/CrossPack-AVR/bin/avr-objcopy
With the MacPorts version of AVR dude, you'll also need to change FUSE_OPT to nostrip. (This isn't your problem though. You would see a different error when programming extended fuses.)

Code: Select all | TOGGLE FULL SIZE
# if avrdude generates an error when programming the extended fuses
# try changing the following option to "nostrip" to leave reserved
# fuse bits set as 1; otherwise reserved fuse bits will be set to 0
FUSE_OPT ?= nostrip

jarchie
 
Posts: 591
Joined: Sun Jun 24, 2012 2:16 pm
Location: Santa Cruz, California, United States

Re: Another Ice Tube Clock Design for the Holidays

by nix_clk_dd on Sun Jul 28, 2019 6:43 pm

jarchie wrote:
nix_clk_dd wrote:Last night I managed to get my Mac to detect the USBtiny device inside of terminal, but I'm also getting the "avrdude: initialization failed, rc=-1" error with the most recent version of avrdude available from MacPorts.

Since you're getting the same error on Windows and MacOS now, I suspect that the problem is hardware. It seems like something must be going wrong between the ATtiny in the programmer and the ATmega in the clock.

Something else might be worth keeping in mind. If I do something wrong with the programmer, it can be left in a state where no matter what I do I see an error like "avrdude: initialization failed, rc=-1". Disconnecting the programmer--both from the computer and clock--waiting a couple seconds, and reconnecting it to the computer first is sufficient to restart the programmer and fix the issue.

(The most common way for me to get the programmer into this broken state is to leave the programmer's power jumper installed, connect the programmer to an unpowered project, and have the project attempt to draw too much power from the programmer.)

Correct on everything. The xcode version shouldn't matter, but I think I'm using the most recent version:
With the MacPorts version of AVR dude, you'll also need to change FUSE_OPT to nostrip. (This isn't your problem though. You would see a different error when programming extended fuses.)


Unfortunately still the same error after installing all the same versions you are using and defining the avr programming utility paths in the makefile.
Also tried at "-B 35" and "-B 250" as well as different USB ports and 2.0 hub again.
Code: Select all | TOGGLE FULL SIZE
$ make install-all
/opt/local/bin/avrdude -B 4 -P usb -c usbtiny -p atmega328p -u -U lfuse:w:0x62:m -u -U hfuse:w:0xD1:m -u -U efuse:w:0xFE:m -U flash:w:icetube_flash.hex:i -U eeprom:w:icetube_eeprom.hex:i -U lock:w:0x2B:m

avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

make: [install-all] Error 1 (ignored)


The clock still functions normally on external power with the VFD tube connected using the original firmware I flashed, so I don't think the microcontroller is bricked.
Should I try removing the chip and flashing a new, blank one?

I've tried so many combinations of unplugging the power, programmer from computer/clock, etc. :(

nix_clk_dd
 
Posts: 36
Joined: Tue May 21, 2019 2:15 pm

Re: Another Ice Tube Clock Design for the Holidays

by jarchie on Sun Jul 28, 2019 10:29 pm

It might be worth turning on verbose debugging output from avrdude. Looking at the avrdude docs, this can be done by specifying the "-v" switch and specifying it multiple times will increase the debugging level. Adding the "-v -v" option to the AVRDUDEOPT macro might give some useful output.

Code: Select all | TOGGLE FULL SIZE
AVRDUDEOPT    ?= -v -v -B 4 -P usb -c $(AVRISP) -p $(AVRMCU)  # usbtiny & dragon_isp
For reference, this is what the output of avrdude (via "make install-flash") looks like when my programmer is connected to the computer but not the clock:

Code: Select all | TOGGLE FULL SIZE
/opt/local/bin/avrdude -v -v -B 4 -P usb -c usbtiny -p atmega328p   -U flash:w:icetube_flash.hex:i

avrdude: Version 6.3, compiled on Jul 27 2019 at 23:29:25
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/opt/local/etc/avrdude.conf"
         User configuration file is "/Users/jarchie/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : usbtiny
         Setting bit clk period        : 4.0
avrdude: usbdev_open(): Found USBtinyISP, bus:device: 020:009
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Setting SCK period to 4 usec
CMD: [ac 53 00 00] [00 00 00 00]
CMD: [ac 53 00 00] [00 00 00 00]
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.
And this is what the output of avrdude (via "make install-flash") looks like when successfully programming a clock:

Code: Select all | TOGGLE FULL SIZE
/opt/local/bin/avrdude -v -v -B 4 -P usb -c usbtiny -p atmega328p   -U flash:w:icetube_flash.hex:i

avrdude: Version 6.3, compiled on Jul 27 2019 at 23:29:25
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/opt/local/etc/avrdude.conf"
         User configuration file is "/Users/jarchie/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : usbtiny
         Setting bit clk period        : 4.0
avrdude: usbdev_open(): Found USBtinyISP, bus:device: 020:009
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Setting SCK period to 4 usec
CMD: [ac 53 00 00] [ff fe 53 00]
avrdude: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00sCMD: [30 00 00 00] [00 30 00 1e]
CMD: [30 00 01 00] [00 30 00 95]
Reading | #################                                  | 33% 0.00sCMD: [30 00 02 00] [00 30 00 0f]
Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
CMD: [50 00 00 00] [00 50 00 62]
CMD: [50 00 00 00] [00 50 00 62]
CMD: [50 00 00 00] [00 50 00 62]
CMD: [58 08 00 00] [00 58 08 d1]
CMD: [58 08 00 00] [00 58 08 d1]
CMD: [58 08 00 00] [00 58 08 d1]
avrdude: safemode: hfuse reads as D1
CMD: [50 08 00 00] [00 50 08 fe]
CMD: [50 08 00 00] [00 50 08 fe]
CMD: [50 08 00 00] [00 50 08 fe]
avrdude: safemode: efuse reads as FE
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
CMD: [ac 80 00 00] [00 ac 80 00]
avrdude: Setting SCK period to 4 usec
CMD: [ac 53 00 00] [00 ac 53 00]
avrdude: reading input file "icetube_flash.hex"
avrdude: writing flash (29612 bytes):

Writing |                                                    | 0% 0.00sCMD: [4c 00 00 00] [1f 4c 00 00]
CMD: [4c 00 40 00] [22 4c 00 40]
CMD: [4c 00 80 00] [2a 4c 00 80]
Writing | #                                                  | 1% 0.22sCMD: [4c 00 c0 00] [35 4c 00 c0]
CMD: [4c 01 00 00] [65 4c 01 00]
Writing | #                                                  | 2% 0.38sCMD: [4c 01 40 00] [59 4c 01 40]
CMD: [4c 01 80 00] [77 4c 01 80]
Writing | ##                                                 | 3% 0.55sCMD: [4c 01 c0 00] [69 4c 01 c0]
CMD: [4c 02 00 00] [67 4c 02 00]
CMD: [4c 02 40 00] [00 4c 02 40]
Writing | ##                                                 | 4% 0.76sCMD: [4c 02 80 00] [7c 4c 02 80]
CMD: [4c 02 c0 00] [73 4c 02 c0]
Writing | ###                                                | 5% 0.91sCMD: [4c 03 00 00] [65 4c 03 00]
CMD: [4c 03 40 00] [67 4c 03 40]
Writing | ###                                                | 6% 1.09sCMD: [4c 03 80 00] [75 4c 03 80]
CMD: [4c 03 c0 00] [00 4c 03 c0]
CMD: [4c 04 00 00] [e0 4c 04 00]
Writing | ####                                               | 7% 1.34sCMD: [4c 04 40 00] [93 4c 04 40]
CMD: [4c 04 80 00] [24 4c 04 80]
Writing | ####                                               | 8% 1.48sCMD: [4c 04 c0 00] [11 4c 04 c0]
CMD: [4c 05 00 00] [94 4c 05 00]
Writing | #####                                              | 9% 1.63sCMD: [4c 05 40 00] [e2 4c 05 40]
CMD: [4c 05 80 00] [94 4c 05 80]
CMD: [4c 05 c0 00] [93 4c 05 c0]
Writing | #####                                              | 10% 1.84sCMD: [4c 06 00 00] [91 4c 06 00]
CMD: [4c 06 40 00] [ff 4c 06 40]
Writing | ######                                             | 11% 1.99sCMD: [4c 06 80 00] [06 4c 06 80]
CMD: [4c 06 c0 00] [01 4c 06 c0]
Writing | ######                                             | 12% 2.13sCMD: [4c 07 00 00] [95 4c 07 00]
CMD: [4c 07 40 00] [e0 4c 07 40]
CMD: [4c 07 80 00] [01 4c 07 80]
Writing | #######                                            | 13% 2.35sCMD: [4c 07 c0 00] [11 4c 07 c0]
CMD: [4c 08 00 00] [07 4c 08 00]
Writing | #######                                            | 14% 2.49sCMD: [4c 08 40 00] [01 4c 08 40]
CMD: [4c 08 80 00] [91 4c 08 80]
Writing | ########                                           | 15% 2.64sCMD: [4c 08 c0 00] [08 4c 08 c0]
CMD: [4c 09 00 00] [01 4c 09 00]
CMD: [4c 09 40 00] [f7 4c 09 40]
Writing | ########                                           | 16% 2.84sCMD: [4c 09 80 00] [1f 4c 09 80]
CMD: [4c 09 c0 00] [05 4c 09 c0]
Writing | #########                                          | 17% 2.98sCMD: [4c 0a 00 00] [95 4c 0a 00]
CMD: [4c 0a 40 00] [17 4c 0a 40]
Writing | #########                                          | 18% 3.11sCMD: [4c 0a 80 00] [90 4c 0a 80]
CMD: [4c 0a c0 00] [11 4c 0a c0]
CMD: [4c 0b 00 00] [00 4c 0b 00]
Writing | ##########                                         | 19% 3.32sCMD: [4c 0b 40 00] [2b 4c 0b 40]
CMD: [4c 0b 80 00] [bf 4c 0b 80]
Writing | ##########                                         | 20% 3.45sCMD: [4c 0b c0 00] [01 4c 0b c0]
CMD: [4c 0c 00 00] [91 4c 0c 00]
Writing | ###########                                        | 21% 3.58sCMD: [4c 0c 40 00] [95 4c 0c 40]
CMD: [4c 0c 80 00] [45 4c 0c 80]
CMD: [4c 0c c0 00] [90 4c 0c c0]
Writing | ###########                                        | 22% 3.79sCMD: [4c 0d 00 00] [01 4c 0d 00]
CMD: [4c 0d 40 00] [91 4c 0d 40]
Writing | ############                                       | 23% 3.92sCMD: [4c 0d 80 00] [c0 4c 0d 80]
CMD: [4c 0d c0 00] [91 4c 0d c0]
Writing | ############                                       | 24% 4.06sCMD: [4c 0e 00 00] [f5 4c 0e 00]
CMD: [4c 0e 40 00] [94 4c 0e 40]
Writing | #############                                      | 25% 4.19sCMD: [4c 0e 80 00] [01 4c 0e 80]
CMD: [4c 0e c0 00] [5d 4c 0e c0]
CMD: [4c 0f 00 00] [0e 4c 0f 00]
Writing | #############                                      | 26% 4.40sCMD: [4c 0f 40 00] [01 4c 0f 40]
CMD: [4c 0f 80 00] [01 4c 0f 80]
Writing | ##############                                     | 27% 4.53sCMD: [4c 0f c0 00] [27 4c 0f c0]
CMD: [4c 10 00 00] [f0 4c 10 00]
Writing | ##############                                     | 28% 4.67sCMD: [4c 10 40 00] [95 4c 10 40]
CMD: [4c 10 80 00] [91 4c 10 80]
CMD: [4c 10 c0 00] [00 4c 10 c0]
Writing | ###############                                    | 29% 4.91sCMD: [4c 11 00 00] [17 4c 11 00]
CMD: [4c 11 40 00] [95 4c 11 40]
Writing | ###############                                    | 30% 5.05sCMD: [4c 11 80 00] [c0 4c 11 80]
CMD: [4c 11 c0 00] [91 4c 11 c0]
Writing | ################                                   | 31% 5.18sCMD: [4c 12 00 00] [c0 4c 12 00]
CMD: [4c 12 40 00] [01 4c 12 40]
CMD: [4c 12 80 00] [00 4c 12 80]
Writing | ################                                   | 32% 5.40sCMD: [4c 12 c0 00] [01 4c 12 c0]
CMD: [4c 13 00 00] [01 4c 13 00]
Writing | #################                                  | 33% 5.53sCMD: [4c 13 40 00] [10 4c 13 40]
CMD: [4c 13 80 00] [e0 4c 13 80]
Writing | #################                                  | 34% 5.67sCMD: [4c 13 c0 00] [9a 4c 13 c0]
CMD: [4c 14 00 00] [f0 4c 14 00]
CMD: [4c 14 40 00] [17 4c 14 40]
Writing | ##################                                 | 35% 5.87sCMD: [4c 14 80 00] [14 4c 14 80]
CMD: [4c 14 c0 00] [91 4c 14 c0]
Writing | ##################                                 | 36% 6.01sCMD: [4c 15 00 00] [4f 4c 15 00]
CMD: [4c 15 40 00] [0f 4c 15 40]
Writing | ###################                                | 37% 6.15sCMD: [4c 15 80 00] [f0 4c 15 80]
CMD: [4c 15 c0 00] [39 4c 15 c0]
CMD: [4c 16 00 00] [97 4c 16 00]
Writing | ###################                                | 38% 6.35sCMD: [4c 16 40 00] [95 4c 16 40]
CMD: [4c 16 80 00] [c0 4c 16 80]
Writing | ####################                               | 39% 6.49sCMD: [4c 16 c0 00] [c0 4c 16 c0]
CMD: [4c 17 00 00] [e0 4c 17 00]
Writing | ####################                               | 40% 6.62sCMD: [4c 17 40 00] [94 4c 17 40]
CMD: [4c 17 80 00] [e2 4c 17 80]
CMD: [4c 17 c0 00] [02 4c 17 c0]
Writing | #####################                              | 41% 6.82sCMD: [4c 18 00 00] [07 4c 18 00]
CMD: [4c 18 40 00] [94 4c 18 40]
Writing | #####################                              | 42% 6.96sCMD: [4c 18 80 00] [01 4c 18 80]
CMD: [4c 18 c0 00] [91 4c 18 c0]
Writing | ######################                             | 43% 7.09sCMD: [4c 19 00 00] [07 4c 19 00]
CMD: [4c 19 40 00] [95 4c 19 40]
CMD: [4c 19 80 00] [97 4c 19 80]
Writing | ######################                             | 44% 7.30sCMD: [4c 19 c0 00] [58 4c 19 c0]
CMD: [4c 1a 00 00] [32 4c 1a 00]
Writing | #######################                            | 45% 7.43sCMD: [4c 1a 40 00] [b7 4c 1a 40]
CMD: [4c 1a 80 00] [38 4c 1a 80]
Writing | #######################                            | 46% 7.57sCMD: [4c 1a c0 00] [94 4c 1a c0]
CMD: [4c 1b 00 00] [01 4c 1b 00]
CMD: [4c 1b 40 00] [e1 4c 1b 40]
Writing | ########################                           | 47% 7.77sCMD: [4c 1b 80 00] [98 4c 1b 80]
CMD: [4c 1b c0 00] [93 4c 1b c0]
Writing | ########################                           | 48% 7.91sCMD: [4c 1c 00 00] [01 4c 1c 00]
CMD: [4c 1c 40 00] [95 4c 1c 40]
Writing | #########################                          | 49% 8.04sCMD: [4c 1c 80 00] [01 4c 1c 80]
CMD: [4c 1c c0 00] [18 4c 1c c0]
Writing | #########################                          | 50% 8.18sCMD: [4c 1d 00 00] [92 4c 1d 00]
CMD: [4c 1d 40 00] [91 4c 1d 40]
CMD: [4c 1d 80 00] [e0 4c 1d 80]
Writing | ##########################                         | 51% 8.39sCMD: [4c 1d c0 00] [01 4c 1d c0]
CMD: [4c 1e 00 00] [e0 4c 1e 00]
Writing | ##########################                         | 52% 8.53sCMD: [4c 1e 40 00] [17 4c 1e 40]
CMD: [4c 1e 80 00] [94 4c 1e 80]
Writing | ###########################                        | 53% 8.67sCMD: [4c 1e c0 00] [17 4c 1e c0]
CMD: [4c 1f 00 00] [e0 4c 1f 00]
CMD: [4c 1f 40 00] [94 4c 1f 40]
Writing | ###########################                        | 54% 8.88sCMD: [4c 1f 80 00] [2f 4c 1f 80]
CMD: [4c 1f c0 00] [c0 4c 1f c0]
Writing | ############################                       | 55% 9.02sCMD: [4c 20 00 00] [c2 4c 20 00]
CMD: [4c 20 40 00] [95 4c 20 40]
Writing | ############################                       | 56% 9.15sCMD: [4c 20 80 00] [01 4c 20 80]
CMD: [4c 20 c0 00] [94 4c 20 c0]
CMD: [4c 21 00 00] [c0 4c 21 00]
Writing | #############################                      | 57% 9.36sCMD: [4c 21 40 00] [01 4c 21 40]
CMD: [4c 21 80 00] [91 4c 21 80]
Writing | #############################                      | 58% 9.50sCMD: [4c 21 c0 00] [ce 4c 21 c0]
CMD: [4c 22 00 00] [c0 4c 22 00]
Writing | ##############################                     | 59% 9.64sCMD: [4c 22 40 00] [e0 4c 22 40]
CMD: [4c 22 80 00] [c0 4c 22 80]
CMD: [4c 22 c0 00] [c0 4c 22 c0]
Writing | ##############################                     | 60% 9.85sCMD: [4c 23 00 00] [c0 4c 23 00]
CMD: [4c 23 40 00] [cf 4c 23 40]
Writing | ###############################                    | 61% 9.99sCMD: [4c 23 80 00] [91 4c 23 80]
CMD: [4c 23 c0 00] [0f 4c 23 c0]
Writing | ###############################                    | 62% 10.13sCMD: [4c 24 00 00] [30 4c 24 00]
CMD: [4c 24 40 00] [fd 4c 24 40]
CMD: [4c 24 80 00] [e0 4c 24 80]
Writing | ################################                   | 63% 10.33sCMD: [4c 24 c0 00] [01 4c 24 c0]
CMD: [4c 25 00 00] [f0 4c 25 00]
Writing | ################################                   | 64% 10.47sCMD: [4c 25 40 00] [94 4c 25 40]
CMD: [4c 25 80 00] [91 4c 25 80]
Writing | #################################                  | 65% 10.61sCMD: [4c 25 c0 00] [f0 4c 25 c0]
CMD: [4c 26 00 00] [94 4c 26 00]
CMD: [4c 26 40 00] [91 4c 26 40]
Writing | #################################                  | 66% 10.81sCMD: [4c 26 80 00] [32 4c 26 80]
CMD: [4c 26 c0 00] [e0 4c 26 c0]
Writing | ##################################                 | 67% 10.95sCMD: [4c 27 00 00] [91 4c 27 00]
CMD: [4c 27 40 00] [32 4c 27 40]
Writing | ##################################                 | 68% 11.09sCMD: [4c 27 80 00] [e0 4c 27 80]
CMD: [4c 27 c0 00] [30 4c 27 c0]
CMD: [4c 28 00 00] [e0 4c 28 00]
Writing | ###################################                | 69% 11.30sCMD: [4c 28 40 00] [94 4c 28 40]
CMD: [4c 28 80 00] [1f 4c 28 80]
Writing | ###################################                | 70% 11.44sCMD: [4c 28 c0 00] [e0 4c 28 c0]
CMD: [4c 29 00 00] [01 4c 29 00]
Writing | ####################################               | 71% 11.58sCMD: [4c 29 40 00] [91 4c 29 40]
CMD: [4c 29 80 00] [01 4c 29 80]
CMD: [4c 29 c0 00] [e0 4c 29 c0]
Writing | ####################################               | 72% 11.78sCMD: [4c 2a 00 00] [e0 4c 2a 00]
CMD: [4c 2a 40 00] [94 4c 2a 40]
Writing | #####################################              | 73% 11.92sCMD: [4c 2a 80 00] [93 4c 2a 80]
CMD: [4c 2a c0 00] [e0 4c 2a c0]
Writing | #####################################              | 74% 12.06sCMD: [4c 2b 00 00] [95 4c 2b 00]
CMD: [4c 2b 40 00] [94 4c 2b 40]
Writing | ######################################             | 75% 12.19sCMD: [4c 2b 80 00] [e0 4c 2b 80]
CMD: [4c 2b c0 00] [94 4c 2b c0]
CMD: [4c 2c 00 00] [f7 4c 2c 00]
Writing | ######################################             | 76% 12.40sCMD: [4c 2c 40 00] [c5 4c 2c 40]
CMD: [4c 2c 80 00] [f4 4c 2c 80]
Writing | #######################################            | 77% 12.54sCMD: [4c 2c c0 00] [e4 4c 2c c0]
CMD: [4c 2d 00 00] [c0 4c 2d 00]
Writing | #######################################            | 78% 12.67sCMD: [4c 2d 40 00] [1f 4c 2d 40]
CMD: [4c 2d 80 00] [91 4c 2d 80]
CMD: [4c 2d c0 00] [f0 4c 2d c0]
Writing | ########################################           | 79% 12.87sCMD: [4c 2e 00 00] [f0 4c 2e 00]
CMD: [4c 2e 40 00] [34 4c 2e 40]
Writing | ########################################           | 80% 13.01sCMD: [4c 2e 80 00] [30 4c 2e 80]
CMD: [4c 2e c0 00] [c0 4c 2e c0]
Writing | #########################################          | 81% 13.14sCMD: [4c 2f 00 00] [c2 4c 2f 00]
CMD: [4c 2f 40 00] [c0 4c 2f 40]
CMD: [4c 2f 80 00] [01 4c 2f 80]
Writing | #########################################          | 82% 13.35sCMD: [4c 2f c0 00] [e0 4c 2f c0]
CMD: [4c 30 00 00] [94 4c 30 00]
Writing | ##########################################         | 83% 13.48sCMD: [4c 30 40 00] [c1 4c 30 40]
CMD: [4c 30 80 00] [94 4c 30 80]
Writing | ##########################################         | 84% 13.62sCMD: [4c 30 c0 00] [58 4c 30 c0]
CMD: [4c 31 00 00] [94 4c 31 00]
CMD: [4c 31 40 00] [e0 4c 31 40]
Writing | ###########################################        | 85% 13.85sCMD: [4c 31 80 00] [94 4c 31 80]
CMD: [4c 31 c0 00] [01 4c 31 c0]
Writing | ###########################################        | 86% 13.98sCMD: [4c 32 00 00] [60 4c 32 00]
CMD: [4c 32 40 00] [92 4c 32 40]
Writing | ############################################       | 87% 14.12sCMD: [4c 32 80 00] [01 4c 32 80]
CMD: [4c 32 c0 00] [82 4c 32 c0]
CMD: [4c 33 00 00] [92 4c 33 00]
Writing | ############################################       | 88% 14.32sCMD: [4c 33 40 00] [01 4c 33 40]
CMD: [4c 33 80 00] [17 4c 33 80]
Writing | #############################################      | 89% 14.46sCMD: [4c 33 c0 00] [34 4c 33 c0]
CMD: [4c 34 00 00] [91 4c 34 00]
Writing | #############################################      | 90% 14.59sCMD: [4c 34 40 00] [93 4c 34 40]
CMD: [4c 34 80 00] [35 4c 34 80]
CMD: [4c 34 c0 00] [c0 4c 34 c0]
Writing | ##############################################     | 91% 14.80sCMD: [4c 35 00 00] [01 4c 35 00]
CMD: [4c 35 40 00] [01 4c 35 40]
Writing | ##############################################     | 92% 14.94sCMD: [4c 35 80 00] [91 4c 35 80]
CMD: [4c 35 c0 00] [01 4c 35 c0]
Writing | ###############################################    | 93% 15.07sCMD: [4c 36 00 00] [90 4c 36 00]
CMD: [4c 36 40 00] [83 4c 36 40]
CMD: [4c 36 80 00] [01 4c 36 80]
Writing | ###############################################    | 94% 15.27sCMD: [4c 36 c0 00] [9a 4c 36 c0]
CMD: [4c 37 00 00] [9a 4c 37 00]
Writing | ################################################   | 95% 15.41sCMD: [4c 37 40 00] [e0 4c 37 40]
CMD: [4c 37 80 00] [5f 4c 37 80]
Writing | ################################################   | 96% 15.54sCMD: [4c 37 c0 00] [94 4c 37 c0]
CMD: [4c 38 00 00] [7f 4c 38 00]
CMD: [4c 38 40 00] [94 4c 38 40]
Writing | #################################################  | 97% 15.78sCMD: [4c 38 80 00] [01 4c 38 80]
CMD: [4c 38 c0 00] [f4 4c 38 c0]
Writing | #################################################  | 98% 15.92sCMD: [4c 39 00 00] [f4 4c 39 00]
CMD: [4c 39 40 00] [24 4c 39 40]
Writing | ################################################## | 99% 16.05sCMD: [4c 39 80 00] [4e 4c 39 80]
CMD: [4c 39 c0 00] [ff 4c 39 c0]
Writing | ################################################## | 100% 16.19s

avrdude: 29612 bytes of flash written
avrdude: verifying flash memory against icetube_flash.hex:
avrdude: load data flash data from input file icetube_flash.hex:
avrdude: input file icetube_flash.hex contains 29612 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 12.89s

avrdude: verifying ...
avrdude: 29612 bytes of flash verified

CMD: [50 00 00 00] [ff 50 00 62]
CMD: [50 00 00 00] [00 50 00 62]
CMD: [50 00 00 00] [00 50 00 62]
CMD: [58 08 00 00] [00 58 08 d1]
CMD: [58 08 00 00] [00 58 08 d1]
CMD: [58 08 00 00] [00 58 08 d1]
avrdude: safemode: hfuse reads as D1
CMD: [50 08 00 00] [00 50 08 fe]
CMD: [50 08 00 00] [00 50 08 fe]
CMD: [50 08 00 00] [00 50 08 fe]
avrdude: safemode: efuse reads as FE
avrdude: safemode: Fuses OK (E:FE, H:D1, L:62)

avrdude done.  Thank you.

nix_clk_dd wrote:Also tried at "-B 35" and "-B 250"

Maybe try an even slower rate of 300 or 1000. I'm going off this post.

nix_clk_dd wrote:The clock still functions normally on external power with the VFD tube connected using the original firmware I flashed, so I don't think the microcontroller is bricked. Should I try removing the chip and flashing a new, blank one?

Since you've tried everything else, a blank chip is probably worth a try at some point.

Someone once told me that setting lock bits could potentially render a chip unprogrammable, so they no longer set lock bits when working with AVR microcontrollers. I always set them; I've never had problems overwriting a chip; and I've installed/reinstalled this firmware many times. But the xmas firmware does not require lock bits to be set to function reliably, so you might try programming the blank chip with:

Code: Select all | TOGGLE FULL SIZE
$ make install-fuse
$ make install-flash
$ make install-eeprom
It's unlikely that lock bits are your problem, but since we're considering long shots at this point, the commands above will program everything except the lock bits.

nix_clk_dd wrote:I've tried so many combinations of unplugging the power, programmer from computer/clock, etc. :(

Hang in there. It's worth spending a bit of time with Google to search for "avrdude: initialization failed, rc=-1" and see if anyone has useful advice. As a last resort, I'd be willing to take a look at your programmer and main clock board if you mail them to me. Some areas have hackerspaces where there is usually someone who knows AVR chips and programmers, so that might be another option.

jarchie
 
Posts: 591
Joined: Sun Jun 24, 2012 2:16 pm
Location: Santa Cruz, California, United States

Re: Another Ice Tube Clock Design for the Holidays

by nix_clk_dd on Sun Jul 28, 2019 11:36 pm

jarchie wrote:It might be worth turning on verbose debugging output from avrdude. Looking at the avrdude docs, this can be done by specifying the "-v" switch and specifying it multiple times will increase the debugging level. Adding the "-v -v" option to the AVRDUDEOPT macro might give some useful output.

With the programmer connected to the computer but not the clock (needs USB_VCC jumper):
Code: Select all | TOGGLE FULL SIZE
$ make install-flash
/opt/local/bin/avrdude -v -v -B 4 -P usb -c usbtiny -p atmega328p   -U flash:w:icetube_flash.hex:i

avrdude: Version 6.3, compiled on Jul 28 2019 at 14:53:34
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/opt/local/etc/avrdude.conf"
         User configuration file is "/Users/rbadm/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : usbtiny
         Setting bit clk period        : 4.0
avrdude: usbdev_open(): Found USBtinyISP, bus:device: 020:012
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Setting SCK period to 4 usec
CMD: [ac 53 00 00] [00 00 00 00]
CMD: [ac 53 00 00] [00 00 00 00]
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

make: *** [install-flash] Error 1

With programmer connected to both, the only difference:
Code: Select all | TOGGLE FULL SIZE
avrdude: Setting SCK period to 4 usec
CMD: [ac 53 00 00] [00 00 00 00]
CMD: [ac 53 00 00] [ac 7f ff ff]
Same as previous, but with -B 1000:
Code: Select all | TOGGLE FULL SIZE
avrdude: Setting SCK period to 250 usec
CMD: [ac 53 00 00] [ff c0 00 0f]
CMD: [ac 53 00 00] [e0 00 01 ff]

Edit: Looks like the the second set of values on each CMD line changes every time you run the make install-flash command, so thins can (probably) be ignored.

jarchie wrote:Someone once told me that setting lock bits could potentially render a chip unprogrammable, so they no longer set lock bits when working with AVR microcontrollers. I always set them; I've never had problems overwriting a chip; and I've installed/reinstalled this firmware many times. But the xmas firmware does not require lock bits to be set to function reliably, so you might try programming the blank chip


I will give that a try tomorrow...who knows what might work at this point :)

jarchie wrote:Hang in there. It's worth spending a bit of time with Google to search for "avrdude: initialization failed, rc=-1" and see if anyone has useful advice. As a last resort, I'd be willing to take a look at your programmer and main clock board if you mail them to me. Some areas have hackerspaces where there is usually someone who knows AVR chips and programmers, so that might be another option.


I did some Googling and found people suggesting to check all the cable connections, change the speed, etc. Pretty much everything we've done so far.
Thanks for the offer! I'll try a new chip tomorrow and then spend a little more time testing things. If no progress is made I might have you take a look at it :)

nix_clk_dd
 
Posts: 36
Joined: Tue May 21, 2019 2:15 pm

Re: Another Ice Tube Clock Design for the Holidays

by jarchie on Mon Jul 29, 2019 6:13 am

I think I found the problem. The programmer is not able to program over loaded pins and the clock has loaded pins. If you look at the schematic for your programmer there are two 1.5k resistors (R4, R7) on the data output lines (SCK, MOSI). These limit the current that can be used for programming, and since the Maxim chip draws a bit of current from these lines, the communication from the programmer to the microcontroller is bad.

By the way, the Adafruit USBtinyISP includes these resistors in the kit, but the instructions recommend using jumpers instead for a more general purpose programmer that can handle loaded pins. I had forgotten about this.

This would explain why your first programming worked. The Maxim chip wasn't installed yet. There was no load on the SCK and MOSI pins. One way to test this theory is to pull the Maxim chip and see if programming works.

Or if you don't have a PLCC puller to get the Maxim chip out, you can use extra clock parts to make a new clock board, but only install the ISP header, microcontroller socket, R10, and C11. Programming chips should work on this minimal board, and you can always turn this board into a clock later. Since the programmer will only be powering the microcontroller, you shouldn't need to worry about drawing too much power and overloading the programmer.

After you confirm that this is indeed the problem, if you'd like to program chips in already built clocks, it should be possible to find R4 and R7 in the programmer and "jumper" each one by putting a small blob of solder on top of each resistor to bypass them. My guess is that they are the two components between the buffer chip and the 8 pin header. Since they are 1.5k resistors, they might be labeled "152". With luck, they are large enough to have a label. And it's worth probing the circuit with a multimeter or following traces on the board to make absolutely sure you've identified the right resistors before bypassing them.

But if you'd rather not alter the programmer, the workaround would be to program chips in a partially built board and transfer the chips to a fully built clock. Cumbersome, but it should work.

nix_clk_dd wrote:With the programmer connected to the computer but not the clock (needs USB_VCC jumper):

I gave you bad advice before. The Adafruit USBtinyISP board has a trace on the equivalent jumper, so it is effectively always jumpered unless you cut the trace. You are right to install the USB_VCC jumper. The SEL_PGM jumper should always be off.

And from the schematic, it looks like there is no way to let the clock board power itself. Instead, the programmer will always attempt to power the clock board. This should be fine, but if you have a fully assembled clock, plug in the clock before connecting the programmer to the clock. This will ensure that the clock will not draw too much current, overloading the programmer.

jarchie
 
Posts: 591
Joined: Sun Jun 24, 2012 2:16 pm
Location: Santa Cruz, California, United States

Re: Another Ice Tube Clock Design for the Holidays

by nix_clk_dd on Tue Jul 30, 2019 4:40 pm

jarchie wrote:I think I found the problem. The programmer is not able to program over loaded pins and the clock has loaded pins. If you look at the schematic for your programmer there are two 1.5k resistors (R4, R7) on the data output lines (SCK, MOSI). These limit the current that can be used for programming, and since the Maxim chip draws a bit of current from these lines, the communication from the programmer to the microcontroller is bad.

By the way, the Adafruit USBtinyISP includes these resistors in the kit, but the instructions recommend using jumpers instead for a more general purpose programmer that can handle loaded pins. I had forgotten about this.

This would explain why your first programming worked. The Maxim chip wasn't installed yet. There was no load on the SCK and MOSI pins. One way to test this theory is to pull the Maxim chip and see if programming works.

After you confirm that this is indeed the problem, if you'd like to program chips in already built clocks, it should be possible to find R4 and R7 in the programmer and "jumper" each one by putting a small blob of solder on top of each resistor to bypass them. My guess is that they are the two components between the buffer chip and the 8 pin header. Since they are 1.5k resistors, they might be labeled "152". With luck, they are large enough to have a label. And it's worth probing the circuit with a multimeter or following traces on the board to make absolutely sure you've identified the right resistors before bypassing them.


Sorry for the delay.

Excellent detective work! :-)
You were exactly right about the R4 and R7 resistors - bypassing them fixed the programming error. When I re-flashed the chip I totally forgot that I had -B 100000 set, so it ended up taking 20 minutes, lol.

It was pretty difficult to get solder to stick to anything, so I ended up completely removing the resistors and dropping a huge blob of solder to cover the pads...might need to do a cleanup job some other time.
I'm having memories of middle school when we used to modify our Sony Playstation Portables by soldering 0603 SMD LEDs onto wires with a regular soldering iron. No idea how I managed that!

Now from my very limited knowledge of code (basisally non-existant unless simple HTML counts) , I made some tweaks to the MODE_DAYOFWEEK_DISPLAY:
Code: Select all | TOGGLE FULL SIZE
// various clock modes; current mode given by mode.state
enum {
    MODE_TIME_DISPLAY,
        MODE_CUSTOMTEXT1_DISPLAY,
        MODE_CUSTOMTEXT2_DISPLAY,
        MODE_CUSTOMTEXT3_DISPLAY
};
https://www.youtube.com/watch?v=hqXRBcKeFu8

nix_clk_dd
 
Posts: 36
Joined: Tue May 21, 2019 2:15 pm

Re: Another Ice Tube Clock Design for the Holidays

by jarchie on Wed Jul 31, 2019 1:32 am

nix_clk_dd wrote:Sorry for the delay.

No apology necessary. I wouldn't call a day or so much of a delay, but maybe I'm old fashioned.

nix_clk_dd wrote:You were exactly right about the R4 and R7 resistors - bypassing them fixed the programming error. When I re-flashed the chip I totally forgot that I had -B 100000 set, so it ended up taking 20 minutes, lol. It was pretty difficult to get solder to stick to anything, so I ended up completely removing the resistors and dropping a huge blob of solder to cover the pads...might need to do a cleanup job some other time.

I knew this would be a challenging mod when I suggested it, so I'm delighted to hear that it worked. You must be skilled with a soldering iron--large blob or not. Congratulations!

nix_clk_dd wrote:I'm having memories of middle school when we used to modify our Sony Playstation Portables by soldering 0603 SMD LEDs onto wires with a regular soldering iron. No idea how I managed that!

Sounds like fun. I know larger surface mount components can be comfortably soldered by hand. Perhaps the LEDs were larger than the resistors on your programmer?

EDIT: Having just looked at a size reference, 0603 SMD parts are definitely tiny. I guess you were always good with a soldering iron!

nix_clk_dd wrote:Now from my very limited knowledge of code (basisally non-existant unless simple HTML counts) , I made some tweaks to the MODE_DAYOFWEEK_DISPLAY: https://www.youtube.com/watch?v=hqXRBcKeFu8

Very nice. The clock firmware is pretty low-level AVR code, so I'm impressed with your ability to figure things out.

And you're very welcome, by the way. ;-) Glad I could help.


Also, if you have the time, I'd be curious to know what filament driver settings you end up using. Having never personally encountered any tubes that whine loudly with the default clock settings, it would be useful to me to know what works for you in case the issue comes up again.

jarchie
 
Posts: 591
Joined: Sun Jun 24, 2012 2:16 pm
Location: Santa Cruz, California, United States

Re: Another Ice Tube Clock Design for the Holidays

by nix_clk_dd on Wed Jul 31, 2019 3:43 pm

jarchie wrote:EDIT: Having just looked at a size reference, 0603 SMD parts are definitely tiny. I guess you were always good with a soldering iron!

I'm actually surprised that I didn't make more mistakes soldering. The only problems I noticed were that I installed the ATmega328 socket backwards (not really an issue) and probably used too much solder on the VFD wires.

The same cannot be said about the nixie clock that I built. I installed one of the tubes crooked and had to de-solder 11 wires but it took a ridiculous amount of time to "unstick" all of them. Perhaps I don't have the best tool for doing it. I also installed the plastic spacers between the tubes and PCB, forgetting that there needed to be holes for LEDs. You need to be very careful drilling to within ~1mm of glass with a drill press :O

I enjoy tinkering with small parts; one of my hobbies is working on mechanical watches (specifically Russian and Soviet) although I still have a lot to learn.

jarchie wrote:Very nice. The clock firmware is pretty low-level AVR code, so I'm impressed with your ability to figure things out.
And you're very welcome, by the way. ;-) Glad I could help.

Thanks! It helps that there were some useful comments in the code making it relatively easy to understand.
I will try going through it again this weekend and adding an additional menu item rather than modifying an existing one. Also might attempt making a new alarm!

jarchie wrote:Also, if you have the time, I'd be curious to know what filament driver settings you end up using. Having never personally encountered any tubes that whine loudly with the default clock settings, it would be useful to me to know what works for you in case the issue comes up again.

Apart from setting my birthday and disabling GPS, the only change I made to the XMAS_DESIGN config.h located in /hardware/ is the filament frequency.
I tested 215 and 255, which both made an improvement. 255 might have been a little quieter so that's what I settled with.
Code: Select all | TOGGLE FULL SIZE
#define FILAMENT_FREQUENCY_DIV 255

I have a couple more tubes (from 1981, 1983, 1984 with black background) that I can test in the near future - maybe a different tube will whine less. If you're interested to hear what the seller of these tubes said about the humming/driving the tube/red filament, let me know.
Image

nix_clk_dd
 
Posts: 36
Joined: Tue May 21, 2019 2:15 pm

Re: Another Ice Tube Clock Design for the Holidays

by jarchie on Thu Aug 01, 2019 1:49 am

nix_clk_dd wrote:I'm actually surprised that I didn't make more mistakes soldering. The only problems I noticed were that I installed the ATmega328 socket backwards (not really an issue) [...]

Sounds like the kind of mistake I would make.

You did run into more than your fair share of trouble. A noisy tube. A version of avrdude that worked fine for six years but just happened to be broken by an update while you were doing your build. A programmer that could not handle loaded pins. But you fixed it all.

nix_clk_dd wrote:I enjoy tinkering with small parts; one of my hobbies is working on mechanical watches (specifically Russian and Soviet) although I still have a lot to learn.

That sort of thing takes a attention to detail. My hat's off to you.

nix_clk_dd wrote:I will try going through it again this weekend and adding an additional menu item rather than modifying an existing one. Also might attempt making a new alarm!

The xmas firmware is mostly low-level AVR code, so modifying the firmware might be a challenge. But I'd be glad to give advice here and there if you run into trouble. Happy hacking!

nix_clk_dd wrote:I tested 215 and 255, which both made an improvement. 255 might have been a little quieter so that's what I settled with.

I appreciate your letting me know. There are also a number of small documentation updates I have pending which are a direct result of your feedback, so thank you.

nix_clk_dd wrote:If you're interested to hear what the seller of these tubes said about the humming/driving the tube/red filament, let me know.

Sure, I'd be interested.

jarchie
 
Posts: 591
Joined: Sun Jun 24, 2012 2:16 pm
Location: Santa Cruz, California, United States

Re: Another Ice Tube Clock Design for the Holidays

by nix_clk_dd on Thu Aug 01, 2019 2:50 am

jarchie wrote:You did run into more than your fair share of trouble. A noisy tube. A version of avrdude that worked fine for six years but just happened to be broken by an update while you were doing your build. A programmer that could not handle loaded pins. But you fixed it all.


I'd call it more of a group effort with you doing most of the troubleshooting :)
Thanks for all of your help!

jarchie wrote:Sure, I'd be interested.

https://pastebin.com/mKfLZxQ1

nix_clk_dd
 
Posts: 36
Joined: Tue May 21, 2019 2:15 pm

Re: Another Ice Tube Clock Design for the Holidays

by jarchie on Thu Aug 01, 2019 5:07 pm

Thank you. The sellers advice on driving IV-18 tubes seems pretty consistent with everything else I've seen so far. There are a few forum discussions on the off chance anyone wants to go deep into the weeds here (one, two, and three).

As noted in the seller's guidelines, sine wave AC would have been a guaranteed quieter way to drive these tubes, but it also would have required more bulky components and a larger overall size. Since there are a couple software workarounds to quiet nosier tubes in the firmware, I decided to go with a smaller board size and cheaper components.

jarchie
 
Posts: 591
Joined: Sun Jun 24, 2012 2:16 pm
Location: Santa Cruz, California, United States

Re: Another Ice Tube Clock Design for the Holidays

by nix_clk_dd on Sat Aug 03, 2019 4:54 pm

Where would you say is the best place to learn simple AVR programming?
From reading your code, I was able to understand it well enough and add a new menu item after "cfg regn" along with sub-menus to go with it.

Now I'm trying to create a new feature (maybe toggleable within my newly created menu once I better understand how everything works).

Added inside of mode.h:
Code: Select all | TOGGLE FULL SIZE
enum {
    MODE_TIME_DISPLAY,
        MODE_DATE_DISPLAY, // add new mode to existing clock modes
}

Inside of mode.c:
Code: Select all | TOGGLE FULL SIZE
case MODE_DATE_DISPLAY:
    mode_monthday_display(); //display month and day in 'aug 3' format
    break;

case MODE_DATE_DISPLAY:
       if(btn || ++mode.timer > 5000) {
            //activatedisplay = 0;
            mode_update(MODE_TIME_DISPLAY, DISPLAY_TRANS_UP);
       }
       return;

case MODE_TIME_DISPLAY:
       // display current time
       mode_time_display_tick();
        // show month and date every 40 seconds
        if(time.second == 40) {
            mode_update(MODE_DATE_DISPLAY, DISPLAY_TRANS_DOWN);
            }
        break;


The goal is to show the month + date OR day + month + date every minute at 40 seconds for a period of 5 seconds.
The problem, I think, is that the if(time.second == 40) function is called every time the clock ticks. This results in the date only appearing for 1 second. If I set it to >= 40 then the date will blink every second.

I thought to create a variable equal to 0 by default and only perform the mode_update when = 0
As soon mode_update executes, set the variable to 1 and then set it back to 0 after the 5 second timer. I don't even know if something like this would work, how to initialize the variable, or if there is an easy alternative to what I'm trying to do :)

nix_clk_dd
 
Posts: 36
Joined: Tue May 21, 2019 2:15 pm

Re: Another Ice Tube Clock Design for the Holidays

by jarchie on Sun Aug 04, 2019 3:17 am

The part of the code you're looking at is mostly straight C code. The book I learned C on was C Programming Language by Kernighan and Ritchie. If you delve into the parts of the code that deal with AVR, the most helpful references are the ATMEGA328P datasheet and the avr-libc Library Reference. The former provides a comprehensive description of how the microcontroller works, and the latter provides useful function and macro shortcuts for controlling chip features from the code.

The feature that you're trying to add sounds similar to an existing feature. Here's an excerpt from the firmware/USAGE file for the "cfg regn" / "date fmt" menu option.
firmware/USAGE wrote:Configure the date format. First, specify if the weekday should be shown with "wday on" or "wday off". Second, select the format of the month-day display. Third, specify if the year should be shown with "year on" or "year off". Fourth and finally, specify if the date should be automatically shown at regular intervals of 10, 30, or 60 seconds ("auto off", "auto 10", "auto 30", "auto 60").

For your particular example, I'd probably have to look at the full code. I'm guessing that the code you gave contains excerpts from different parts of mode.c, but I'm having trouble seeing the full picture. Perhaps you could do a "make clean" to remove unnecessary files, compress the firmware directory, and attach it to your next post? This forum allows zip file attachments. And as you probably already know, on a Mac, right-clicking on a directory in Finder gives a "Compress" option for making zip files.

jarchie
 
Posts: 591
Joined: Sun Jun 24, 2012 2:16 pm
Location: Santa Cruz, California, United States

Re: Another Ice Tube Clock Design for the Holidays

by rjhike on Wed Aug 14, 2019 11:00 am

My Ice Tube Clock, that I have had since 2015, fell off my desk and broke. I was able to find a replacement. I plan on using the same chip that was previously programed use the GPS and photocell dimming. But with the new clock I will only use the GPS and not the photocell dimming. Will I need to make any hardware changes since I will not be using the photocell?

rjhike
 
Posts: 15
Joined: Thu Jan 29, 2015 8:35 pm

Please be positive and constructive with your questions and comments.