Search code examples
arduinoserial-portavrclockat-command

Configuring ATtiny85 to use external 8MHz oscillator?


I am using an ATtiny85 8 pin AVR to send AT commands to an RN42 Bluetooth module. I am programming the AVR using an Arduino as an ISP therefore writing the code in the Arduino IDE, using the SoftwareSerial library as the AVR has no UART port.

To ensure accurate clocking out of the data I have added an 8MHz oscillator (LFSPXO018045) on pin 2 but I'm not sure how to make sure the AVR is using this and not just defaulting to the internal osc. I've seen mention of "Fuses" that need setting? Is there any in-code things I need to do like set a register flag or any pre-scalers?

Here is the Eagle circuit and option I found so far but don't know if there's anything else that needs doing too?: PCB & IDE

By the way this is my first question so please be lenient if I've missed something!


Solution

  • Clock settings of AVR MCUs can be changed via using the dedicated Fuse bits. These Fuse bits unfortunately cannot be modified from software. The only way to program the Fuse bits is either using a JTAG programmer or an ISP programmer (like: USBasp, AVRISP mkII or you can use an Arduino as an ISP programmer with the right sketch on it).

    This AVR Fuse calculator tool can be used to determine what settings and Fuse values you need to program.