Skip to content

Add RPi Zero 2 W overclocking defaults #2255

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

Closed
wants to merge 1 commit into from
Closed

Add RPi Zero 2 W overclocking defaults #2255

wants to merge 1 commit into from

Conversation

MichaIng
Copy link
Contributor

@MichaIng MichaIng commented Oct 30, 2021

Additionally incorrect over_voltage defaults and ranges have been fixed.

On RPi 4/400, if default maximum voltage (over_voltage=0) means 0.88V, is it adjusted in 0.025V steps as well? And what is the default minimum voltage (over_voltage_min=0)? As well 0.15V below the max (= 0.73V), like for the other RPi models (aside of RPi 1)? And what about the SDRAM voltage? I would like to merge the two voltage tables to show the resulting relating voltage for RPi 1, RPi 4 variants, and all others in separate columns. Currently both tables contradict because of RPi 4 variants. Probably it makes even sense to merge all three tables: Even that all voltage integer values are the same on all RPi models, the table could additionally contain the related voltage [V] value, which is different. Having everything in one tables should increase overview and reduce scrolling up and down to find information.

@aallan
Copy link
Contributor

aallan commented Oct 31, 2021

Ping @ghollingworth or maybe @pelwell ?

@ghost
Copy link

ghost commented Oct 31, 2021

I would put the new Pi Zero 2 W column immediately after the exisiting 0/W column, and rename that Pi Zero, Zero W for consistency. (The products are called Zero and Zero W, not 0 and 0W). And tweak the other columns so there's spaces in between, e.g. Pi2 -> Pi 2.

@JamesH65
Copy link
Contributor

JamesH65 commented Nov 1, 2021

@popcornmix is the go to person here.

@pelwell
Copy link
Contributor

pelwell commented Nov 1, 2021

The default values for Pi Zero 2 W are correct. If the maximum voltage chance were in a separater PR I'd have approved this already.

@pelwell
Copy link
Contributor

pelwell commented Nov 1, 2021

I think that 1.35V is closer to the truth than 1.3125V for the 2837-based devices, but it's not clear from the software what would prevent it from being higher - there's a hard-coded upper limit of 1.4V, which is then limited further because the PMICs only go up to 1.393735V - but physics and the limits of silicon variability may play a part.

I don't object to this change, but I can't confidently say it is definitively correct.

@MichaIng
Copy link
Contributor Author

MichaIng commented Nov 1, 2021

The voltage value has been corrected here already and the table removed: #1698
But I didn't know that the RPi 4 has different voltages and it wasn't part of the table. So with a later commit the table has been restored to include RPi 4 values, including its errors for the other models.

The voltage stays at over_voltage_min (its related actual voltage) only on absolute idle (CPU frequency at minimum) and jumps to over_voltage as fast as the frequency raises to any higher value. So it should be pretty easy to verify it on RPi 4 via vcgencmd measure_volts.

I just did that on RPi 2 to verify the behaviour we observed on this and other RPi models before, and surprisingly it seems to have changed:

2021-11-01 12:58:49 root@micha:/var/log# vcgencmd get_config over_voltage
over_voltage=4
2021-11-01 12:59:21 root@micha:/var/log# cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
performance
2021-11-01 12:59:28 root@micha:/var/log# vcgencmd measure_volts core
volt=1.3938V

~1.4V != 1.35V + 4*0.025V (=1.45V)

there's a hard-coded upper limit of 1.4V, which is then limited further because the PMICs only go up to 1.393735V - but physics and the limits of silicon variability may play a part.

Ah, and this explains it pretty well, as I simply hit your limit, with over_voltage=4 (!) and it is hit with over_voltage=2 already. Since this setting has no effect on the min/idle voltage, does this mean that currently all the pretty guides stating to reach stable overclocking profiles with over_voltage=6 and more are all wrong, and stating a range up to over_voltage=8 is nonsense? Strange only that I made some tests just yesterday which seem to have shown that higher voltage was required for higher clock rates, but I didn't try to reduce over_voltage too systematically to be true 😅.

