-
Notifications
You must be signed in to change notification settings - Fork 1.3k
RFC: PulseTime #2210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sounds like an interesting project! I don't know of anything that currently allows for it (though I'm not much of an Arduino user). I'd suggest adding it as a separate module so that it can be supported separately from PulseIO. Other than that, let us know if you have CircuitPython questions. Thanks! |
notro had previously brought up a similar request: #1423. There's discussion in that PR to fold it in with
The aforementioned |
I meant to mention that |
My personal use case is a running count of pulses from a source of around 10 MHz, which I can check "from time to time" but maybe as infrequently as once a second. If it can reset to 0 at a specific value (e.g. 600e6 ~1 minute) even better. |
10 MHz is a bit too fast for a 'A pulse caused an interrupt: take down all the details then return from interrupt'. What would work is 'The Resetting the hardware at a specific count is too specific, but I could expose the number of ticks in a second, for you to set to 6e8, so that when you read a time that is nominally Is your specific use case a clock based on a GPS-disciplined oscillator (TCXO/OCXO/Rb) with a 10 MHz output? You can use the 10 MHz as an external clock, do capture on the PPS, and have 3 other capture channels timestamped to the precise UTC time with 100 ns precision and accuracy (after subtracting the tick number corresponding to the PPS). |
@dmopalmer Could you please elaborate on why you want these things? I'm reworking some clock stuff now to enable sleep and am revisiting both PulseIn and FrequencyIn to do it. |
My specific use-case is rather idiosyncratic. (I want to time the detections of photons from a telescope tracking a satellite to read out an optical identification beacon) but there are many other applications. e.g. If you want to do period timing, e.g. for a tachometer or frequency counter, then measuring the individual times of each of a second's worth of pulses gives a more accurate frequency than counting how many pulses you get in a second. Because if your signal has a frequency around 2.5 Hz, you sometimes get 3 pulses in a second, and sometimes 2: but if you get a pulse at t = 0.3692 s, and another pulse at 0.7691, and another at 1.1690, then you know that the frequency is I am currently distracted by other things. (I didn't get to the point where the timer-counter was actually incrementing with each clock pulse.) If I get back to it, my path might be to implement the receiver functionality of the esp32.RMT class in MicroPython. |
@dmopalmer I'd recommend using (Looking back at the top I see you addressed PulseIn issues.)
I really appreciate you replying with your use case. It really helps separate the things we need from the things that would be nice to have but maybe never use. |
Bumping this, as i ran across it for my use case. The anemometer is a simple pulse device, with 1 pulse per rotation. I expect it to be pulsing in the low seconds to milliseconds range. This rules out using the frequencyio and pulseio modules, and leaves me with countio, which will have the problem @dmopalmer mentions of not using period timing. Would it be possible to increase the internal count to 32bit of pulseio, or maybe even make it configurable? Oh, and first post here - i recently got into microcontrollers, thanks to CircuitPython, and its ease of use. Just want to thank everyone involved in making it! |
This is a Request For Comment for a suggested extension to pulseio for doing high precision timing on multiple inputs on the SAM port of circuitpython.
I would like to do time capture on pin inputs so that I can do things like:
The current
pulseio.PulseIn
:Is there already a library that can do what I want? (or a sufficient subset of it)? No sense re-inventing the wheel. (rfc: 'Why don't you just use the fooTime module on Arduino instead?' would be a useful comment.)
If not, I am thinking of adding
pulseio.PulseTime
(rfc: make it a separate module?) to the samdx1 library. The SAM has TCC (Timer Counter for Control) modules that can run a 24-bit counter from the CPU clock (or other source) and capture the times of up to 4 event sources. My library would set up a TCC with the user's choice of event inputs, and queue up event times as they occur.Some details:
.now()
method is needed to read the current timer state so you know how long ago an event happened.rfc: Any other capabilities that should be included?
The text was updated successfully, but these errors were encountered: