Skip to content

Feature/digital input stamp#195

Merged
ryan-summers merged 25 commits intoquartiq:masterfrom
vertigo-designs:feature/digital-input-stamp
Jan 6, 2021
Merged

Feature/digital input stamp#195
ryan-summers merged 25 commits intoquartiq:masterfrom
vertigo-designs:feature/digital-input-stamp

Conversation

@ryan-summers
Copy link
Member

@ryan-summers ryan-summers commented Dec 8, 2020

This PR implements support for asynchronous collection of timestamps on the DI0 input.

TODO:

ryan-summers and others added 2 commits December 8, 2020 15:15
Co-authored-by: Robert Jördens <rj@quartiq.de>
Co-authored-by: Robert Jördens <rj@quartiq.de>
@ryan-summers
Copy link
Member Author

ryan-summers commented Dec 8, 2020

As a test case, I input a 10Hz square wave (3V amplitude) to DI0 and collected 32 timestamps. I then calculated the delta between the timestamps and printed it using GDB:

892                     info!("All stamps gathered: {:?}", deltas);
(gdb) p/x deltas
$1 = [0x9894d3, 0x9894d2, 0x9894d2, 0x9894d2, 0x989dc7, 0x9894d2, 0x9894d2, 0x9894d1, 0x9894d1, 
  0x9894d1, 0x9894d0, 0x9894cf, 0x9894d0, 0x9894d0, 0x989dc5, 0x9894d0, 0x9894d1, 0x9894d1, 0x9894d3, 
  0x9894d2, 0x9894d2, 0x9894d2, 0x9894d1, 0x9894d1, 0x989dc6, 0x9894d0, 0x9894d1, 0x9894d2, 0x9894d2, 
  0x9894d2, 0x9894d3]
(gdb) p deltas
$2 = [9999571, 9999570, 9999570, 9999570, 10001863, 9999570, 9999570, 9999569, 9999569, 9999569, 
  9999568, 9999567, 9999568, 9999568, 10001861, 9999568, 9999569, 9999569, 9999571, 9999570, 9999570, 
  9999570, 9999569, 9999569, 10001862, 9999568, 9999569, 9999570, 9999570, 9999570, 9999571]
(gdb) 

As can be seen, the deltas are all approximately near the count of 10,000,000, which corresponds with 100ms (the period of a 10Hz wave) with the timestamp timer running at 100MHz. The variations here are likely due to inaccuracies in my clock source as opposed to fluctuations in the timer timestamp captures.

@jordens
Copy link
Member

jordens commented Dec 8, 2020

As a test case, I input a 10Hz square wave (3V amplitude) to DI0 and collected 32 timestamps. I then calculated the delta between the timestamps and printed it using GDB:

Nice!
But do check the max input range of the DIO (from schematics). I don't know whether it deals with negative voltages.

@ryan-summers ryan-summers mentioned this pull request Dec 9, 2020
5 tasks
@ryan-summers ryan-summers marked this pull request as ready for review January 4, 2021 17:05
Copy link
Member

@jordens jordens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good from my end.

@ryan-summers ryan-summers merged commit a2fb463 into quartiq:master Jan 6, 2021
@ryan-summers ryan-summers deleted the feature/digital-input-stamp branch January 6, 2021 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants