buserror / simavr

simavr is a lean, mean and hackable AVR simulator for linux & OSX
GNU General Public License v3.0
1.56k stars 365 forks source link

Fast PWM mode not working #162

Open donothingloop opened 8 years ago

donothingloop commented 8 years ago

Hi,

It seems that there is an issue with Fast PWM mode at least on the ATMEGA1280 core.

#include <avr/io.h>

void main(void) {
        DDRH = 255;
        TCCR4A |= (1<<COM4A0) | (1<<COM4A1) | (1<<WGM41);
        TCCR4B |= (1<<WGM43) | (1<<WGM42);
        TCCR4B |= (1<<CS42) | (1<<CS40);
        ICR4 = 1000;
        OCR4A = 800;

        for(;;);
}

This works on the real hardware work but does not work on the simulator (port is never set).

Loaded 1 section of ihex
Load HEX flash 00000000, 318
firmware f-1460556263.hex f=16000000 mmcu=atmega1280
TIMER: avr_timer_write-4 clock turned off
TIMER: avr_timer_write-4 clock turned off
TIMER: avr_timer_configure-4 TOP 15625.00Hz = 512 cycles = 32usec

Thank you very much

markasoftware commented 4 years ago

simavr does not simulate the pin changes due to fast PWM; i.e, no bitbanging.