token-vesting icon indicating copy to clipboard operation
token-vesting copied to clipboard

Only first call to analogWrite() working on ATtiny817

Open caternuson opened this issue 1 year ago • 3 comments
trafficstars

This may affect other variants, but was discovered and tested using an ATtiny817. megaTinyCore release 2.6.10

Example sketch to demonstrate issue:

// attiny817 PWM pins: 0, 1, 9, 10, 11, 12, 13, 20
// works: 0, 1, 9, 10, 20
// issue: 12, 13

#define PWM_PIN 13

void setup() {
  pinMode(PWM_PIN, OUTPUT);
}

void loop() {
  analogWrite(PWM_PIN, 255);
  delay(2000);
  analogWrite(PWM_PIN, 0);
  delay(2000);
}

and an LED attached to the output pin.

For pins 0, 1, 9, 10, and 20, the sketch works as expected. The LED blinks. For pins 12 and 13, only the first call to analogWrite() works. Changing 255 to 127 has the expected effect on brightnesls. But the LED never turns off.

caternuson avatar Jun 07 '24 21:06 caternuson