modifying SoftPWM for attiny

Hi,

Here are more tests, but they leave me even more puzzled.

What I did was first to focus on one single led, and triggering it on and off with a 1 second delay (in theory) in between. So the code is:

#include "SoftPWM.h"

void setup() {
  SoftPWMBegin(SOFTPWM_INVERTED);
  SoftPWMSetFadeTime(8, 0, 0);
}

void loop() {
  delay(1000);
  SoftPWMSet(8, 255);
  delay(1000);
  SoftPWMSet(8, 0);
}

What I observe is that the led goes on and off with a 32 second period instead of 2 (so delay takes 16 times more time than it should.

Then I thought I might debug when the interrupt handler is triggered, so I've added "pinMode(14, OUTPUT);" to the setup and "digitalWrite(14, 1-digitalRead(14));" as the first line of the ISR implementation.

The scope shows that pin 14 has a pulse every ms (meaning the ISR gets triggered twice in a row), while the pmw output in active state is almost always ON, except a small glitch every 125ms (See captures).

I really don't understand what's going on, because when I triggered all the leds yesterday, I had the feeling that delay() was passing way too fast (and that was also the observation by Marvin Martian before he found the issue), while now time passes 16 times too slowly...

I also checked the ATTiny core source declaration and for the 2313, it confirms what Coding Badly said:

#define TIMER_TO_USE_FOR_MILLIS 0

So I don't see where the conflict comes from...

(oh, and yes, it's an actual conflict, because I also checked that fuses were properly burnt by removing calls to softPWM and using digitalWrite(), and in that case, the 1000ms delay is OK.)

@vapor20, I know it was 18 months, but if you're still around, do you remember the way you "changed the timers used in .cpp" ? The only static references to timers I find are in the "#ifdef WIRING" sections, which are not active here (I checked). It seems all the rest points to macros in SoftPWM_timer.h...

Kind regards,

Vicne