For over_voltage_min all is correct:

2021-11-01 12:59:31 root@micha:/var/log# echo powersave > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
2021-11-01 13:01:13 root@micha:/var/log# vcgencmd get_config over_voltage_min
over_voltage_min=-2
2021-11-01 13:01:18 root@micha:/var/log# vcgencmd measure_volts core
volt=1.1500V

1.15V == 1.2V - 2*0.025V

I'll repeat these on RPi Zero W.

As we are already on fixing values. I recognised before that sdram_p is at 1.225V by default instead of at 1.2V like the others:

2021-11-01 12:56:09 root@micha:/var/log# cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
powersave
2021-11-01 12:56:30 root@micha:/var/log# vcgencmd measure_volts sdram_c
volt=1.2000V
2021-11-01 12:56:39 root@micha:/var/log# vcgencmd measure_volts sdram_i
volt=1.2000V
2021-11-01 12:56:41 root@micha:/var/log# vcgencmd measure_volts sdram_p
volt=1.2250V

@JamesH65
Copy link
Contributor

JamesH65 commented Nov 1, 2021

This area is quite a moving target, as this area of code does get tweaked both for existing and new products as time goes by, and of course the various numbers can be different on various devices. When I created the original table I tried to encompass as much as I could from talking with @popcornmix who is the font of all knowledge on this as he is the engineer who deals with the various clock and voltage changes. Simplifying it wasn't an option given the variability of the numbers over different products.

@MichaIng
Copy link
Contributor Author

MichaIng commented Nov 1, 2021

When I created the original table I tried to encompass as much as I could from talking with @popcornmix who is the font of all knowledge on this as he is the engineer who deals with the various clock and voltage changes. Simplifying it wasn't an option given the variability of the numbers over different products.

Then it is probably easiest to merge it into the large table which differentiates between all models, and I'd also vote for merging "This table gives defaults for options that are the same across all models." into the large one. It doesn't hurt when there are more lines, even when the values are mostly the same for all models. That way we can list the over_voltage settings value (always 0) together with the resulting voltage (different at least on RPi 1 and RPi 4) together in one cell.

But makes sense to do this in a separate PR and do only the RPi Zero 2 W addition here. To not loose track of the resulting voltage corrections. @Joulinar do you find time for testing this on Raspberry Pi 4?

echo powersave > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
vcgencmd measure_volts
echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
vcgencmd measure_volts

Once with over_voltage=0, with over_voltage=2 and with over_voltage=6?

I just verified on RPi 2 1.3938V is the absolute maximum, reached with over_voltage=2, hence using any higher value has no further effect. On RPi 1 over_voltage=0 == 1.2V, hence up to over_voltage=8 should be effective, which matches the range given in the first table which describes the available settings. If only the ~1.4V is the upper limit, then on RPi 4 much higher values should be possible. I found overclocking guides with over_voltage=16 and was already wondering whether this has any effect (ignoring wither reasonable or not 😉).

On RPi Zero (1) W with over_voltage=0:

2021-11-01 21:02:42 root@Amizero:~# vcgencmd measure_volts
volt=1.2000V
2021-11-01 21:02:42 root@Amizero:~# vcgencmd measure_volts
volt=1.4000V

So while the minimal voltage is the same, the default maximum voltage is 1.4V 🤔. With over_voltage=2/over_voltage_min=-2:

2021-11-01 21:05:04 root@Amizero:~# vcgencmd measure_volts
volt=1.1500V
2021-11-01 21:05:05 root@Amizero:~# vcgencmd measure_volts
volt=1.4000V

So the minimum voltage is reduced as expected and the maximum voltage capped. Hence the letter cannot be raised at all on RPi Zero (1) models.

popcornmix added a commit to raspberrypi/firmware that referenced this pull request Nov 5, 2021
kernel: drm: Check whether the gamma lut has changed before updating
See: raspberrypi/linux#4664

kernel: brcmfmac: Protect against reprobing
See: #1644

