Problem with timer interrupt
I am using HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) to generate a sine wave based on DDS and I have also implemented ADC to get the value and perform some calculation. My sampling rate is 100KHz so my timer interrupt should trigger every 10us.
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_SET);
.................
few codes calling dac and adc
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_RESET);
}
so the execution time is around 4.8us which means the callback function should wait till it reaches 10us and new trigger start if I understand it correctly.
But is it possible that the cycle time for one session exceeds 10us?
The high pulse width is fine, increases with increase in lines of code, but the low pulse width seems to not decrease beyond. This delays my timer interrupt trigger. What is actually happening behind this callback function?


