I am attempting to set up V-USB on my ATmega8-16PU (datasheet), and could use some help hooking up an external crystal clock source to it. I have tried to understand the datasheet to the best of my ability, and have drawn a few conclusions which I would appreciate if someone could verify and critique. For reference, I will be using a 16 MHz or 20 MHz crystal, which I also need help deciding between.
Here is my plan so far, based on my understanding:
- Attach my external crystal (two pin one), to the XTAL1 and XTAL2 pins of the IC
- Use two 22pF ceramic capacitors
- Based on Table 2 of Page 26, CKSEL3..0 has to be 1111-1010
- CKOPT will be unprogrammed (based on the description at the top of page 27) because I don't need a large output swing, not am I driving anything else with the crystal
- CKSEL3..1 has to be 101, 110, or 111 because my crystal is greater than 1 MHz
- CKSEL0 has to be set to 1, and SUT1..0 to 11 (based on table 5 on page 28) because I want to allow the maximum start up time to play it safe
Right, so I have taken these notes, and don't know where to go from here. For example:
- What are all these things (CKSEL3..1, CKSEL3..0, etc.), and how do I know which value to choose for CKSEL3..0 and CKSEL3..1 if I am given an array of options to choose from?
- What do I need to change, and how do I set the fuse bits to enable these settings? I am using avrdude to program my microcontroller.
- Do I need to use a watchdog? If I do, it doesn't seem like there are any settings to enable or disable it (bottom of page 26), or is it always enabled?
Thanks, everybody. Sorry about all these questions, I am very new to all of this, but am determined to learn.