Counter using hrtim
Hii,
I am using hrtim in stm32G474RET6 mcu, so i want to know how we generate a counter of 500ns in which i call adc in it.
If somebody know about it please help me.
Hii,
I am using hrtim in stm32G474RET6 mcu, so i want to know how we generate a counter of 500ns in which i call adc in it.
If somebody know about it please help me.
Hi @Harsh_18,
You can use a DMA request. The ADC is capable of generating this request to notify the DMA of the end of the conversion. The best way to use the DMA with the ADC is in continuous mode, with a DMA destination (a variable in memory), so that the user can use this variable without worrying about when it is updated by the ADC. When the ADC completes the conversion, it generates a request to the DMA, which copies it into this variable. Since continuous mode is enabled and the DMA is in circular mode, all the previous steps will restart automatically.
Here is the necessary configuration for this behavior:


For starting the ADC with DMA and specifying the destination variable, you could use:
if (HAL_ADC_Start_DMA(&hadc1, (uint32_t *) &VARIABLE_DESTINATION, 1) != HAL_OK)
{
/* ADC initiliazation Error */
Error_Handler();
}
Thank you.
ELABI.1
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.