Skip to content
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

avoid_pwm_pll=1 changes mmc clock #726

Closed
portets opened this issue Jan 22, 2017 · 9 comments
Closed

avoid_pwm_pll=1 changes mmc clock #726

portets opened this issue Jan 22, 2017 · 9 comments

Comments

@portets
Copy link

portets commented Jan 22, 2017

Specifically, dtparam=sd_overclock=100 with avoid_pwm_pll=1 changes the real mmc clock to 83.3.

@pelwell
Copy link
Contributor

pelwell commented Jan 22, 2017

The sdhost interface, which is what Pis now use to drive the SD card, doesn't use the MMC clock (I wish it did) - instead it has to make do with the system clock. What you have observed doesn't sound like a bug - it just suggests that your core frequency is 250MHz.

What other settings do you have, and why do you think you should be able to hit 100MHz?

@portets
Copy link
Author

portets commented Jan 22, 2017

So sudo cat /sys/kernel/debug/mmc0/ios will report an inaccurate clock when using the sdhost interface? With core_freq=500 and dtparam=sd_overclock=100 it reports 100MHz, but only 83.3MHz when avoid_pwm_pll=1 is added.

@pelwell
Copy link
Contributor

pelwell commented Jan 22, 2017

The sdhost clock is the same as the core clock - try measuring the core clock instead:

vcgencmd measure_clock core

The sdhost interface can only run at integer divisions of the core clock, so the requested speed is only a target (and never exceeded).

@portets
Copy link
Author

portets commented Jan 22, 2017

In both cases vcgencmd measure_clock core gives 500Mhz, but sudo cat /sys/kernel/debug/mmc0/ios gives an "actual clock" of 100MHz or 83.3MHz depending on avoid_pwm_pll. So it sounds like using dtparam=sd_overclock=100 with avoid_pwm_pll=1 is changing the the integer divisor from 5 to 6?

Running sd benchmarks seems to correlate. Read speeds are about 20% slower when adding avoid_pwm_pll=1, with no other config changes.

@pelwell
Copy link
Contributor

pelwell commented Jan 23, 2017

I don't see the same effect. Using a Pi3 with this config.txt:

pi@raspberrypi:~$ cat /boot/config.txt
enable_uart=1
dtparam=sd_overclock=100
core_freq=500
force_turbo=1
avoid_pwm_pll=1

I get:

pi@raspberrypi:~$ sudo cat /sys/kernel/debug/mmc0/ios
clock:          50000000 Hz
actual clock:   100000000 Hz
vdd:            21 (3.3 ~ 3.4 V)
bus mode:       2 (push-pull)
chip select:    0 (don't care)
power mode:     2 (on)
bus width:      2 (4 bits)
timing spec:    2 (sd high-speed)
signal voltage: 0 (3.30 V)
driver type:    0 (driver type B)
pi@raspberrypi:~$ vcgencmd measure_clock core
frequency(1)=500000000

Note that running with force_turbo=1 is not recommended, particularly without a heat sink, but in this case it is required in order to keep the core running at 500MHz (core_freq only sets the turbo frequency, and the Pi will only go into turbo mode when under load).

It's probably worth checking that your core isn't being throttled, either for voltage or thermal reasons. vcgencmd get_throttled should return throttled=0x0 on a healthy Pi.

Finally, the "actual clock" displayed in the mmc0 metrics is the maximum of the turbo/non-turbo values - it is not updated when the Pi switches into and out of turbo so may not reflect reality, but your throughput measurements will not lie.

@portets
Copy link
Author

portets commented Jan 23, 2017

Huh, I can't seem to replicate it any more. User error maybe, not sure. force_turbo was always on so I don't know what it was. Although:
core_freq=600 dtparam=sd_overclock=100 force_turbo=1 avoid_pwm_pll=1
gives me an "actual clock" of 50MHz instead of 100MHz. And it reports core_freq not being throttled.

I could close this otherwise.

@pelwell
Copy link
Contributor

pelwell commented Jan 23, 2017

600MHz is very high - many Pi's won't be able to achieve stability at that frequency.
Having said that, I did get mine to boot (with an over_voltage of 6) and found that actual_clock is still 100MHz.

These are the active config.txt settings I used:

enable_uart=1
dtparam=audio=off
dtparam=i2c_arm=on
dtparam=spi=on
core_freq=600
over_voltage=6
dtparam=sd_overclock=100
avoid_pwm_pll=1
force_turbo=1

And the results:

pi@raspberrypi:~$ sudo cat /sys/kernel/debug/mmc0/ios
clock:          50000000 Hz
actual clock:   100000000 Hz
vdd:            21 (3.3 ~ 3.4 V)
bus mode:       2 (push-pull)
chip select:    0 (don't care)
power mode:     2 (on)
bus width:      2 (4 bits)
timing spec:    2 (sd high-speed)
signal voltage: 0 (3.30 V)
driver type:    0 (driver type B)
pi@raspberrypi:~$ vcgencmd measure_clock core
frequency(1)=600000000

@pelwell
Copy link
Contributor

pelwell commented Jan 23, 2017

And for the record, avoid_pwm_pll is no longer recognised by the firmware, so it can't have caused whatever issue it was that you saw. I've removed it from our list of configuration settings.

@pelwell pelwell closed this as completed Jan 23, 2017
@popcornmix
Copy link
Contributor

FYI the setting was removed here: Hexxeh/rpi-firmware@260bc9c

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

No branches or pull requests

3 participants