Issues with ATMega 88 using Lilypad

Hi -

I've got a new board I'm trying to bring up with an ATMega88P which I am programming via AVR Tools through the ICSP header. There's no crystal and I currently have the following fuse settings:

  • Boot Flash section size=128 words
  • Brown out detection disabled
  • Int. RC osc. 8MHz Startup time + 65ms (default)

I'm writing the code in Arduino 0015, compiling it, grabbing the hex file, and programming it onto the board via ICSP.

I think there's some kind of timing issue because even the blink program doesn't work. The LED comes on and stays on. I can switch to other digital pins and the right LED always comes on, but delay() doesn't work. I tried inserting a for() loop just to count to 1000 and do some simple operation in the loop. That does something similar to a PWM when I look at the pin output on a logic analyzer so there's obviously something working.

I need serial and other timed communication working on this so I want to make sure the clock is being interpreted correctly. Any suggestions?

Thanks!

What CPU (board menu) are you telling the arduino environment you are using? I don't think that the mega88 has ever been "supported." It is more like a mega168 than a mega8 (timers and whatnot), so code compiled for 168 MIGHT work, but I don't think it will work right with mega8 code.

Setting the boot flash section size to 128 when you don't have a bootloader in there doesn't seem like such a good idea, either, although I don't know if it would really cause any problems.

There is support for the 88 and even the 48 in the core code, although I'm not sure how official it is.

I'd guess that the bootloader fuses are the problem.

FYI, here are the fuse settings and boards.txt entry I used for the ATmega48; it may help you with the 88, or at least offer hints, even though the 48 doesn't support a bootloader IIRC:

 avrdude -p m48  -b 115200 -P usb -c avrispmkII -F -V -e -u -U lock:w:0x3f:m -U efuse:w:0xff:m -U hfuse:w:0xdd:m  -U lfuse:w:0xe2:m

AVRISPmkII-48-8MHz.name=AVRISPmkII to 8MHz ATmega48

AVRISPmkII-48-8MHz.upload.protocol=stk500v2
AVRISPmkII-48-8MHz.upload.maximum_size=4096
AVRISPmkII-48-8MHz.upload.using=avrispmkii

AVRISPmkII-48-8MHz.build.mcu=atmega48
AVRISPmkII-48-8MHz.build.f_cpu=8000000L
AVRISPmkII-48-8MHz.build.core=arduino

-j

@westfw

Using Lilypad from the board menu since I don't have an oscillator. I played with the other bootloader size options and that didn't seem to make much of a difference.

@kg4wsf

My fuse settings end up being 0xFF 0xDF and 0xE2 similar to yours except your middle one is 0xDD. Anyone know the difference?

My fuse settings end up being 0xFF 0xDF and 0xE2 similar to yours except your middle one is 0xDD. Anyone know the difference?

Brownout detection. You have it disabled, I have it set to 2.7V.

-j

There is support for the 88 and even the 48 in the core code, although I'm not sure how official it is.

Really? I didn't see anything specific in Arduino15 cores (no occurances of "48" or "88" in all the core source.) On the other hand, almost all of the conditionals are of the form:

#if defined(__AVR_ATmega8__)
  // atmega8 code
#else
  // atmega168 code
#endif

which SHOULD generally work on 48/88 as well as 168, since the 48/88/168328 are all essentially similar, while the mega8 is "different." (hmm. No occurences of "328" in the core either!)

The mega88 and mega168 are NOT binary code compatible. The interrupt vector table on the mega168 has a different size.