From dd4264ead7cdf63af84e68eaeb9470bee6f6b147 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sun, 22 Jun 2014 23:06:20 +0200 Subject: firmware: Changed handling of OSCCAL calibration If the calibrated OSCAL was saved during programming it will be reloaded before starting the bootloader, regardless whether it was entered or not. This allows calibrating devices without PLL to 12 MHz. --- firmware/main.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/firmware/main.c b/firmware/main.c index 6a091a3..625f026 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -146,7 +146,7 @@ static void writeWordToPageBuffer(uint16_t data) { } #endif -#if (!OSCCAL_RESTORE) && OSCCAL_16_5MHz +#if OSCCAL_SAVE_CALIB if (currentAddress.w == BOOTLOADER_ADDRESS - TINYVECTOR_OSCCAL_OFFSET) { data = OSCCAL; } @@ -196,11 +196,21 @@ static void initHardware (void) WDTCR = 1<