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

Watch quartz on Tosc1 #526

Open IngmarEckhardt opened 6 months ago

IngmarEckhardt commented 6 months ago

Hello,

is there a way to simulate a watch quartz on Tosc1 with the atmega328p? Setting counter2 to asynchronous mode and connect a clock with 32khz to pin b6 seems not to work. Or did made a mistake?

gatk555 commented 6 months ago

It may be as simple as inserting this:

           .ext_clock_pin = AVR_IO_REGBIT(PORTB, 6), /* External clock pin */

at line 316 in simavr/simavr/cores/sim_megax8.h. The external clock pin definition is missing from the timer description. Compiled but not tested by me.