barnabear
Posts: 1
Joined: Thu Mar 26, 2015 10:16 pm

max_usb_current=1 ineffective on RPi 2 B

Thu Mar 26, 2015 10:29 pm

I have the following lines in /boot/config.txt

# uncomment to increase maximum usb current from 600mA to 1200 mA
safe_mode_gpio=4
max_usb_current=1

However I cannot effectively power even an SSD in an external usb drive caddy even with a 2A power supply and 2 USB connections.

This setup works just fine on a B+. Could this be to do with the GPIO software incompatibility problem?

Thanks,

Barnabear.

User avatar
electronicsguy
Posts: 156
Joined: Wed Jan 21, 2015 11:20 pm

Re: max_usb_current=1 ineffective on RPi 2 B

Sat Apr 11, 2015 10:45 pm

Did you ever find a solution to this? btw, I don't think you need both lines, if you've updated your installation. Just the "max_usb_current" should be sufficient. I was able to power and run a WD 2TB my passport drive directly from the B+ pi's usb ports. Have you tried connecting a portable harddrive to the 2B to see if that works?
blog: https://electronicsguy.wordpress.com
github: https://github.com/electronicsguy

User avatar
DougieLawson
Posts: 42393
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: max_usb_current=1 ineffective on RPi 2 B

Sat Apr 11, 2015 11:54 pm

Are you running NOOBS? Have you updated the active config?

Use the NOOBS recovery system to edit the config.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

User avatar
eriktheitalian
Posts: 358
Joined: Thu Feb 19, 2015 1:03 pm

Re: max_usb_current=1 ineffective on RPi 2 B

Sun Apr 12, 2015 12:16 am

barnabear wrote:I have the following lines in /boot/config.txt

# uncomment to increase maximum usb current from 600mA to 1200 mA
safe_mode_gpio=4
max_usb_current=1

However I cannot effectively power even an SSD in an external usb drive caddy even with a 2A power supply and 2 USB connections.

This setup works just fine on a B+. Could this be to do with the GPIO software incompatibility problem?

Thanks,

Barnabear.
I'm remembering "safe_mode_gpio=4" not needed by new kernels.
I cant using enough English language. My writings can be wrong grammer.$
"in micro$oft we not trust"

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 14841
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: max_usb_current=1 ineffective on RPi 2 B

Sun Apr 12, 2015 1:41 am

safe_mode_gpio=4
is simply equivalent to
max_usb_current=1

and was used as a stop-gap solution before they re-wrote the code that parses config.txt and added the max_usb_current as a valid variable.

Using either one of them should work, but possibly the mis-use of the safe_mode_gpio variable has been reverted in newer versions that support the official syntax.

P.s. The B2 uses a little more current than a B+ for itself, so leaving less current for anything else, (when powered from a probably current limited supply and through a current limiting polyfuse).
Thats the only reason I can come up with why turning the USB current up doesn't seem to matter. The circuitry is (i am 99.99% sure) exactly the same, and is working.

User avatar
electronicsguy
Posts: 156
Joined: Wed Jan 21, 2015 11:20 pm

Re: max_usb_current=1 ineffective on RPi 2 B

Sun Apr 12, 2015 8:31 pm

@mahjongg: When the option of max usb is set, is there a fuse per usb port? So if the power supply can support it, is it 1.2amps per USB port, or in total?
blog: https://electronicsguy.wordpress.com
github: https://github.com/electronicsguy

User avatar
rpdom
Posts: 21536
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: max_usb_current=1 ineffective on RPi 2 B

Sun Apr 12, 2015 8:50 pm

The 1.2A figure is a total shared across all four ports, not per port.

ampm
Posts: 7
Joined: Mon Oct 29, 2012 2:21 am

Re: max_usb_current=1 ineffective on RPi 2 B

Mon Apr 20, 2015 2:07 pm

Hello,

I have set max_usb_current=1 on a Pi 2 system powered via a 2 A 5 V power supply.

What puzzles me is that the system got unstable:
I run a program that generates a lot of USB traffic. The system is booted in console mode. The system "hangs" randomly in ~ 1-1.5 hours (might be sooner/later, I did not make many runs) with different "symptoms". For example, one time a bunch of syslogd (if I remember it correctly) messages was generated, the USB traffic halted, and the system got unresponsive to keyboard. Another time the USB traffic died, there were no syslogd messages, keyboard got unresponsive.

I was able to run the same system/program for hours (6-12-...) before setting max_usb_current=1.

Does anybody else have a similar issue?

Thanks

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 32227
Joined: Sat Jul 30, 2011 7:41 pm

Re: max_usb_current=1 ineffective on RPi 2 B

Mon Apr 20, 2015 2:41 pm

ampm wrote:Hello,

I have set max_usb_current=1 on a Pi 2 system powered via a 2 A 5 V power supply.

