no external crystal 16Mhz after loading bootloader

hi all,

I have no external crystal oscillator (16Mhz) with my atmega88P after I burned the bootloader into it. I used my Uno atmega328P board to burn the bootloader to my plain atmega88P and it successfully burned. I placed atmega88P into my Uno board and I uploaded the led blinking example and it worked fine. However, I check the external 16Mhz crystal oscillator by oscilloscope and the signal just 0V. I wonder whether the bootloader when I burn is configured to run the internal clock instead of external. Anybody has any ideas why this happens.
Please help, big appreciated !!!

It is not surprising you don't see 16 MHz with the scope as it will effect the oscillator.
If blink works at the proper timing, then oscillator is OK.

hi LarryD,

Thanks for your input. But when I put my atmega328P into my Uno board and checked the external crystal, I see 16Mhz sinewave. I expect to see the same crystal frequency (16Mhz sinewave) with my atmega88P when I put it into Uno board? Do you think atmega88P can work in Uno board? If yes, why did not I see the frequency?

Thanks again in advance for your kind explanation.

It may be a hardware difference between the devices.
I had a "some what" similar situation with 1284 low power operation vs full swing.

hi LarryD,

I need to have the precise external crystal oscillator for my project. Do you have any ideas how can I check with my atmega88P to make sure it using the external clock?

Thanks again very much.

You may be able to feed the Osc to an external CMOS gate and use it to buffer the signal.
You could bend the osc pin 90' so it makes no connection. If things still work then the osc is not used.

What fuse values are you using for your ATmega88? It's not one of the standard arduino CPUs that sis present in the "production" boards.txt file...

hi LarryD,

Thanks for your input. I try it if I can.

hi Westfw,

[/What fuse values are you using for your ATmega88?quote]

to be honest, I do not know what fuse I am using for my Atmega88. I guess in order to run external clock, the Atmega88 has to see CKSEL is 0000. How do I check what the fuse I am using?

Thanks for all the help.

Hi all,

I still have the problem with external clock and would like to ask more input from you:

I know that after I burned the bootloader into my atmega88P and uploading the blinking example, I measured the blinking frequency and saw that 2 seconds on and 2 seconds off, but the blinking example code has one 1 second on and 1 second off. So it means that the atmega88P using its own internal 8Mhz frequency instead of external 16Mhz crystal. By the way, I used the atmega88P boards.txt as follow to burn the bootloader:

##############################################################

avr88p.name=ATmega88P / Int. 8MHz
avr88p.upload.using=arduino:arduinoisp
avr88p.upload.maximum_size=8192

avr88p.bootloader.low_fuses=0xe2
avr88p.bootloader.high_fuses=0xdf
avr88p.bootloader.extended_fuses=0x07
avr88p.bootloader.path=optiboot
avr88p.bootloader.file=88p-8.hex
avr88p.bootloader.unlock_bits=0x3F
avr88p.bootloader.lock_bits=0x3F

avr88p.build.mcu=atmega88p
avr88p.build.f_cpu=8000000L
avr88p.build.core=atmega88p
avr88p.build.variant=standard

##############################################################

anybody knows what's parameters or fuses that I should change from boards.txt or any others files to make the atmega88P using an external crystal instead of its internal clock after burning the bootloader? Thanks in advance.

to be honest, I do not know what fuse I am using for my Atmega88. I guess in order to run external clock, the Atmega88 has to see CKSEL is 0000. How do I check what the fuse I am using?

Find out!

http://www.gammon.com.au/forum/?id=11633

Then use the Fuse Calculator to understand what is happening...
http://www.engbedded.com/fusecalc

Never guess about fuses.

sonh:
I need to have the precise external crystal oscillator for my project. Do you have any ideas how can I check with my atmega88P to make sure it using the external clock?

Try this sketch:

void setup()
{
   cli();
   DDRB |= 1;
   while (1) {
     PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  
     PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  
     PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  
     PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  
     PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  PINB=1;  
   }
}
void loop()
{
}

That will output an 8MHz square wave on pin 8 (PORT B, pin0) if you're running at 16MHz.

hi fungus & mrburnette,

sorry for slow response. My objective is using the internal 8Mhz clock to upload the bootloader into atmega88P, but after it has the bootloader and I upload the code, then I put it in breadboard and connect pin9 and pin10 to external 16Mhz crystal, I power it up, then I should see it running with 16Mhz crystal clock instead or its own internal 8Mhz.
is this possible to do? if yes, can you help to give me some instruction or tutorial how to do this. I appreciate your help very much.

