ADC Sampling rate configuration HELP!
Posted: Mon Nov 21, 2016 10:28 pm
hello,
I'm very new to chibiOS and programming in general and I was wondering if someone would please point out where I could change the speed of the ADC sampling rate.
I am currently trying to sample a signal with a frequency of 60Hz, however I find myself unable to get more then one value per period (if I am actually getting values from the same period in the signal)...
I am using a "ADC_SAMPLE_3" macro, which to my understanding is supposed to be the fastest sampling rate for my board (3 cycles). Considering my board should be running at 216Mhz and its ADC has a clock frequency of 36Mhz, this settings should be more than enough to sample correctly a 60 Hz signal.
Here's the parameters that I have configured.
it's very probable I'm not even showing the appropiate section of the code, like I said im very new to this and I am having a difficult time learning where to look for the things that I need inside the project files...
please help me.
I'm very new to chibiOS and programming in general and I was wondering if someone would please point out where I could change the speed of the ADC sampling rate.
I am currently trying to sample a signal with a frequency of 60Hz, however I find myself unable to get more then one value per period (if I am actually getting values from the same period in the signal)...
I am using a "ADC_SAMPLE_3" macro, which to my understanding is supposed to be the fastest sampling rate for my board (3 cycles). Considering my board should be running at 216Mhz and its ADC has a clock frequency of 36Mhz, this settings should be more than enough to sample correctly a 60 Hz signal.
Here's the parameters that I have configured.
Code: Select all
/*
* ADC driver system settings.
*/
#define STM32_ADC_ADCPRE ADC_CCR_ADCPRE_DIV4
#define STM32_ADC_USE_ADC1 TRUE
#define STM32_ADC_USE_ADC2 TRUE
#define STM32_ADC_USE_ADC3 TRUE
#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
#define STM32_ADC_ADC2_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
#define STM32_ADC_ADC3_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
#define STM32_ADC_ADC1_DMA_PRIORITY 2
#define STM32_ADC_ADC2_DMA_PRIORITY 2
#define STM32_ADC_ADC3_DMA_PRIORITY 2
#define STM32_ADC_IRQ_PRIORITY 6
#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 6
#define STM32_ADC_ADC2_DMA_IRQ_PRIORITY 6
#define STM32_ADC_ADC3_DMA_IRQ_PRIORITY 6Code: Select all
/*
* Board oscillators-related settings.
*/
#if !defined(STM32_LSECLK)
#define STM32_LSECLK 32768U
#endif
#if !defined(STM32_HSECLK)
#define STM32_HSECLK 8000000U
#endif
#define STM32_HSE_BYPASS
Code: Select all
/**
* @name Absolute Maximum Ratings
* @{
*/
/**
* @brief Minimum ADC clock frequency.
*/
#define STM32_ADCCLK_MIN 600000
/**
* @brief Maximum ADC clock frequency.
*/
#if defined(STM32F4XX) || defined(__DOXYGEN__)
#define STM32_ADCCLK_MAX 36000000
#else
#define STM32_ADCCLK_MAX 30000000
#endif
/** @} */
it's very probable I'm not even showing the appropiate section of the code, like I said im very new to this and I am having a difficult time learning where to look for the things that I need inside the project files...
please help me.