2019-05-15 05:12 AM
My environment is Nucleo-F446RE(STM32F446) with TrueSTUDIO / CubeMX on Windows 10.
I tried to get a 6MHz frequency signal by Input Capture module. However, modules often skip timer values.
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
uint16_t captures[240];
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim) {
if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_3) {
}
}
void HAL_TIM_IC_CaptureHalfCpltCallback(TIM_HandleTypeDef *htim)
{
if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_3) {
}
}
/* USER CODE END 0 */
int main(void)
{
/* USER CODE BEGIN 2 */
HAL_TIM_IC_Start_DMA(&htim2, TIM_CHANNEL_3, captures, 120);
/* USER CODE END 2 */
}
This is an example of an aquired buffer(captures[240]) on my environment.
[825, 840, 856, 864, 2653, 2668, 2684, 2700, 4465, 4481, 4497...]
Interval between signals are should always from 10 to 20, but it has more than 2000.
This problem doesn't occur when I change DMA mode from "Circular" to "Normal". But I'm concerned about processor efficiency because a frequency of this signal is very high,
Can I avoid this trouble about Input Capture with DMA Circular mode by modifying the program?
Solved! Go to Solution.
2019-05-15 05:32 AM
How do you observe the captured data? I guess, in the debugger, and you don't stop the input signal. In that case, until the debugger reads the data, the DMA runs over the same array several times, so the debugger shows you 4 data from the first pass, 4 data from second, several more from the third...
JW
2019-05-15 05:32 AM
How do you observe the captured data? I guess, in the debugger, and you don't stop the input signal. In that case, until the debugger reads the data, the DMA runs over the same array several times, so the debugger shows you 4 data from the first pass, 4 data from second, several more from the third...
JW
2019-05-16 09:28 PM
I got an accurate value by buffering those data with RTOS. Thank you for your advice.