sonh:
hi fungus & mrburnette,

sorry for slow response. My objective is using the internal 8Mhz clock to upload the bootloader into atmega88P, but after it has the bootloader and I upload the code, then I put it in breadboard and connect pin9 and pin10 to external 16Mhz crystal, I power it up, then I should see it running with 16Mhz crystal clock instead or its own internal 8Mhz.
is this possible to do? if yes, can you help to give me some instruction or tutorial how to do this. I appreciate your help very much.

Only will work once with factory fuse settings. After you set for external xtal this will not work unless you put fuses back to use internal RC.

hi mrburnette,

Only will work once with factory fuse settings. After you set for external xtal this will not work unless you put fuses back to use internal RC.

sorry I am still confused what you said. you mean because I am using 8Mhz internal clock during burning the bootloader, then after it has the bootloader, it will run at 8Mhz internal RC clock?

thanks for your explanation.

OK, we need a more detailed sequence of steps you wish to use.

Assumptions:

You are starting with a chip that it's fuse bytes set such that is using it's internal R/C clock source, speed does not really matter when burning a bootloader via using a ISP hardware programmer. I think factory default is internal R/C clock with divide by 8 option = 1MHZ clock.

You load a bootloader: How, with the Arduino IDE using a hardware ISP programmer, yes or no?

Which bootloader will you be using?

Lefty

hi retrolefty,

You load a bootloader: How, with the Arduino IDE using a hardware ISP programmer, yes or no?

  1. yes. By the way, I used my arduino UNO board that runs with atmega328P to burn the bootloader to my plain atmega88P.
  2. I down load the zip file at: http://mypocket-technologies.com/2013/09/bootload-an-atmel-atmega88p/
  3. unzip it and put it into: C:\Documents and Settings\stran\Desktop\arduino-1.0.5-windows\arduino-1.0.5\hardware\tools
  4. follow the instruction and burn it.

Which bootloader will you be using?

I am not sure, I guess since I download the zip file from: http://mypocket-technologies.com/2013/09/bootload-an-atmel-atmega88p/ and I choose it in the boards when I burn the bootloader, it should be the atmega88P bootloader.

Thanks in advance for your feedback

When you burn a bootloader from the arduino IDE the IDE selects what bootloader and fuse byte values to use based on the board selection menu you select. So as there are no IDE board types that use the atmega88p I'm not sure there is a valid way to use the IDE to burn the bootloader to your target. Only if you can determine that one of the older boards, like arduino N/G or older with ATmega8 bootloader and fuse byte values will work with your 88p.

Now if you know how to use AVRDUDE in it's standalone you could load your new bootloader file manually via command line mode, but that's beyond my experiance level to help. And that still leaves unanswered of what fuse byte values you need for your 88p chip. The IDE burns both the fuse bytes and bootloader when you use the IDE using fuse byte values stored in the board type selection entry in a file named boards.txt.

Is there a reason you have to use the 88p chip, it does complicate the whole process? Once you do get a bootloader loaded on the 88p chip, were you planning on using the the IDE to upload sketches to it? Again unless the 88p matches the old ATmega8 defined board there are bound to be other problems crop up.

Lefty

Now if you know how to use AVRDUDE in it's standalone you could load your new bootloader file manually via command line mode,

Syntax for AVRDUDE:
http://www.hackster.io/rayburne/avr-firmware-duplicator?offset=5&ref=user&ref_id=506

Ray

hi Lefty,

thanks for your detail explanation.

Is there a reason you have to use the 88p chip, it does complicate the whole process?

my code size is around 6k to 7k and I can't use atmega168P or atmega328P because I don't want to add cost to my BOM.

Once you do get a bootloader loaded on the 88p chip, were you planning on using the the IDE to upload sketches to it?

yes. in fact, I already upload the blink example code, put it into breadboard, connect power 5V and ground to the chip, and pin9 and pin10 to 16Mhz xtal, and it works and blinking the led, but I measure the xtal clock by oscilloscope and see no clock. That's why I am seeking help to debug the external xtal clock since I need the precise clock for my application.

any suggestions would be highly appreciate.

yes. in fact, I already upload the blink example code, put it into breadboard, connect power 5V and ground to the chip, and pin9 and pin10 to 16Mhz xtal, and it works and blinking the led, but I measure the xtal clock by oscilloscope and see no clock. That's why I am seeking help to debug the external xtal clock since I need the precise clock for my application.

any suggestions would be highly appreciate.

What board type did you use when you uploaded the blink sketch to the chip?