What puzzles me is that the system got unstable:
I run a program that generates a lot of USB traffic. The system is booted in console mode. The system "hangs" randomly in ~ 1-1.5 hours (might be sooner/later, I did not make many runs) with different "symptoms". For example, one time a bunch of syslogd (if I remember it correctly) messages was generated, the USB traffic halted, and the system got unresponsive to keyboard. Another time the USB traffic died, there were no syslogd messages, keyboard got unresponsive.

I was able to run the same system/program for hours (6-12-...) before setting max_usb_current=1.

Does anybody else have a similar issue?

Thanks
Why did you need max_usb_current if everything was working fine? Did you add another device?
Principal Software Engineer at Raspberry Pi Ltd.
Working in the Applications Team.

ampm
Posts: 7
Joined: Mon Oct 29, 2012 2:21 am

Re: max_usb_current=1 ineffective on RPi 2 B

Mon Apr 20, 2015 2:51 pm

jamesh wrote: Why did you need max_usb_current if everything was working fine? Did you add another device?
Well, out if curiosity, I guess.

No device was added.

Thanks

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 32227
Joined: Sat Jul 30, 2011 7:41 pm

Re: max_usb_current=1 ineffective on RPi 2 B

Mon Apr 20, 2015 2:53 pm

ampm wrote:
jamesh wrote: Why did you need max_usb_current if everything was working fine? Did you add another device?
Well, out if curiosity, I guess.

No device was added.

Thanks
That's quite interesting then. If you turn the setting off again, does the problem go away? If so, can you post a bug on the kernel github please.
Principal Software Engineer at Raspberry Pi Ltd.
Working in the Applications Team.

ampm
Posts: 7
Joined: Mon Oct 29, 2012 2:21 am

Re: max_usb_current=1 ineffective on RPi 2 B

Mon Apr 20, 2015 4:52 pm

update:

With a 5 V, 1.2 A power supply and max_usb_cutrent =1 Pi does not boot:
the system reboots right after passing the NOOBS' "Shift key" screen.

System boots fine, my program runs fine with the same 5 V, 1.2 A power supply when I disable max_usb_cutrent =1.

Any ideas?

It looks like max_usb_cutrent =1 makes something on Pi draw lots of current. Might be related to the cause of the original barnabear's problem with an external SSD. Might be an isolated issue of my Pi. ...

User avatar
DougieLawson
Posts: 42393
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: max_usb_current=1 ineffective on RPi 2 B

Mon Apr 20, 2015 6:29 pm

ampm wrote:update:

With a 5 V, 1.2 A power supply and max_usb_cutrent =1 Pi does not boot:
the system reboots right after passing the NOOBS' "Shift key" screen.

System boots fine, my program runs fine with the same 5 V, 1.2 A power supply when I disable max_usb_cutrent =1.

Any ideas?

It looks like max_usb_cutrent =1 makes something on Pi draw lots of current. Might be related to the cause of the original barnabear's problem with an external SSD. Might be an isolated issue of my Pi. ...
It's

Code: Select all

max_usb_current=1
not "cutrent".

Run vcgencmd get_config int to see if the parameter has been set by the GPU.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

buzatti
Posts: 1
Joined: Mon Apr 20, 2015 7:18 pm

Re: max_usb_current=1 ineffective on RPi 2 B

Mon Apr 20, 2015 7:20 pm

Hi.
I m having the same problem. On my old PI B+ the max current setting works fine, on my new PI 2 don´t.
Tks

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 14841
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: max_usb_current=1 ineffective on RPi 2 B

Mon Apr 20, 2015 7:28 pm

buzatti wrote:Hi.
I m having the same problem. On my old PI B+ the max current setting works fine, on my new PI 2 don´t.
Tks
why do you think it doesn't work. It does! the circuitry is very simple, it just switches another resistor on, with a FET not much that can go wrong with that.

one reason why the PI2B may behave different than a B+ is that the 2B draws slightly more current than a B+, so if you turn off the current limitation, the 2B will draw more current than the B+, perhaps too much for your PSU.

ampm
Posts: 7
Joined: Mon Oct 29, 2012 2:21 am

Re: max_usb_current=1 ineffective on RPi 2 B

Mon Apr 20, 2015 9:39 pm

DougieLawson wrote:
ampm wrote:update:

With a 5 V, 1.2 A power supply and max_usb_cutrent =1 Pi does not boot:
the system reboots right after passing the NOOBS' "Shift key" screen.

System boots fine, my program runs fine with the same 5 V, 1.2 A power supply when I disable max_usb_cutrent =1.

Any ideas?

It looks like max_usb_cutrent =1 makes something on Pi draw lots of current. Might be related to the cause of the original barnabear's problem with an external SSD. Might be an isolated issue of my Pi. ...
It's

Code: Select all

