2024-12-04 09:26 AM
hi im using stm32g474vet6 timer2 which is 32bit in input capture mode for finding frequency and width.
i can't able to measure more than 400khz frequency. i want to measure 4mhz to 400khz signal, which is 400khz frequency signal and its width will vary from 10 to 100 percent with respect to time. what should be the prescalar and period value for measuring 4mhz signal in mcu timer.
below is the code attached for frequency calculation:
2024-12-06 01:55 AM
Hello @Srinath_03
Could you please share your timer settings?
Please use the option "Insert/Edit code sample " to insert your code. See the screenshot below.
2024-12-07 05:43 AM
as im input frequency is around 400khz i cant able to find the width of the signal ,
timer clock 170mhz
prescalar 0
period full 32bit value
detecting both the edges
using dma but im disabling the interuppt
in my case i want the dma buffer to store the values first rising edge and next falling edge , but sometimes its coming opposite coming some times
please find the below code and images of configuration
if (HAL_TIM_IC_Start_DMA(&htim2, TIM_CHANNEL_2, (uint32_t *)capture_dma_1, 6) != HAL_OK) {
Error_Handler();
}
since im using three channels of three signals