I am using ultrasonic sensor (hc-sr04). I read some threads about creating 10us timing. chThdSleepMicroseconds - won't create accurate 10us(+/-3 us) GPT - can create 10us delay
But here i don't have spare GPT timer to use . can i use VT timer instead. What will be accuracy.
chThdSleepMicroseconds uses virtual timers internally, it is the same thing. Note that anything based on interrupts will not allow an accuracy of +-3uS because of jitter.
You need to use an HW timer with IRQ priority set to zero, something that the HAL does not allow. Those "fast" interrupts have much reduced jitter but you can't call any OS function from the IRQ handler.
Then instead of using timer can I use pwm? I am thinking to start PWM for one pulse 10us only and later stop the PWM. Because that would be precise than timer. I can spare one time for that. Is that possible?