max_usb_current=1
not "cutrent".

Run vcgencmd get_config int to see if the parameter has been set by the GPU.
"cutrent" is the typo in my third post above. was typing on a phone. sorry for any possible confusion.

Code: Select all

$ vcgencmd get_config int
arm_control=0xa5800010
arm_freq=1000
avoid_fix_ts=1
config_hdmi_boost=4
core_freq=500
disable_commandline_tags=2
disable_l2cache=1
disable_overscan=1
disable_splash=1
emmc_pll_core=1
force_eeprom_read=1
force_pwm_open=1
framebuffer_ignore_alpha=1
framebuffer_swap=1
hdmi_force_cec_address=65535
hdmi_force_hotplug=1
ignore_lcd=1
max_usb_current=1
over_voltage=2
over_voltage_avs=0x1b774
overscan_bottom=16
overscan_left=24
overscan_right=24
overscan_top=16
pause_burst_frames=1
program_serial_random=1
sdram_freq=500
second_boot=1
temp_limit=85
Again, this is when the system boots with the 2A power supply. It doesn't boot with the 1.2A one when max_usb_current=1.

I am pretty sure max_usb_current=1 is applied since it is (and was) typed correctly on my Pi 2 and setting max_usb_current to 1 leads to the consequences I have described - system instability with 2A power supply and system simply can not boot up with 1.2A one.

thanks!

User avatar
DougieLawson
Posts: 42393
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: max_usb_current=1 ineffective on RPi 2 B

Mon Apr 20, 2015 10:14 pm

Get a better power supply, one that can reliably deliver 2A @ 5V0.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

ampm
Posts: 7
Joined: Mon Oct 29, 2012 2:21 am

Re: max_usb_current=1 ineffective on RPi 2 B

Mon Apr 20, 2015 10:51 pm

DougieLawson wrote:Get a better power supply, one that can reliably deliver 2A @ 5V0.
Hmmm...
Maybe I have failed to clearly describe the problem.
My Pi2B and all the connected devices work fine with the 2A power supply I have. They even do so with the 1.2A one. No problems whatsoever when max_usb_current is at its default value.
However, once I set max_usb_current to 1, the Pi fails to boot with the 1.2A power supply, and USB connections "die" randomly in a while after Pi boots with the 2A one. No extra USB or other devices added. Just max_usb_current is set to 1.
I do not see how this is the issue with the two power supplies I have.
Unless setting max_usb_current=1 leads to increased current consumption by the Pi board.
And it looks like we are talking about quite substantial increase (~ 0.8A, likely more).

So, can anybody please clarify:

Does the max_usb_current=1 setting increase Pi2B board's current draw/consumption (provided nothing else is changed in the Pi2B system and the connected devices)?

If it does, how?

Thanks

klricks
Posts: 8648
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA

Re: max_usb_current=1 ineffective on RPi 2 B

Tue Apr 21, 2015 12:42 am

ampm you appear to be overclocking. Also HDMI current boost.
All bets are off with any amount of OC....
Unless specified otherwise my response is based on the latest and fully updated RPi OS Bullseye w/ Desktop OS.

ampm
Posts: 7
Joined: Mon Oct 29, 2012 2:21 am

Re: max_usb_current=1 ineffective on RPi 2 B

Tue Apr 21, 2015 1:13 am

klricks wrote:ampm you appear to be overclocking. Also HDMI current boost.
All bets are off with any amount of OC....
If you can explain how "overclocking" and current boost can lead to the issues I have described above in one case and do not cause the same issues in another case, please do. I think there is a good explanation other than "all bets are off with any amount of OC....".

For now, sorry, I do not see how this is relevant to the problem at hand.

Thanks

klricks
Posts: 8648
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA

Re: max_usb_current=1 ineffective on RPi 2 B

Tue Apr 21, 2015 4:14 am

ampm wrote:
klricks wrote:ampm you appear to be overclocking. Also HDMI current boost.
All bets are off with any amount of OC....
If you can explain how "overclocking" and current boost can lead to the issues I have described above in one case and do not cause the same issues in another case, please do. I think there is a good explanation other than "all bets are off with any amount of OC....".

For now, sorry, I do not see how this is relevant to the problem at hand.

Thanks
The RPi (or any computer) is not guaranteed to be stable with any amount of OC. Unstable meaning persistent no boot to random hardware/ software crashes, lockups, OS SD corruption etc etc.
IMO OC is the 1st thing to blame for any abnormalities ...... explainable or not.
I have no idea about HDMI current boost but noticed that is was not at default.
Unless specified otherwise my response is based on the latest and fully updated RPi OS Bullseye w/ Desktop OS.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 32227
Joined: Sat Jul 30, 2011 7:41 pm

Re: max_usb_current=1 ineffective on RPi 2 B

Tue Apr 21, 2015 7:31 am