firmware: platform: Fix incorrect turbo voltage scaling on Pi0
See: raspberrypi/documentation#2255
@popcornmix
Copy link
Contributor

On RPi Zero (1) W with over_voltage=0:

2021-11-01 21:02:42 root@Amizero:~# vcgencmd measure_volts
volt=1.2000V
2021-11-01 21:02:42 root@Amizero:~# vcgencmd measure_volts
volt=1.4000V

This was actually a bug. Pi0/Pi0w should run at 1.35V when in turbo mode, so there is a little headroom for overvoltage.
Latest rpi-update firmware fixes this and you should see 1.35V again.

popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Nov 5, 2021
kernel: drm: Check whether the gamma lut has changed before updating
See: raspberrypi/linux#4664

kernel: brcmfmac: Protect against reprobing
See: raspberrypi/firmware#1644

firmware: platform: Fix incorrect turbo voltage scaling on Pi0
See: raspberrypi/documentation#2255
@MichaIng
Copy link
Contributor Author

MichaIng commented Nov 5, 2021

Latest rpi-update firmware fixes this and you should see 1.35V again.

Ah that is good to know, thanks for the clarification.

@aallan
Copy link
Contributor

aallan commented Nov 8, 2021

Sorry, but I'm sort of unclear what the status of the original PR is after the discussion?

@MichaIng
Copy link
Contributor Author

MichaIng commented Nov 8, 2021

@popcornmix could you verify that 1.35V is the correct over_voltage=0 max voltage on RPi 3/3+/Zero 2 W as well, so that we should keep this correction?

I like the suggestions of... now @ghost (removed account) above: #2255 (comment)
Anyone else for/against it? Or shall I do this in a separate PR?

I'll open separate PRs for the sdram_p voltage correction and merging of the tables as suggested above.

mkreisl added a commit to xbianonpi/xbian-package-firmware that referenced this pull request Dec 3, 2021
- firmware: isp: Fix handling of different YUV colour spaces

- firmware: poe_hat: Actually close the I2C handle

- firmware: platform: Define DVFS modes and change default to be fixed AVS voltage

- firmware: arm_loader: Auto-select 64-bit for kernel8.img
  See: #1193

- firmware: hdmi: Throttle auto-i2c register writes to avoid PWM audio underrun

- firmware: platform: Define DVFS modes and change default to be fixed AVS voltage

- firmware: arm_loader: Auto-select 64-bit for kernel8.img
  See: #1193

- firmware: hdmi: Throttle auto-i2c register writes to avoid PWM audio underrun

- firmware: video_decode lockup handling

- firmware: isp: Initialise extras to avoid vpitch being random

- firmware: usb: Fix dropouts with USB ethernet gadget
  See: raspberrypi/linux#4084

- firmware: imx477: Allow long exposures for the binned modes.
  See: https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=297521

- firmware: arm_dispmanx: Use ALPHA_MIX flag
  See: https://www.raspberrypi.org/forums/viewtopic.php?t=300769

- firmware: power: Refactor the interface to the PMICs

- firmware: platform: vl805: Get BAR2 address from PCIe BAR2 registers

- firmware: arm_loader: Return all borrowed DMA channels
  See: #1541

- firmware: hdmi_2711: Rework I2C driver to NOT use the AUTO-I2C block

- firmware: gencmd: Allow groups of clocks/plls to be read together

- firmware: power: Fix DA9090 under-voltage detection

- firmware: NVME boot support

- firmware: brfs: Fix USB bulk-read in start.elf
  See: Hexxeh/rpi-firmware#258

- firmware: hdmi_2711_i2c: Correct handling of start/stop codes for long read
  See: #1548

- firmware: video_decode: For VC1/WMV with no signalled header bytes, use start of 1st buffer
  See: raspberrypi/linux#4113

- firmware: vl805: Remove redundant log statement and fix warning

- firmware: power: Fix DA9090 ADC1 register definition

- firmware: arm_loader: Only report clocks arm has set, not siblings

