From f7653bfe0433b82458f111086b5f410029c98086 Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Fri, 26 Mar 2021 22:19:28 +0100 Subject: [PATCH] Fixed ADC reference clock frequency in mic_test --- tests/platform/mic_test.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/platform/mic_test.c b/tests/platform/mic_test.c index 17dcb887..d68f976c 100644 --- a/tests/platform/mic_test.c +++ b/tests/platform/mic_test.c @@ -25,8 +25,10 @@ #include static const char hexdigits[]="0123456789abcdef"; -void printUnsignedInt(unsigned int x) +void printUnsignedInt(uint16_t val) { + int16_t x = val >> 4; + char result[]="....\r"; for(int i=3;i>=0;i--) { @@ -58,9 +60,9 @@ int main() /* * TIM2 for conversion triggering via TIM2_TRGO, that is counter reload. - * AP1 frequency is 42MHz, configure for 8kHz interrupt rate. + * AP1 frequency is 42MHz but timer runs at 84MHz, configure for 8kHz interrupt rate. */ - TIM2->PSC = 41; /* Tick rate 1MHz */ + TIM2->PSC = 83; /* Tick rate 1MHz */ TIM2->ARR = 124; /* Overflow rate 8kHz */ TIM2->CNT = 0; TIM2->EGR = TIM_EGR_UG;