mcf54418: one millisecond resolution

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

mcf54418: one millisecond resolution

693 Views
Bjarne
Contributor I

I am in the need for a timer with a one millisecond resolution to measure times between two characters as close to the uart as possible. I thought do_gettimeofday would do the job, but the times I get is going back and then jumps forward, then backward again. A snippet of the message log. Attached the mcf_tx_chars function.

 

drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177497 s 0000983548 us, ch: c
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177497 s 0000991642 us, ch: d
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177497 s 0000989738 us, ch: e
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177497 s 0000987832 us, ch: f
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177497 s 0000985926 us, ch: g
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177497 s 0000984020 us, ch: h
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177497 s 0000992116 us, ch: i
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177497 s 0000990210 us, ch: j
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177497 s 0000988305 us, ch: k
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177497 s 0000986400 us, ch: l
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177497 s 0000984494 us, ch: m
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177497 s 0000982589 us, ch: n
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177497 s 0000990684 us, ch: o
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177498 s 0000006906 us, ch: +
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177498 s 0000005030 us, ch: a
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177498 s 0000003122 us, ch: b
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177498 s 0000011215 us, ch: c
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177498 s 0000009309 us, ch: d
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177498 s 0000007404 us, ch: e
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177498 s 0000005498 us, ch: f
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177498 s 0000003594 us, ch: g
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177498 s 0000011688 us, ch: h
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177498 s 0000009782 us, ch: i
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177498 s 0000007877 us, ch: j
drivers/serial/mcf.c line 491 - mcf_tx_chars, time: 0188177498 s 0000005972 us, ch: k


Can anyone figure why?

 

Thanks,

Bjarne

Labels (1)
0 Kudos
Reply
1 Reply

349 Views
TomE
Specialist II

Details on what OS you're running would help.

 

I assume your code is in a driver or kernel module.

 

Type "do_gettimeofday backwards" into google and you'll get over 9000 results, mainly from 2002-2004 and for linux version 2.04. Are you running 2,04?

 

You'll probably need to examine the sources for do_gettineofday and the underlying platform code that it uses.

 

According to the following, gettimeofday() calls sys_gettimeofday() calls do_gettimeofday():

 

http://us.generation-nt.com/answer/difference-between-do-gettimeofday-gettimeofday-help-171731891.ht...

 

So do successive user-space calls to gettimeofday() show the same problem?

 

Good luck

 

Tom

 

0 Kudos
Reply