- firmware: arm_loader: Don't report clocks set as turbo side effect of arm clock

- firmware: arm_loader: 2711: gpu clocks are not dependant

- firmware: platform: Need to clear cached versions of get_max_clock_internal vars

- firmware: Move core to PLLA and support accurate clk108
  See: xbmc/xbmc#19263

- firmware: board_info: Separate memory size from OTP field encoding

- firmware: power: Swap DA9090 ADC assignments to match XR77004

- firmware: board-info: Fix memsize on 3B+

- firmware: vcfw/power: Add a new latch for power_pad_control
  See: #1552

- firmware: arm_loader: kernel_old=1 should force kernel_address=0
  See: #1561

- firmware: scalerlib: Fix offset applied to x coordinate of YUV10COL image
  See: https://forum.kodi.tv/showthread.php?tid=361164&pid=3024654#pid3024654

- firmware: isp: Ensure the VRF is locked when setting up video colour denoise
  See: raspberrypi/rpicam-apps#19

- firmware: isp: Remove custom EV mappings from camera tunings

- firmware: Add support for board-type=0xXX conditional filters in bootloader, bootcode and firmware

- firmware: Two UART1 patches
  See: #1566

- firmware: Pi400: Reduce MII clock freq when probing ethernet PHY

- firmware: platform: Remove build-time constant for MICROVOLTS_PER_PIP

- firmware: dt-blob.dts: Correct HDMI HPD and EMMC_ENABLE for CM4
  See: https://www.raspberrypi.org/forums/viewtopic.php?f=29&p=1858516

- firmware: vcfw/hdmi: CUSTOM modes used for FKMS didn't set RGB quant range correctly
  See: #1580

- firmware: PoE+ HAT support
  See: raspberrypi/linux#4367

- firmware: arm_loader: Use Pi4 bootloader MAC_ADDRESS if set

- firmware: platform: Apply ARM thermal throttling rules on BCM2711

- firmware: bcm_host: Recognise all Pi 4 variants, add BCM2711
  See: raspberrypi/userland#695

- firmware: video_decode: Use the ISP instead of vc_image_convert

- firmware: hdmi-2711: Wait for HDMI hardware scheduler to activate in HDMI mode

- arm_loader: Add message to release firmware framebuffer

- firmware: arm_loader: Add rng-seed DT property
  See: #1595

- firmware: isp: Set the YUV420/YVU420 format stride to 64 byte

- firmware: Revert: video_decode: Use the ISP instead of vc_image_convert

- firmware: cec: Avoid sending messages with kms
  See: raspberrypi/linux#4460

- firmware: hdmi_cec: Remove TX/RX SW_INIT on power_on
  See: Hexxeh/rpi-firmware#267
  See: https://www.raspberrypi.org/forums/viewtopic.php?p=1895082#p1895082

- firmware: arm_dt: Limit CMA to 256MB if total_mem < 2GB or gpu_mem > 256MB
  See: #1603

- firmware: video_decode: Use the ISP instead of vc_image_convert

- firmware: video_decode: Correct support for YVU formats using ISP

- firmware: firmware: Disable VLL loading from file system
  See: #1605

- firmware: arm_loader: Make most arm clock requests required
  See: #1598

- firmware: arm_loader: Consider required flags from GET_CLOCK_RATE
  See: #1598

- firmware: arm_dt: Load overlays for detected cameras

- firmware: Make more use of the user-warnings DT property

- firmware: hdmi_2711: Use HDMI block REPEAT_PIXEL instead of PV
  See: https://forum.libreelec.tv/thread/24415-le-10-beta-for-i4-force-hdmi-resolution

- firmware: DSI display autodetection for kms

- firmware: arm_loader: Allow hvs interrupt during SET_NOTIFY_DISPLAY_DONE

- firmware: arm_display: Allow null buffer in successful call
  See: raspberrypi/linux#4540

- firmware: video_decode: Ensure all buffers are flushed before port disable completes

- firmware: filesystem: sdcard: Fix Hybrid GPT partitions
  See: #1465

