0

Problem booting after programming with USBtinyISP
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Problem booting after programming with USBtinyISP

by ophir on Thu Sep 24, 2009 4:40 am

I've successfully programmed the clock's ATMEGA168v with the firmware from 8-25-09. It compiled cleanly with no errors:

Compiling: iv.c
avr-gcc -c -mmcu=atmega168 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -DF_CPU=8000000 `perl timedef.pl` -Wa,-adhlns=iv.lst -std=gnu99 -DTXMODE= iv.c -o iv.o
In file included from iv.c:34:
util.h:56:1: warning: "nop" redefined
In file included from iv.c:33:
iv.h:180:1: warning: this is the location of the previous definition
In file included from iv.c:35:
fonttable.h:30: warning: pointer targets in initialization differ in signedness
fonttable.h:44: warning: pointer targets in initialization differ in signedness
iv.c:69: warning: pointer targets in initialization differ in signedness
iv.c:77: warning: pointer targets in initialization differ in signedness

Compiling: util.c
avr-gcc -c -mmcu=atmega168 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -DF_CPU=8000000 `perl timedef.pl` -Wa,-adhlns=util.lst -std=gnu99 -DTXMODE= util.c -o util.o

Linking: iv.elf
avr-gcc -mmcu=atmega168 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -DF_CPU=8000000 `perl timedef.pl` -Wa,-adhlns=iv.o -std=gnu99 iv.o util.o --output iv.elf -Wl,-Map=iv.map,--cref

Creating load file for Flash: iv.hex
avr-objcopy -O ihex -R .eeprom iv.elf iv.hex

Creating load file for EEPROM: iv.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O ihex iv.elf iv.eep
avr-objcopy: there are no sections to be copied!
avr-objcopy: --change-section-lma .eeprom=0x00000000 never used
make: [iv.eep] Error 1 (ignored)

Creating Extended Listing: iv.lss
avr-objdump -h -S iv.elf > iv.lss

Creating Symbol Table: iv.sym
avr-nm -n iv.elf > iv.sym

Size after:
iv.elf :
section size addr
.data 244 8388864
.text 8376 0
.bss 44 8389108
.stab 19344 0
.stabstr 4714 0
Total 32722



Errors: none
-------- end --------

I then uploaded the code:

Mini-Me:firmware 08-25-09 ophir$ avrdude -c usbtiny -p atmega168 -U flash:w:iv.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9406
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 "iv.hex"
avrdude: input file iv.hex auto detected as Intel Hex
avrdude: writing flash (8620 bytes):

Writing | ################################################## | 100% 5.14s



avrdude: 8620 bytes of flash written
avrdude: verifying flash memory against iv.hex:
avrdude: load data flash data from input file iv.hex:
avrdude: input file iv.hex auto detected as Intel Hex
avrdude: input file iv.hex contains 8620 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 4.52s



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

avrdude: safemode: Fuses OK

avrdude done. Thank you.


But now when I pull out the plug and plug it back in, the VFD does not come on and the clock does not beep.

If I attempt to program it again (with the VFD in place - it must be removed in order for avrdude to communicate with the clock), the programming fails:

Mini-Me:iceclock-io ophir$ avrdude -c usbtiny -p atmega168 -U flash:w:iv.hex

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

avrdude done. Thank you.

Here's the intriguing part... after this failure, the clock beeps and the VFD lights up as normal.

Any thoughts as to why the clock does not boot upon being plugged in? Again I am using the vanilla firmware from 8-25-09. I may be missing something very evident to folks here... I am a totally newbie.

Thank you... what a fun project. :)

-Ophir
ophir
 
Posts: 7
Joined: Thu Sep 24, 2009 3:22 am

Re: Problem booting after programming with USBtinyISP

by adafruit on Thu Sep 24, 2009 9:56 am

did you disconnect the programmer? also, dont have the backup battery in. it sounds like its just not resetting

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Problem booting after programming with USBtinyISP

by ophir on Thu Sep 24, 2009 1:27 pm

Removing the battery did the trick!

Thanks. :)

-O
ophir
 
Posts: 7
Joined: Thu Sep 24, 2009 3:22 am

Re: Problem booting after programming with USBtinyISP

by ophir on Thu Sep 24, 2009 3:02 pm

Not quite resolved. Here is what is happening (this after a successful upload of the vanilla firmware 8-25-09):

Initial state: clock does not boot after first removal/re-insertion of power. Initial solution = remove battery

However pulling power again (this time with the battery) results in the following sequence:

1) Remove power, remove the battery, re-insert power = clock boots (beeps and turns on)
2) Remove power, re-insert the battery and then re-insert power = clock boots
3) Remove power, re-insert power = no boot

Removing the battery again brings it back to life but you are now back at step 1.

Thoughts?

Thanks!

-Ophir
ophir
 
Posts: 7
Joined: Thu Sep 24, 2009 3:22 am

Re: Problem booting after programming with USBtinyISP

by adafruit on Thu Sep 24, 2009 5:14 pm

why are you reinserting the battery?
keep the battery out

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Problem booting after programming with USBtinyISP

by ophir on Thu Sep 24, 2009 9:06 pm

?

So that I can put the kit in its case and have battery backup for the clock.
ophir
 
Posts: 7
Joined: Thu Sep 24, 2009 3:22 am

Re: Problem booting after programming with USBtinyISP

by adafruit on Thu Sep 24, 2009 10:05 pm

if the battery is giving you trouble while you are trying to upload and modify code, it would appear that you should leave the battery out while trying to upload and modify code.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Problem booting after programming with USBtinyISP

by ophir on Sun Sep 27, 2009 5:52 pm

Sorry about the confusion.

I was referring to reinserting the battery post upload and verification... i.e. code working and next step being putting the clock back into the enclosure.

Will explore a bit more and report on what I find regarding the issue of the hang on boot.
ophir
 
Posts: 7
Joined: Thu Sep 24, 2009 3:22 am

Please be positive and constructive with your questions and comments.