I want to set my Digispark to run on 1Mhz (so it can run on coin cell batteries, even those that are not very new).
First I tried using it "on the fly" adding a code to my sketch. I could see the code worked, but when the Digispark is initialising it still runs on 16MHz (or 16.5?) so with low batteries (2.6V) it wouldn't start. Then I also tried to upload my code using the board option for 1MHz on Arduino IDE, but probably this gives the same result as I couldn't make it work on my battery (2.6V).
So I decided to try uploading a new bootloader (I already learned how to do this with micronucleus) but I'm not sure where to change this setting on the bootloaderconfig.h file. The file states:
#define USB_CFG_CLOCK_KHZ (F_CPU/1000)
/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000,
* 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code
* require no crystal, they tolerate +/- 1% deviation from the nominal
* frequency. All other rates require a precision of 2000 ppm and thus a
* crystal!
* Since F_CPU should be defined to your actual clock rate anyway, you should
* not need to modify this setting.
*/
So what should I change to make it 1Mhz?
After doing this, I just have to compile it using AVR-GCC right? I appreciate any help, thanks!