more entropy, more speed
authorNIIBE Yutaka <gniibe@fsij.org>
Tue, 25 Sep 2012 01:28:41 +0000 (10:28 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Tue, 25 Sep 2012 01:28:41 +0000 (10:28 +0900)
ChangeLog
boards/STM8S_DISCOVERY/board.h
boards/STM8S_DISCOVERY/mcuconf.h
src/random.c

index 2cc5db3..9c7895d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-09-25  Niibe Yutaka  <gniibe@fsij.org>
+
+       * boards/STM8S_DISCOVERY/mcuconf.h (STM32_PPRE2, STM32_ADCPRE):
+       12MHz ADC clock gives us more speed.
+
+       * boards/STM8S_DISCOVERY/board.h (VAL_GPIOCCRL): Digital push pull
+       output 50MHz gives us more entropy.
+
+       * src/random.c (adcgrpcfg): To acquire more entropy and more speed,
+       our choise is IN10 and IN11 (which is unconnected).
+
 2012-09-20  Niibe Yutaka  <gniibe@fsij.org>
 
        * src/main.c (main): Call neug_select.
index a1cb04f..23476a4 100644 (file)
  * Port C setup.
  * Everything input with pull-up except:
  */
-#define VAL_GPIOCCRL            0x88888888      /*  PC7...PC0 */
+#define VAL_GPIOCCRL            0x88888833      /*  PC7...PC0 */
 #define VAL_GPIOCCRH            0x88888888      /* PC15...PC8 */
 #define VAL_GPIOCODR            0xFFFFFFFF
 
index acfb005..fffa6c3 100644 (file)
@@ -7,8 +7,8 @@
 #define STM32_PLLMUL_VALUE          9
 #define STM32_HPRE                  STM32_HPRE_DIV1
 #define STM32_PPRE1                 STM32_PPRE1_DIV2
-#define STM32_PPRE2                 STM32_PPRE2_DIV2
-#define STM32_ADCPRE                STM32_ADCPRE_DIV4
+#define STM32_PPRE2                 STM32_PPRE2_DIV1
+#define STM32_ADCPRE                STM32_ADCPRE_DIV6
 #define STM32_USBPRE                STM32_USBPRE_DIV1P5
 #define STM32_MCO                   STM32_MCO_NOCLOCK
 
index 7fabf85..5975ad9 100644 (file)
@@ -47,9 +47,10 @@ static void adccb_err (ADCDriver *adcp, adcerror_t err);
 
 /*
  * ADC conversion group.
- * Mode:        Linear buffer, 4 samples of 2 channels, SW triggered.
- * Channels:    Vref   (1.5 cycles sample time, violating the spec.)
- *              Sensor (1.5 cycles sample time, violating the spec.)
+ * Mode:     Linear buffer, 4 samples of 2 channels, SW triggered.
+ * Channels:
+ *    IN10 (1.5 cycles sample time, port configured as push pull output 50MHz)
+ *    IN11 (1.5 cycles sample time, port configured as push pull output 50MHz)
  */
 static const ADCConversionGroup adcgrpcfg = {
   FALSE,
@@ -57,12 +58,12 @@ static const ADCConversionGroup adcgrpcfg = {
   adccb,
   adccb_err,
   0,
-  ADC_CR2_TSVREFE,
-  ADC_SMPR1_SMP_SENSOR(ADC_SAMPLE_1P5) | ADC_SMPR1_SMP_VREF(ADC_SAMPLE_1P5),
+  0,
+  ADC_SMPR1_SMP_AN10(ADC_SAMPLE_1P5) | ADC_SMPR1_SMP_AN11(ADC_SAMPLE_1P5),
   0,
   ADC_SQR1_NUM_CH(ADC_GRP1_NUM_CHANNELS),
   0,
-  ADC_SQR3_SQ2_N(ADC_CHANNEL_SENSOR) | ADC_SQR3_SQ1_N(ADC_CHANNEL_VREFINT)
+  ADC_SQR3_SQ2_N(ADC_CHANNEL_IN10) | ADC_SQR3_SQ1_N(ADC_CHANNEL_IN11)
 };
 
 /*