From 3a2252c99c0cefdfad723cadff2f9bd724b55bfe Mon Sep 17 00:00:00 2001 From: Manfred Steiner Date: Sat, 17 Aug 2024 16:47:11 +0200 Subject: [PATCH] changes for battery-mode (power via Q1) --- software/bootloader-arduino/Makefile | 6 +++++- software/bootloader-arduino/src/main.c | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/software/bootloader-arduino/Makefile b/software/bootloader-arduino/Makefile index 6b30abd..00872f0 100644 --- a/software/bootloader-arduino/Makefile +++ b/software/bootloader-arduino/Makefile @@ -127,7 +127,11 @@ isp-erase-644p: isp-fuse-644p: #avrdude -c usbasp -p m644p -U lfuse:w:0xFF:m -U hfuse:w:0xD8:m -U efuse:w:0xFF:m -U lock:w:0xFF:m - avrdude -c usbasp -p m644p -U lfuse:w:0xFF:m -U hfuse:w:0xD8:m -U efuse:w:0xFE:m -U lock:w:0xEF:m + #avrdude -c usbasp -p m644p -U lfuse:w:0xFF:m -U hfuse:w:0xD8:m -U efuse:w:0xFE:m -U lock:w:0xEF:m + # LFUSE=0xEE -> startuptime 1K CLOCKS + 0ms -> 83us + #avrdude -c usbasp -p m644p -U lfuse:w:0xEE:m -U hfuse:w:0xD8:m -U efuse:w:0xFE:m -U lock:w:0xEF:m + # LFUSE=0xE7 -> startuptime 16K CLOCKS + 4.1ms -> 5.4ms + avrdude -c usbasp -p m644p -U lfuse:w:0xE7:m -U hfuse:w:0xD8:m -U efuse:w:0xFE:m -U lock:w:0xEF:m clean: @rm -r dist diff --git a/software/bootloader-arduino/src/main.c b/software/bootloader-arduino/src/main.c index 32ccfbd..3ca14b3 100644 --- a/software/bootloader-arduino/src/main.c +++ b/software/bootloader-arduino/src/main.c @@ -113,9 +113,10 @@ int main () { asm volatile("nop\n\t"); #endif - // LED ports output and off - DDRC = (1 << PC4) | (1 << PC3) |(1 << PC2); + // LED ports output and off, ensure that Q1 (battery power) on (PC7) PORTC = 0; + DDRC = (1 << PC7) | (1 << PC4) | (1 << PC3) |(1 << PC2); + #ifdef DOUBLE_SPEED UCSR0A = (1 << U2X0); // Double speed mode USART0 -- 2.39.5