- firmware: tvservice: Add check to warn when running with kms

- firmware: arm_loader: Allow non-optional reads of current clock
  See: #1619

- firmware: dispmanx: Demote null eptr from vcos_verify to no warning
  See: raspberrypi/linux#4592

- firmware: filesystem: sdcard: Probe FAT type in GPT ESD partitions

- firmware: clock-2711: Limit PLLB VCO frequency to the high range

- firmware: arm_dt: Export the boot-mode, partition and usb state via device-tree
  See: #1621

- firmware: video_decode: i/p port enable/disable without o/p active could stall
  See: RPi-Distro/vlc#48
  See: Hexxeh/rpi-firmware#272
  See: #1637

- firmware: userland: Reduce debug_sym error messages
  See: https://forums.raspberrypi.com/viewtopic.php?f=98&t=322238

- firmware: arm_dt: Increase maximum line length to 98
  See: raspberrypi/linux#4638

- firmware: arm_loader: Allow VEC clock to be controlled by arm

- firmware: platform: Remove licence on VP6, VP8, Theora, and FLAC
  See: raspberrypi/linux#4661

- firmware: ISP: Fix magenta colour in right hand image of stereo pair
  See: https://forums.raspberrypi.com/viewtopic.php?t=321089

- firmware: platform: Fix incorrect turbo voltage scaling on Pi0
  See: raspberrypi/documentation#2255

- firmware: platform: Declare CM4's SIO_1V8_SEL and SD_PWR_ON
  See: raspberrypi/Raspberry-Pi-OS-64bit#188

- firmware: hello_fft: Update outdated link to V3D spec

- firmware: hello_fft: Remove unused function declaration
  See: #1645
  See: raspberrypi/userland#710

- firmware: dtoverlay: Rebase aliases in overlays like labels

- firmware: isp: Set core/vpu min clock to 320Mhz during ISP operation

- firmware: arm_loader: Enable watchdog early if wanted
  See: #1651

- firmware: board_info: Add upstream dtb names for cm1 & 3

- firmware: board_info: Add upstream dtb name for cm4
  See: #1660

- firmware: platform: Allow users to disable camera boot HMAC check
  See: #1657

- firmware: clock: 2711: Fix potential API issue in 2711 VCO setup

- firmware: arm_loader: Enable USB MSD boot mode on Zero 2 W

- firmware: isp: Fix Rec.709 colour space problems
@github-actions
Copy link

github-actions bot commented Feb 6, 2022

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Additionally incorrect over_voltage defaults and ranges have been fixed.

Signed-off-by: MichaIng <[email protected]>
@aallan
Copy link
Contributor

aallan commented Feb 16, 2022

I think this one is waiting for @popcornmix to verify that 1.35V is the correct over_voltage=0 max voltage on RPi 3/3+/Zero 2 W?

@popcornmix
Copy link
Contributor

No, I believe only 2708 (Pi0/Pi1) uses a fixed voltage for turbo mode (with over_voltage=0).
All newer processors use dvfs (i.e. it is board specific what voltage will be chosen for turbo mode).
I think the only limit here is what the PMIC can produce (which is typically 1.4V or very close).

@aallan
Copy link
Contributor

aallan commented Feb 16, 2022

Thanks @popcornmix

@aallan
Copy link
Contributor

aallan commented Feb 16, 2022

Looking at the resulting table there does seem to be other problems with this PR, looks like the asciidoc formatting isn't correct as the first column shouldn't look like this?

Screenshot 2022-02-16 at 11 17 13

@aallan
Copy link
Contributor

aallan commented Feb 16, 2022

I'm going to close this one. If the OP wants to resubmit with a cleaner update I'm happy to look at that.

@aallan aallan closed this Feb 16, 2022
@MichaIng
Copy link
Contributor Author

MichaIng commented Feb 16, 2022

