Hello,I have a small problem when using a custom delay function as follows : void delay_us(uint32_t delayus) {
uint32_t start_count = __HAL_TIM_GET_COUNTER(&htim2);
while ((__HAL_TIM_GET_COUNTER(&htim2) - start_count) < delayus) {
}
} The attac...
@Radosław wrote:while (((uint32_t)(__HAL_TIM_GET_COUNTER(&htim2) - start_count)) < delayus) {
} and ARR of timer must be 0xFFFFFFFFyes timer ARR is 0xFFFFFFFF
@Radosław wrote:Promotion to int and while (((uint32_t)(__HAL_TIM_GET_COUNTER(&htim2) - start_count)) < delayus) {
} Even with this modification it still works randomly
@Andrew Neil wrote:@LadyMt wrote: the tutorial I followed on youtube.Please give a link to that tutorialI can't find the video exactly. But I can show you another similar video that I also watched. : How to create delay in nano/micro seconds using ti...