Please try with no overclock to see if that fixes the boot problem. OC uses more power/voltage.

I would also try another USB power lead, I suspect yours is dropping a lot of current, and despite a decent power supply, you are on the limitations of power, and set the current boost is pushing you over somehow.
Principal Software Engineer at Raspberry Pi Ltd.
Working in the Applications Team.

ampm
Posts: 7
Joined: Mon Oct 29, 2012 2:21 am

Re: max_usb_current=1 ineffective on RPi 2 B

Tue Apr 21, 2015 1:27 pm

OK. I see.

Hopefully somebody will take a 1A or a 1.2A or a 1.5A mobile phone charger, power her/his Pi2B board with it with the default max_usb_current setting; then set max_usb_current=1, and power up the board again. And will be kind to let the others know how it went.

Piople who have troubles using external hard drives or other external devices with max_usb_current=1 on P2Bs but were able to do so on the 1st gen boards might provide useful details too. It looks like there is a non-zero number of such persons.

Cheers!

beta-tester
Posts: 1560
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: max_usb_current=1 ineffective on RPi 2 B

Tue Apr 21, 2015 4:39 pm

ampm wrote:Hopefully somebody will take a 1A or a 1.2A or a 1.5A mobile phone charger, power her/his Pi2B board with it with the default max_usb_current setting; then set max_usb_current=1, and power up the board again. And will be kind to let the others know how it went.
hi, i have a 1200mA power supply (http://www.conrad.de/ce/de/product/5146 ... -x-1200-mA)
connected to my RPi2B and the following USB devices directly connected to my RPi2B:
+ SanDisk 64GB Ultra Fit USB3.0 Flash Drive
+ wired Microsoft Corp. Xbox360 Controller
+ TerraTec Cinergy HTC USB XS HD, DVB-C/T/Analog dongle
+ wireless keyboard/mouse dongle
+ wired network connection
+ HDMI TV @ 1920x1080
connected at the same time.

in idle and in normal workload mode the RPi works as expected.
my RPi2B is NOT overclocked.
i was having power issue with the default settings (without having "max_usb_current=1" that option in my config.txt file) in a special condition:
when i tried to write a bigger amount of bytes to the direct connected SanDisk 64GB Ultra Fit USB3.0 Flash Drive via samba networkshare, then the direct connected wired Microsoft Xbox360 Controller begins to flash its four LEDs in a strange way and the write file process will stop and or produces corrupt files...
but the RPi2B does not show up a rainbow rect at the top right corner - so it seams, the power drop is not that much, that the watchdog of the RPi2B will notice it as a power failure...

if i enable "max_usb_current=1" that option in my config.txt file, the power issues is gone, and writing big files to the USB Flash Drive with all other devices connected will succeed.
so, for me it makes a different that option "max_usb_current"

here is what lsusb shows what the usb devices reported as max power consumption (these values are programmed by the device manufacturers and do not represent the real and current power consumption).

Code: Select all

lsusb -v | grep MaxPower

    MaxPower              224mA (USB, SanDisk 64GB Ultra Fit USB3.0 Flash Drive)
    MaxPower              500mA (USB, wired Microsoft Corp. Xbox360 Controller)
    MaxPower              500mA (USB, TerraTec Cinergy HTC USB XS HD, DVB-C/T/Analog dongle)
    MaxPower              100mA (USB, wireless keyboard/mouse dongle)
    MaxPower                2mA (RPi Ethernet)
    MaxPower                2mA (RPi Hub)
    MaxPower                0mA (RPi Hub)

Code: Select all

vcgencmd get_config int

arm_control=0xa5800010
arm_freq=900
avoid_fix_ts=1
config_hdmi_boost=4
disable_commandline_tags=2
disable_l2cache=1
disable_overscan=1
disable_splash=1
emmc_pll_core=1
force_eeprom_read=1
force_pwm_open=1
framebuffer_ignore_alpha=1
framebuffer_swap=1
hdmi_force_cec_address=65535
hdmi_force_hotplug=1
hdmi_ignore_cec_init=1
ignore_lcd=1
max_usb_current=1
over_voltage_avs=0x1b774
pause_burst_frames=1
program_serial_random=1
sdram_freq=450
second_boot=1
temp_limit=85
Last edited by beta-tester on Wed Apr 22, 2015 3:42 pm, edited 1 time in total.
{ I only give negative feedback }
RPi B (256MB), B (512MB), B+, ZeroW; 2B; 3B, 3B+; 4B (4GB)

User avatar
DougieLawson
Posts: 42393
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: max_usb_current=1 ineffective on RPi 2 B

Tue Apr 21, 2015 5:59 pm

I improved your lsusb & grep command to list devices and max power values with

Code: Select all

lsusb -v | grep -e 'MaxPower' -e 'Bus [0-9]'
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

Return to “Troubleshooting”