Electronics-Related.com
Forums

any raspberry pi people here?

Started by John Larkin July 18, 2022

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.



On 7/18/2022 22:13, John Larkin wrote:
> > > 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.
On 7/18/22 1:13 PM, John Larkin wrote:
> The pi doesn't seem to have any general counter/timer hardware, like > ARMs usually do.
My understanding is that the /Raspberry/ Pi(s) don't have hardware for keeping time when the CPU isn't running. Some of the other Pi(s) and the likes do have timer hardware. The Raspberry Pi is like Ethernet, in that it's the most inexpensive thing that gets done what 80% of the users need. If you're in the other 20%, you want something else, be it a hat or different board. -- Grant. . . . unix || die
mandag den 18. juli 2022 kl. 21.13.15 UTC+2 skrev John Larkin:
> 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. >
which version of pi?
> 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.
using a pi I assume you'll be running some kind of linux I don't see how you could do 1us timing in linux maybe look at this: https://beagleboard.org/black it uses an SoC that has two extra risc cpus with access to everything on the chip for realtime tasks chapter 4 https://www.ti.com/lit/ug/spruh73q/spruh73q.pdf
> > Do pi's have crystal oscillators? I guess we could add one too.
a PI has everything it needs, just add power (and an SC card*) *or get a CM4 compute module with eMMC
Lasse Langwadt Christensen wrote:
> John Larkin: >> 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. >> > > which version of pi? > >> 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. > > using a pi I assume you'll be running some kind of linux I don't see how you > could do 1us timing in linux
My RPi2B is loaded with BSD 14 and its nanosleep() function provides 1ns resolution for my iic interface. Danke, -- Don, KB7RPU, https://www.qsl.net/kb7rpu There was a young lady named Bright Whose speed was far faster than light; She set out one day In a relative way And returned on the previous night.
mandag den 18. juli 2022 kl. 22.18.25 UTC+2 skrev Don:
> Lasse Langwadt Christensen wrote: > > John Larkin: > >> 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. > >> > > > > which version of pi? > > > >> 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. > > > > using a pi I assume you'll be running some kind of linux I don't see how you > > could do 1us timing in linux > My RPi2B is loaded with BSD 14 and its nanosleep() function provides 1ns > resolution for my iic interface.
sure as long as your code is running and not interrupted you can busy wait with nanosec resolution up to few ms try reacting on a signal to measure it's frequency or timestamp it ....
On Mon, 18 Jul 2022 12:36:41 -0700 (PDT), Lasse Langwadt Christensen
<langwadt@fonz.dk> wrote:

>mandag den 18. juli 2022 kl. 21.13.15 UTC+2 skrev John Larkin: >> 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. >> > >which version of pi?
May as well go with 4B.
> >> 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. > >using a pi I assume you'll be running some kind of linux I don't see how you >could do 1us timing in linux >
Of course I need hardware to do microsecond timings. The c programs would pick up the numbers from the hardware.
>maybe look at this: https://beagleboard.org/black >it uses an SoC that has two extra risc cpus with access to everything on the chip >for realtime tasks > >chapter 4 >https://www.ti.com/lit/ug/spruh73q/spruh73q.pdf > >> >> Do pi's have crystal oscillators? I guess we could add one too. > >a PI has everything it needs, just add power (and an SC card*)
4B seems to have a 19.2 MHz crystal, but it doesn't look like it accessable to an external gadget, like an FPGA. I can add a VCXO.
> >*or get a CM4 compute module with eMMC
On Mon, 18 Jul 2022 22:23:21 +0300, Dimiter_Popoff <dp@tgi-sci.com>
wrote:

>On 7/18/2022 22:13, John Larkin wrote: >> >> >> 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?
https://en.wikipedia.org/wiki/Raspberry_Pi 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.
>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.
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. Some torque sensors make tricky timing waveforms.
Lasse Langwadt Christensen <langwadt@fonz.dk> wrote:
> mandag den 18. juli 2022 kl. 22.18.25 UTC+2 skrev Don: >> Lasse Langwadt Christensen wrote: >> > John Larkin: >> >> 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. >> >> >> > >> > which version of pi? >> > >> >> 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. >> > >> > using a pi I assume you'll be running some kind of linux I don't see how you >> > could do 1us timing in linux >> My RPi2B is loaded with BSD 14 and its nanosleep() function provides 1ns >> resolution for my iic interface. > > sure as long as your code is running and not interrupted you can busy wait with > nanosec resolution up to few ms > > try reacting on a signal to measure it's frequency or timestamp it ....
BSD nanosleep() suspends execution of the calling thread. Danke, -- Don, KB7RPU, https://www.qsl.net/kb7rpu There was a young lady named Bright Whose speed was far faster than light; She set out one day In a relative way And returned on the previous night.
On 7/18/2022 23:55, John Larkin wrote:
> On Mon, 18 Jul 2022 22:23:21 +0300, Dimiter_Popoff <dp@tgi-sci.com> > wrote: > >> On 7/18/2022 22:13, John Larkin wrote: >>> >>> >>> 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? > > https://en.wikipedia.org/wiki/Raspberry_Pi > > 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.
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.
> >> 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. > > 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. > > Some torque sensors make tricky timing waveforms. >
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.