Burn fuse for external crystal at 16K CK and 65ms

This commit is contained in:
2024-10-01 00:16:20 +02:00
parent 23765aae8a
commit bc14a5653c
3 changed files with 17 additions and 4 deletions

View File

@@ -57,8 +57,8 @@ flash: $(TARGET)
$(E) "[AVD] Flashing..." $(E) "[AVD] Flashing..."
$(Q) $(AVD) -l $(LOGFILE) \ $(Q) $(AVD) -l $(LOGFILE) \
-c $(ASP) -p $(ARCH) \ -c $(ASP) -p $(ARCH) \
-U lfuse:w:0xff:m \ -U lfuse:w:0xFF:m \
-U hfuse:w:0x91:m \ -U hfuse:w:0xD2:m \
-U flash:w:$< -U flash:w:$<
.PHONY: clean .PHONY: clean

View File

@@ -27,7 +27,7 @@ int USART_Init(void)
UCSR0B = BIT(RXCIE0); // Handle RXC interrupts UCSR0B = BIT(RXCIE0); // Handle RXC interrupts
UCSR0B |= BIT(RXEN0) | BIT(TXEN0); // Enable RX and TX circuitry UCSR0B |= BIT(RXEN0) | BIT(TXEN0); // Enable RX and TX circuitry
UCSR0C = BIT(USBS0) | BIT(UCSZ00) | BIT(UCSZ01); // 8-bit data, 2-bit stop UCSR0C = BIT(UCSZ01) | BIT(UCSZ00); // 8-bit data, 1-bit stop, no parity
UBRR0H = (USART_BAUD_PRESCALE >> 8); // Set baud rate upper byte UBRR0H = (USART_BAUD_PRESCALE >> 8); // Set baud rate upper byte
UBRR0L = USART_BAUD_PRESCALE; // Set baud rate lower byte UBRR0L = USART_BAUD_PRESCALE; // Set baud rate lower byte

View File

@@ -57,6 +57,16 @@ static int Init(void)
Info("Initializing..."); Info("Initializing...");
// FIXME: Something is wrong here:
// - AVRDUDE sometimes fails to verify flash.
// - UART sometimes stops working.
// - External crystal problems?
// - Power supply problems?
// - Wrong fuses? Unlikely.
// - Bootloader problems?
return 0;
// The watchdog timer is clocked from a separate // The watchdog timer is clocked from a separate
// on-chip oscillator which runs at 1 MHz. Eight // on-chip oscillator which runs at 1 MHz. Eight
// different clock cycle periods can be selected // different clock cycle periods can be selected
@@ -232,10 +242,13 @@ int main(void)
for (;;) { for (;;) {
WDT_Reset(); WDT_Reset();
Update(); Info("UPDATE");
continue;
// Update();
WDT_Reset(); WDT_Reset();
Sleep(1000); Sleep(1000);
} }
UNUSED(Update);
return 0; return 0;
} }