bahex
Posts: 2
Joined: Mon Jun 17, 2013 6:44 am

Strange clock behaviour

Mon Jun 24, 2013 1:21 pm

Hi rPi friends,

I have found a strange behaviour of the clock and can't locate what is going wrong.
For example:
I wrote a module which observes GPIO17 and 21 and generates an interrupt whenver the signale changes.
I gave a 10khz signal to the GPIO-pins an measured the time between the signal changes (about 50us).
So far so good. Then I wrote the level change with printk into my messages log and first everything looked fine.
A python script calculated the time difference between the falling edge and the rising edge an the results we pretty good.
But then there was a really weird time value in the log file and this appears more often than once.

Here an example from my log:

Jun 24 11:13:19 raspberrypi kernel: [13510.337288] Xanonex: falling
Jun 24 11:13:19 raspberrypi kernel: [13510.337354] Xanonex: rising
Jun 24 11:13:19 raspberrypi kernel: [13510.337422] Xanonex: falling
Jun 24 11:13:19 raspberrypi kernel: [13191.882357] Xanonex: rising <-- look at this time difference
Jun 24 11:13:19 raspberrypi kernel: [13510.337492] Xanonex: falling
Jun 24 11:13:19 raspberrypi kernel: [13510.337544] Xanonex: rising

So this kernel time can't be true. Before, I wrote another programm polling a gpio-port and calculated the differenz (but only at 10hz) and here also I got really weird calculations sometimes,too.

It seems like I access the clock while it is internally updated or something like this. Is there a way to avoid this?

Oh, I forgot to mention that I use Raspian 3.6.11
Thank you much in advance for any help on this topic.

User avatar
joan
Posts: 14960
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Strange clock behaviour

Mon Jun 24, 2013 3:55 pm

I can't make any sense of that. I don't know which clock the kernel is using. There is the system timer microsecond clock which is 2 long words LOW and HIGH. LOW will wrap around every 4295 seconds. But that doesn't explain what you are seeing.

Return to “Troubleshooting”