Hi, i'm fairly new to AVRs, electronics is a hobby of mine since I bought an Arduino Uno R3 about a year ago.
I would like to know if it would be possible to program a new prebootloaded Atmega328p simply by inserting it in a ZIF socket on my Arduino Uno.
It would save some cash to buying a programming board and cable or a new Arduino board, and i could then move the chip to a perfboard so I can make one of my projects permanent but still use my Arduino for prototyping.
I will use an external 16 mhz crystal and select Uno, so no worries
The Atmega328p is supposed to include Uno's bootloader, check the link I inlcuded earlier
I am making a Wifi Power Outage Detector for my family's cottage in the woods, power outages happen often and can be dangerous during winter! Maybe I will post the project in the home automation forum.
CrossRoads:
Both tho use external crystal tho, while reply #3 was suggesting changing to internal oscillator.
I didn't think that made a difference for compiling and downloading sketches, only for fuse settings when programming the bootloader. Is there something I'm missing?
Once bootloaded, serial downloads require the hardware & software settings to match.
If the IDE expectst to see a bootloader & fuses set for 16 MHz external crystal, and your part is set for MHz internal, things are not going to work.
CrossRoads:
Once bootloaded, serial downloads require the hardware & software settings to match.
If the IDE expectst to see a bootloader & fuses set for 16 MHz external crystal, and your part is set for MHz internal, things are not going to work.
I'm talking about with a booloader built for 8Mhz internal RC oscillator too.
I said to select a 8Mhz board for the target from the IDE. When your code compiles, F_CPU is going to be 8000000L, and it makes no difference if it is an 8Mhz RC oscillator or crystal on the board the code gets downloaded to. Timings will work the same - for example delayMicroseconds will compile to delay 8 cycles microsecond. The internal RC oscillator will not be dead on 8Mhz, but on every AVR I've used, and every AVR I've seen others use the internal RC oscillator is within +-2%, and that timing is fine for serial downloading at 57.6kbps, and most of the time at 115,200 kbps. I've even tested my half-duplex serial UART code with a couple of ATTiny85's running at 16Mhz (internal 8Mhz oscillator x2 using PLL), and serial communication was error-free up to 460.8kbps.
If someone is really unlucky and gets a badly tuned RC oscillator, it can be brought within 1% using OSCCAL tuning techniques such as AVR053.
My experience has only been with 16 MHz crystal equipped chips. I'd be surprised to see 8 MHz internal bootloaded part work when 16 MHz external crystal board type is selected - but hey, the IDE just may do it.
CrossRoads:
My experience has only been with 16 MHz crystal equipped chips. I'd be surprised to see 8 MHz internal bootloaded part work when 16 MHz external crystal board type is selected - but hey, the IDE just may do it.
Using the 8Mhz internal oscillator and selecting a 16Mhz board type wouldn't work, which is why I said he should choose the 3.3v @8Mhz Arduino Pro mini if using the internal RC oscillator.
And now that I think of it, if optiboot is the bootloader (which uses 115.2kbps) already installed on the chip, he doesn't have to install a new bootloader to use the internal RC oscillator; just use 57.6kbps instead of 115.2kbps for downloading since it's running at half speed.