@popcornmix
I do not understand, what does "fixed voltage" and "dvfs" have to do with it? The question is, in case of over_voltage=0 and a dynamic scaling governor, which maximum (not fixed) voltage these boards have. The docs currently state its 1.3125V for RPi 2 and RPi 3, which is wrong according to own checks on RPi 2 and checking back via users for RPi 3. vcgencmd measure_volts instead shows 1.35V as maximum voltage for those models. Furthermore the docs currently state that RPi Zero has a fixed voltage of 1.35V and a default over_voltage=6, which is both wrong as well: My RPi Zero W (1) has over_voltage=0 by default like every other model and vcgencmd measure_volts shows that the voltage scales between 1.2V and 1.35V, matching the behaviour of RPi 2/3. 1.4V is only ever reached with over_voltage=2 or higher, and never crossed indeed as this is the firmware cap. Only the RPi 1 variants really have a fixed voltage of 1.2V, at least when not changing over_voltage and over_voltage_min.

@aallan
Format fixed: https://github.com/MichaIng/documentation/blob/patch-1/documentation/asciidoc/computers/config_txt/overclocking.adoc#overclocking

@popcornmix
Copy link
Contributor

Pi0w used a very basic dvfs, so on any board with default settings you will get 1.2V at idle, and 1.35V at turbo.
Boards with newer processors use a more advanced dvfs, so the turbo voltage varies with silicon. It could be anywhere between 1.2V and 1.4V. It's not necessarily 1.35V.

@MichaIng
Copy link
Contributor Author

@popcornmix
So the fix in this PR regarding Pi0 is correct. For Pi2 I verified, for Pi3/3+/Zero W 2 at least users report the same: a turbo/max voltage reported by vcgencmd measure_volts of 1.35V (not 1.3125V), 1.4V only with over_voltage=2 or higher (which is not what this table covers). If you say that for 1.4V can be reached with over_voltage=0 on any of these boards, then vcgencmd measure_volts at least never reports it (neither does it ever report 1.3125V), even when stressing the CPU 🤔. In any case, the table currently is wrong, so how do you suggest to fix it?

@JamesH65
Copy link
Contributor

I'd remove the voltage table completely. It's been a nightmare to maintain as the underlying code changes often, and all the numbers change.

@MichaIng
Copy link
Contributor Author

They didn't change since this PR is open at least, aside of on RPi Zero (1) due to a bug, fixed in the meantime. But I agree to better remove the table than to have wrong values in it. I thought about adding over_voltage and over_voltage_min to the defaults table above, only stating the config.txt value (which is 0 in both cases on all boards), skipping the resulting voltage range then.

@aallan
Copy link
Contributor

aallan commented Feb 16, 2022

You're proposing to just remove this one? Or this one and the preceding one..?

Screenshot 2022-02-16 at 14 43 14

@MichaIng
Copy link
Contributor Author

MichaIng commented Feb 16, 2022

Only this one (from my end), but adding the default config.txt values to the preceding one, which I assume won't change.

@aallan
Copy link
Contributor

aallan commented Feb 16, 2022

Okay, lets move to #2433.

@MichaIng
Copy link
Contributor Author

MichaIng commented Feb 17, 2022

@aallan
I rebased this commit so that it now adds only the RPi Zero 2 overclocking defaults: https://github.com/MichaIng/documentation/commit/e504792
May you reopen the PR?

@lurch
Copy link
Contributor

lurch commented Feb 17, 2022

@MichaIng There's so much confusing information in the comments in this PR, it's probably better to create a new PR, rather than make this one even more confusing?

@MichaIng
Copy link
Contributor Author

Valuable information about still open issues with the docs, I'd say 😄. Do the comments hurt for reviewing the changes which finally need to be reviewed? But I can open a new one, of course.

@MichaIng
Copy link
Contributor Author

New PR: #2436

@lurch
Copy link
Contributor

lurch commented Feb 17, 2022

Valuable information about still open issues with the docs, I'd say

If this now-closed PR still contains "valid issues", then IMHO you should open new separate issues for those.

@MichaIng
Copy link
Contributor Author

Will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants