Author Topic: Run Digispark @ 3.3V (no reprogramming)  (Read 8183 times)

matzrh

  • Newbie
  • *
  • Posts: 2
Run Digispark @ 3.3V (no reprogramming)
« on: February 19, 2013, 02:07:44 pm »
For a RF12 project, I am wondering if I could run the digispark at 3.3V after I uploaded the sketch and without any USB device connected.
The ATTiny85 is 3.3V compatible, the clock would run slower, but maybe F_CPU should be adjusted to a lower value, to be safe.
But I could design a board with a 3.3V voltage on it, only and would not have to use another regulator.


What do you think?  Is there anything I am missing that would make it blow up?

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Re: Run Digispark @ 3.3V (no reprogramming)
« Reply #1 on: February 19, 2013, 03:34:19 pm »
Give it a go? I'm not sure what the brownout setting of the digispark is if indeed there is any.


To change the clock speed to 8mhz, use this function:


Code: [Select]
#define CLOCK_SPEED_16MHZ 0
#define CLOCK_SPEED_8MHZ 1
#define CLOCK_SPEED_4MHZ 2
#define CLOCK_SPEED_2MHZ 3
#define CLOCK_SPEED_1MHZ 4
#define CLOCK_SPEED_500KHZ 5
#define CLOCK_SPEED_250KHZ 6
#define CLOCK_SPEED_125KHZ 7
volatile void setClockSpeed(byte speed) {
  CLKPR = 0b10000000; // enable clock change
  CLKPR = speed;
}


and call it from setup() as setClockSpeed(CLOCK_SPEED_8MHZ);


F_CPU will still be wrong though because it will still think the clock speed is 16.5mhz - this causes everything to run half as quick, including delays.