I want to make a polling based one-wire driver because I want to be able to use it on multiple pins without occupying PWM/Timer blocks. Therefore, I need delays in the range of a few microseconds. I tried using
Code: Select all
chThdSleepMicroseconds(n)
in conjunction with
Code: Select all
#define CH_CFG_ST_FREQUENCY 1000000
so that systick is 1 MHz. So, I should be able to resolve 1 us ticks with some inaccuracy due to
Code: Select all
#define CH_CFG_ST_TIMEDELTA 2
I now try to toggle a pin and place a 10 microsecond delay between setLine and clearLine operations. The delay between the switching is never below 40 us. Am I missing something here? Why can the delay not be less than this?
The processor runs at 200 MHz.
Thanks in advance,
Adrian