The pi doesn't seem to have any general counter/timer hardware, like ARMs usually do. I've seen vague references to using the GPU to do timings.
I'd like to measure frequencies and timestamp some edges, in the 1 us sort of domain, several channels. I guess we could hang a small FPGA off to the side if pi can't do it.
Do pi's have crystal oscillators? I guess we could add one too.
Are you serious about using yet another aliexpress toy for some real design? Other than the obvious question above, does not ARM have some sort of timebase register as part of the core? This might be usable to some extent, depending on how much jitter you can tolerate.
Not exactly a toy. But it would save us using up our stock of FPGAs and ARM chips, and I know a guy who would like to do the programming. He's a retired Fellow of United Technologies (Collins) who really likes to code.
The ARM in the pi seems to have none of the usual counter/timer stuff, so we'd have to do that externally, in a small FPGA probably. We might have three frequency counters and maybe six edge time stampers in a FIFO or something. Pretty simple.
Oh I know it is fairly complex and it is widely used in consumer stuff, people watch videos on it etc. I just don't see that sort of thing in the kind of products you seem to be doing. But then if it is the easiest way to do things and you find it stable enough why not.
I was talking of something like the PPC timebase register, it is a free running 64 bit counter. If they have something like that you could timestamp events using some IRQ, the jitter you would get would depend mostly on the IRQ latency then. But I am really no ARM person.
The RasPi 4 is a very nice machine. The CM4 even more so if only you could buy one at the moment. The CM4 has a PCI-e interface which gives lots of possibilities. The Beaglebone Black is also good, but it has less RAM than the Raspi 4 and only has a 100Mbit/s ethernet port whereas the PI 4 has 1Gbit/s. The extra processors do allow time critical software to be written though.
There are add-on modules with real time clock chips for the Pi and the BBB.
Alternatively, look at the RasPi pico board or the RP2040 microcontroller which it uses. Both of these have the big advantage that they can be bought in large quantities at the moment. The RP2040 has multiple programmable state machines which allow very complex i/o operations with precise timing. There are also multiple counter-timer modules. It is a two-core ARM M0+. Finally, don't forget the XMOS devices, many of which support USB and/or ethernet together with deterministic timing and multiple cores. John
Did you overlooked the iic part of my original followup up there? ^^^ My RPi Apps use nanosleep to react to and time external Inter-Integrated Circuit signals. ...
OK, maybe you're supposed to say i2c instead of iic. Danke,
you are generating signals, not reacting and measuring. That easy you just burn cycles while waiting and iic will work just fine with milli second timing ...
How is nanosleep going to help if you want to time when and for how long and external signal it asserted?
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.