Compare commits

...

2 commits

Author SHA1 Message Date
Stephan I. Böttcher
987c3bd326 avr: speed up the MCLK from 3.3MHz to 10 MHz 2024-04-03 21:55:54 +02:00
Stephan I. Böttcher
1de7a61bbb enable the time TCA0 2024-04-03 19:30:39 +02:00
2 changed files with 7 additions and 3 deletions

View file

@ -1,13 +1,15 @@
PROJ=bate
PATH:=/usr/local/bin:$(PATH)
default: all
all: $(PROJ).hex
SN_bate = 1
MCU_bate = attiny424
BATE_PERIOD=152
BATE_PERIOD=76
bate_CFLAGS = -DPERIOD=$(BATE_PERIOD)
SN_bate_wdt = $(SN_bate)
MCU_bate_wdt = $(MCU_bate)

View file

@ -28,7 +28,7 @@
// Timer 1 TOP needs to be f_{clkio}/65536
#ifndef PERIOD
# define PERIOD 153
# define PERIOD 76
#endif
// Save the calibrated period in EEPROM
@ -43,7 +43,7 @@ void init_timer(uint8_t p)
PORTB.DIRSET = Bit(0);
MCLK.INTCTRL = TCA_SINGLE_CMP0_bm;
MCLK.CMP0 = p;
MCLK.CTRLA = TCA_SINGLE_CLKSEL_DIV2_gc;
MCLK.CTRLA = TCA_SINGLE_CLKSEL_DIV2_gc | TCA_SINGLE_ENABLE_bm;
MCLK.CTRLB = TCA_SINGLE_CMP0EN_bm | TCA_SINGLE_WGMODE_FRQ_gc;
}
@ -296,6 +296,8 @@ void read_bate()
int main()
{
CCP = CCP_IOREG_gc;
CLKCTRL.MCLKCTRLB = CLKCTRL_PDIV_2X_gc | 1;
BATE_PORT.DIRSET = Bit(SCK_PORT) | Bit(DIN_PORT);
init_timer(0);