]> www.average.org Git - pulsecounter.git/commitdiff
slow down aux clock
authorEugene Crosser <crosser@average.org>
Fri, 11 Dec 2015 10:57:39 +0000 (13:57 +0300)
committerEugene Crosser <crosser@average.org>
Fri, 11 Dec 2015 10:57:39 +0000 (13:57 +0300)
Hal/Hal.c
Pulsecounter-Prog.c

index be668cb02c9f2e7b4fa5c3208e42e1645a22fef7..0cdcc297a85b19169fad377c4cf5a2cb2575ed75 100644 (file)
--- a/Hal/Hal.c
+++ b/Hal/Hal.c
@@ -64,7 +64,7 @@
 #define EAP_TX_INT_ENABLE()         (IE2 |= UCA0TXIE)
 
 #define MCLK_TICKS_PER_MS           1000L
 #define EAP_TX_INT_ENABLE()         (IE2 |= UCA0TXIE)
 
 #define MCLK_TICKS_PER_MS           1000L
-#define ACLK_TICKS_PER_SECOND       12000L
+#define ACLK_TICKS_PER_SECOND       1500L /* was 12000L with divider /1 */
 #define UART_WATCHDOG_PERIOD        (ACLK_TICKS_PER_SECOND * 250) / 1000
 
 #define UART_WATCH_DISABLE()        (TA1CCTL1 = 0)                                              // Turn off CCR1 Interrupt
 #define UART_WATCHDOG_PERIOD        (ACLK_TICKS_PER_SECOND * 250) / 1000
 
 #define UART_WATCH_DISABLE()        (TA1CCTL1 = 0)                                              // Turn off CCR1 Interrupt
@@ -167,13 +167,21 @@ void Hal_init(void) {
     /* setup clocks */
 
     WDTCTL = WDTPW + WDTHOLD;
     /* setup clocks */
 
     WDTCTL = WDTPW + WDTHOLD;
+    /* MCLK = DCOCLK */
+    /* MCLK divider = /1 */
+    /* SMCLK divider = /1 */
     BCSCTL2 = SELM_0 + DIVM_0 + DIVS_0;
     if (CALBC1_1MHZ != 0xFF) {
         DCOCTL = 0x00;
         BCSCTL1 = CALBC1_1MHZ;      /* Set DCO to 1MHz */
         DCOCTL = CALDCO_1MHZ;
     }
     BCSCTL2 = SELM_0 + DIVM_0 + DIVS_0;
     if (CALBC1_1MHZ != 0xFF) {
         DCOCTL = 0x00;
         BCSCTL1 = CALBC1_1MHZ;      /* Set DCO to 1MHz */
         DCOCTL = CALDCO_1MHZ;
     }
-    BCSCTL1 |= XT2OFF + DIVA_0;
+    /* XT2 is off (Not used for MCLK/SMCLK) */
+    /* ACLK divider = /8 */
+    BCSCTL1 |= XT2OFF + DIVA_3;
+    /* XT2 range = 0.4 - 1 MHz */
+    /* LFXT1 range/VLO = VLOCLK (or 3-16 MHz if XTS=1) */
+    /* Capacitor 6 pF */
     BCSCTL3 = XT2S_0 + LFXT1S_2 + XCAP_1;
 
     /* setup LEDs */
     BCSCTL3 = XT2S_0 + LFXT1S_2 + XCAP_1;
 
     /* setup LEDs */
index 331dbf5366af78b29b9d5f79612c5b24d8132704..4ac463f50a59d2986b7b44f6c4f3b25e6cef0ce1 100644 (file)
@@ -28,7 +28,7 @@ static void gpioHandler(uint8_t id) {
             Hal_delay(10);
             Hal_greenLedOff();
             Hal_redLedOff();
             Hal_delay(10);
             Hal_greenLedOff();
             Hal_redLedOff();
-        Hal_tickStart(5000, tickHandler);
+        Hal_tickStart(15000, tickHandler);
         break;
     case 1:
         event4++;
         break;
     case 1:
         event4++;
@@ -97,7 +97,7 @@ void Pulsecounter_disconnectHandler(void) {
     Hal_redLedOn();
     Hal_delay(100);
     Hal_redLedOff();
     Hal_redLedOn();
     Hal_delay(100);
     Hal_redLedOff();
-    Hal_tickStart(5000, tickHandler);
+    Hal_tickStart(15000, tickHandler);
     Hal_disconnected();
 }
 
     Hal_disconnected();
 }