Has anyone noticed that wait_us() has about 500ns of jitter. It's not much, but at short wait times it could cause some problems. I took some waveform traces. The wait time shown below is either 3.5us or 4us. I can understand why the pulse is not exactly 3us wide, but what gets me is that it changes between two values.. Also, for wait_us(2), the pulse is very stable. And at one point during testing, the pulse was stable for only even numbers of wait..
I thought it was a problem with the DigitalIO implementation, but when I use a simple NOP loop delay, it can produce a (very) stable pulse down to 150ns, shown below. The issue is not much of a problem beyond 10us, so I don't think its much of a bother to most people, I was just curious..
The figure below is from the following code snippet:
This is a great analysis! Yes, the jitter you are seeing is due to the fact all the mbed time functions work from a running 1us ticker, hence you will get only as acurate as within 1us of the requested time.
Please log in to post a reply.
mbed, the fastest way to prototype with ARM based microcontrollers.
^ back to top