Go Down

Topic: UNO as ISP? (Read 24200 times) previous topic - next topic

GianfrancoPa


Interesting.

Tried out the method, including the change to maximum upload size.

it all worked like a dream, the only thing is this:

I uploaded the blink sketch, and it did blink the LED but on for 15sec and off for 15sec instead of on for 1 and off one. Sounds to me, (still new to arduino) that the chip is running at a different speed to the original UNO one.

Looked at the markings on the chips.... both are AtMega 328P-PU but there is another number next to the ATMEL logo. It is 1050 on the original Uno one and 1107 on my new ones....

So 3 questions I guess:
1) what are these different numbers for?
2) does it signify a difference between the chips?
3) why is everything working but running 15, (or 16) times slower?

Many thanks.


Are you using a stand alone Arduino? Internal or external clock?
Gianfranco

DaveyK


Are you using a stand alone Arduino? Internal or external clock?


Yes, standalone arduino, (which I know is working by testing my original chip) with an external clock.

I was thinking since my last post, is a possible cause that the clock on my breadboard is not working correctly.

DaveyK

I fear I might be heading off at a tangent here.... let me know if you think a new topic would be better for this.


Thanks for the questions Coding Badly. In order to try and answer them, some back ground will probably help.

I'm still only a couple of months into my Arduino adventure, as I think I have something learned and sorted, it seems to unearth at least 2 more concepts to get my head around!! This post is a perfect example of such a case.

Arduino has really inspired me to get back into hobby electronics, and I've enjoyed working through the examples in a couple of books and on-line. I have reached the point however where I want to build a couple of simple (physical) games. At this stage no serial capabilities of the installation are important, (other than programming) and I obviously don't want to have to buy a complete Arduino board to sacrifice into each project.... and I've really enjoyed learning to solder again and make my own strip board version.

My sticking point is in the uploading of sketches hence my interest here. I've bought some (blank) chips and want to use the method above to get a sketch on there before moving the chip into the project standalone board...

it has all worked apart from in the correct time scale.

So to answer your questions......

1. Do you plan to run one or more processors from the internal oscillator?  At 1 MHz or 8 MHz?

I thought I was using an external but does the internal oscillator come into play together with the external one?

2. Do you plan to run one or more processors from an external crystal?

I was planning just one.

3. Which clocking is most important?  Internal oscillator or external crystal?

I thought the external was a better one to use but correct me if I'm wrong.

4. Are you going through this exercise as a learning experience?  Do you want to understand fuses and how to set them?  Or do you just want to program via an ISP?

Happy to learn stuff along the way but I guess this step is a means to an end.... I would just like to be able to program my chips.

5. Do you plan to do none, some, or most of your future programming through an ISP?

I would like to use this method to simply program all of my future chips.

mmcp42

those magic numbers you mentioned are, I believe, the date code
as such, they are less than exciting!

1050 is 2010 week 50
1107 is 2011 week 7
there are only 10 types of people
them that understands binary
and them that doesn't

DaveyK


those magic numbers you mentioned are, I believe, the date code
as such, they are less than exciting!

1050 is 2010 week 50
1107 is 2011 week 7


Thanks for the reply, that's a likely explanation that stacks up with when they were bought.

johnwasser


3) why is everything working but running 15, (or 16) times slower?


If the configuration fuses are still set to the Atmel factory default the chips will use the 8 MHz internal clock and pre-load the clock prescaler register to divide the clock by 8.  That will cause the processor to run at 1 MHz.  If you burn an Arduino bootloader on the chip, part of the process is setting the fuses is to set the fuses to select the external crystal/resonator and pre-load the clock prescaler register to divide the clock by 1 to get a 16 MHz clock.

You need to set the fuses.  Read the ATmega datasheet to find out what all the fuses do.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

DaveyK



3) why is everything working but running 15, (or 16) times slower?


If the configuration fuses are still set to the Atmel factory default the chips will use the 8 MHz internal clock and pre-load the clock prescaler register to divide the clock by 8.  That will cause the processor to run at 1 MHz.  If you burn an Arduino bootloader on the chip, part of the process is setting the fuses is to set the fuses to select the external crystal/resonator and pre-load the clock prescaler register to divide the clock by 1 to get a 16 MHz clock.

You need to set the fuses.  Read the ATmega datasheet to find out what all the fuses do.


So I need to burn the bootloader first then... this will take care of the fuse settings. Then proceed to upload the sketches.

Right?

johnwasser

If you burn a bootloader that will lock the bootloader area.  If your intent was to use the entire memory space for your program by not having a bootloader and using an ISP instead then you will need a customized set of fuse settings.  Read the datasheet.  You can set fuses with avrdude (which is what Arduino does).

Note: you can set the fuses in such a way that you disable the reset pin and/or disable ISP programming.  Just be careful.  You can look in BOARDS.TXT to see the Arduino fuse settings are for various boards.  That will help you understand what the datasheet is talking about.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

Coding Badly

Quote
1. Do you plan to run one or more processors from the internal oscillator?  At 1 MHz or 8 MHz?
I thought I was using an external but does the internal oscillator come into play together with the external one?


The most popular clocking options seem to be: external crystal @ 16 MHz and internal crystal @ 8 MHz.  From the factory, the processor is running at a third option: internal crystal @ 1 MHz.

So, no, you are not yet using an external crystal.  The fuses have to be changed for that to happen.

Quote
2. Do you plan to run one or more processors from an external crystal?  I was planning just one.


Got it.

Quote
3. Which clocking is most important?  Internal oscillator or external crystal?  I thought the external was a better one to use but correct me if I'm wrong.


External crystal: more accurate (better than 100 ppm), requires three external components, uses more power.

Internal oscillator (@ 8 MHz): less accurate (±10% from the factory; ±1% if you tune), requires no external components, uses less power.

Internal oscillator (@ 1 MHz): less accurate (±10% from the factory; ±1% if you tune), requires no external components, uses even less power, allows the processor voltage to be lowered, some Arduino functions do not work correctly.

Which of those seems the most appropriate for your application?

Quote
4. Are you going through this exercise as a learning experience?  Do you want to understand fuses and how to set them?  Or do you just want to program via an ISP?
Happy to learn stuff along the way but I guess this step is a means to an end.... I would just like to be able to program my chips.


Got it.

Quote
5. Do you plan to do none, some, or most of your future programming through an ISP?
I would like to use this method to simply program all of my future chips.


Got it.

DaveyK

RESULT!

Uploaded the bootloader, then the sketch. All timing issues seem to be fixed and the LED is blinking as planned.

I realise the bootlader will take up a little of the memory but this is suiting my needs for now.

Thanks for all the help guys, the power of this forum is such a great thing.... really appreciated.

Just one more question how important is the order of all the connections? I was wondering about soldering the components together on a DIY shield made from strip board for programming. presumably I could just clip the shield onto the arduino when I need to program the chip..... the purpose of all this remember is to leave the geniune UNO well alone.

Go Up