Pi Zero (2) VPU clock frequency and instruction set

Nov 08, 2022 Last reply: 3 years ago 6 Replies

The VPU is a processor core in the Pi's GPU. I've been messing around with trying to execute code on it for precise timing (no interrupts etc. from Linux).



After much research online, I've got two questions still unanswered. I can probably get by without answers to them, but it's annoying because they seem basic.


1) Is there a specification for the VPU clock frequency of the Pi Zero and Zero 2 stated somewhere? All that I've found is 400MHz on the Raspberry Pi Wikipedia page, but that's unreferenced so I don't really trust it.


2) Is this really the only copy of the instruction set (the public Broadcom documentation doesn't cover the VPU)?

formatting link
The formatting isn't very easy to read as a quick reference. This instruction set should be common to all the Pi models pre-Pi4.


It's variable. See e.g. here (first google hit so presumably you've seen this? so then maybe I don't understand the scope of your question)

formatting link
As always, "jamesh" is not particularly helpful.

It's reverse engineered, and Herman is the one who did the reverse engineering (~2014 or so). So I'm not surprised that it's the only documentation.

I see there are some QPU assemblers but not sure if anyone has written any toolchain for the VPU. If so, they might have the ISA better represented.

Theo

If I saw it, I probably assumed it was a false result because I didn't realise that the "core" frequency is also the VPU clock frequency (I vagely associated it with the peripheral controllers, which seems also to be correct).

Now I've found what I was looking for in the Overclocking section of the config.txt docs, where it indeed lists the core_freq setting as being 400Mhz by default on both Pi Zero models.

formatting link
Thanks!

I was hoping that someone had at least rearranged the info into more of a table structure, like you'd get from a chip manufacturer that doesn't insist on keeping most of their docs soopa secret. There are a handful of example assembly routines out there that people have written for the VPU. It seems like some would have been very hard to write with only a reference like that, but maybe everyone just makes their own version and keeps it to themselves, or they're just vastly better at remembering instruction sets than me.

On the other hand I read that it's based on ARM, so maybe there are some rules by which you can easily tell which ARM instructions are valid or equivalent for the VPU?

Sure, I've found three so far, and I have gone looking though the sources of some in the hope of finding useful comments, but so far I've just seen lists of instruction names without descriptions of what they do.

formatting link
Really everything I want to do is in the examples anyway, but a convenient instruction set reference would make things easier and probably save some guesswork.

Or I could use one of those toolchains and write the code in C, but I suspect that might just introduce more uncertainties because none of them claim to be near release-quality. Plus I'm starting with something very simple anyway.

Ah yes. But I'd be wary of its variability. At a minimum (heh), set the core_freq_min to be the same, I suppose.

And will enabling the mini-uart override that and chug it in 250 MHz anyway? Who knows.

Good point, I'm not sure how the "dynamic frequency clocking" works for the GPU, but I'll set that to 400 and hope that stops it. It sounds like it's only enabled when the CPU is in frequency scaling mode as well.

Well for me the main thing is just to know that it will run at the same speed on both the original Pi Zero and the Pi Zero 2 in the same configuration, so it gives me more confidence with that. Compared to the Wikipedia page where I worried that someone could have just guessed that it was the same as the old model.

But now I've got a 1MHz square wave generator program running on the VPU, so actually it's easy enough to measure any difference now anyway.

I see now that the VPUs seem to be known as the "GPU Core" in RPi the docs, whereas the GPU itself seems to refer to the QPUs. It's especially confusing given that some VideoCore IV GPUs exist without a VPU (the one that Broadcom released the docs for), so those are a VideoCore without a core.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required