A much better way is to include a 6-pin ICSP header on your PCB, then you can (re)program the chip in-situ.
if in addition you do not need accurate timing and are happy to run the chip at 8MHz (or even lower), then you don't need the resonator, because you can use the built-in oscillator.
I had read this, though I don't really know what it means. Can you explain the relationship between the crystal, oscillator, and timing please? Why is 8Mhz not accurate but 16Mhz is accurate timing?
- if you are going to program via ICSP, then you can get the atmega328p without the bootloader installed and save a small amount of money;
Quote from: dave84 on Sep 16, 2013, 05:05 pmI had read this, though I don't really know what it means. Can you explain the relationship between the crystal, oscillator, and timing please? Why is 8Mhz not accurate but 16Mhz is accurate timing?The atmega328p requires a clock. This is a timing signal that controls the internal workings of the device and how fast things happen. The maximum supported by the atmega328p is 20MHz using a 5V supply.To generate the clock, you have three options:1. Use an oscillator built-in to the chip. Its frequency is nominally 8MHz, with an accuracy of +/-10%. A blank atmega328p will have the fuses set to divide this by 8 (so you get a 1MHz clock), but you can reprogram the fuse to get the full 8MHz. There is a calibration mechanism you can use to improve the accuracy at a particular supply voltage.2. Connect a crystal or ceramic resonator to the chip. This uses up 2 pins, which are no longer available as inputs or outputs. This is the standard configuration of an Arduino. The clock accuracy is around +/- 0.5% if you use a ceramic resonator, and 0.05% if you use a crystal.3. Supply a clock signal yourself, for example from a temperature-controlled oscillator if you need very precise timing, or from some oscillator that you need for other reasons. This uses up 1 pin.So if timing accuracy of 10% is good enough for your application and you don't need to do serial comms (which require better accuracy than that), and 8MHz is fast enough, then you can use the internal oscillator. Otherwise, if 0.5% is accurate enough, then a 3-terminal ceramic resonator is simple and cheap. Otherwise, use a crystal and 2 capacitors.
Just making sure:Are you aware of the difference between programming the chips through the ICSP header vs USB TTL?
I am confused. I thought you needed a bootloader to 'listen' to the tx and rx ports of the uC (USB to TTL) to receive the program and write it itself in its flash, and this did not depend on external or internal resonator. As long as the bootloader of the chip is 'listening', it does not matter? Am I missing something?
The pro-mini fits into a 24-pin wide (0.6") socket
My understanding, having gotten 1/4 the way through the digital design book is as follows:Clock signals drive all digital processes. Without a clock signal, the processor does not know when the value is "ready" to be written, nor could it "understand" the signals being received as data. The bootloader itself won't even run without a clock signal.The resonator / crystal supplies the clock signal source.
Specifically that you cannot program using the USB (or any other serial) TTL adaptor unless you are clocking the chip with a resonator or crystal.To program without the resonator or crystal, you need an ISP (which can include an Arduino running an ISP sketch) and you need an ISP to program the chip in order to select whether you are using a resonator/ crystal or not.
Quote from: aarondc on Sep 16, 2013, 10:47 amThe pro-mini fits into a 24-pin wide (0.6") socket Does this hold true if you are using the analog pins with the unusual "interior" locations? I've always wondered how one would use those pins if one was mounting the Pro Mini in a female header, vs. soldering direct to the Mini's PCB.
I understand that part, but the quote below from Paul___B seems to indicate that you need an external resonator or crystal (is external implied here?) for the 328P to operate and use TTL serial, but the 328p comes with an internal resonator if you chose to use it (by setting the fuses appropriately I understand).... My question is really: can the chip run and read TTL by using the internal resonator?
The chip cannot reliably do serial communications using the internal resonator. Serial comms requires that the clocks at either end of the comms link are accurate to within about 4% of each other. Therefore, if the clock of the external device (e.g. the FTDI cable you are using to connect the microcontroller to USB) is accurate, then the 328P clock needs to be accurate to within 4%. This is not guaranteed when using the internal oscillator, which is guaranteed to be within 10% at one particular supply voltage (I forget which voltage). Therefore, programming via serial comms and a bootloader is not recommended when using the internal oscillator.However, when building a standalone device, programming is usually done via ICSP instead of via a bootloader (whether or not the internal clock is used). The clock timing is not critical when programming via ICSP.