Hello there,
i'm trying to get a pro micro (Atmega 32u4) to generate a PWM signal with high enough frequency to not be visible in analog video (> ~700*50Hz= 3.5kHz (roughly guessing, anything faster will make me happy)) as i want to (glitchyly) blend videos by switching transistors rapidly.
But every seemingly auspicious approach i find results in an error like:
Error compiling for board Arduino Micro
In this case more precisely:
during RTL pass: combine
/usr/share/arduino/hardware/archlinux-arduino/avr/cores/arduino/main.cpp: In function 'main':
/usr/share/arduino/hardware/archlinux-arduino/avr/cores/arduino/main.cpp:51:1: internal compiler error: in add_clobbers, at config/avr/avr-dimode.md:2705
51 | }
| ^
0x5af234 _start
../sysdeps/x86_64/start.S:115
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See https://gcc.gnu.org/bugs/ for instructions.
lto-wrapper: fatal error: /usr/bin/avr-gcc returned 1 exit status
compilation terminated.
/usr/bin/avr-ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
exit status 1
Fehler beim Kompilieren für das Board Arduino Micro.
int p = 9;
void setup() {
// put your setup code here, to run once:
pinMode(p,OUTPUT);
TCCR1A = _BV(COM1A1) | _BV(COM1B1) | _BV(WGM11); // Enable PWM outputs for OC1A and OC1B on digital pins 9, 10
TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS11); // Set fast PWM and prescaler of 8 on timer 1
ICR1 = 254; // Set the PWM frequency to 2kHz (16MHz / (8 * (999 + 1)))
OCR1A = 127; // Set duty-cycle to 50% on D9
}
void loop() {
for(int i;i<254;i++){
pwmDuty(i);
delay(60);
if(i==254){i=0;}
}
}
void pwmDuty(byte ocra) {
OCR1A = ocra; //0-254
}
Could someone tell me what's the problem?
And if that would be the proper way to set the duty cycle if the rest would work...
I unfortunately am unable to decipher the datasheet
Lots of thanks!