A way to set fixed usb PD?

Hi,

Is there a way to set fixed usb PD parameters? My brick has 2 outputs and I want to use one of them for the rock5b, but the other one is often used for something else that gets plugged in and out.
When that other device is plugged in, the rock5b reboots because the brick will change its output from 20v/3.25A to 12v/1.67A. The rock5b also reboots when that other device is removed as it then moves back to 20v/3.25A.

As it runs quite stable at 12v/1,67a, is there a way to have it fixed at 12v, rather than negotiate 20v when available?

This is a tuff one.
The answer itself is simple, A change in voltage is going to shut down your system.
While PD can’t negotiate voltage on the fly while still powering your board.
In order to keep your board on you will need a battery solution so your board will still have power while PD re-negotiates the new voltage with your adapter.
The much more simpler solution is just use a different power supply.

This is problem of charger itself and it’s not related to rock5. Just get good charger, the one You have may be good for charging phone or tablet, but not anything more.

While I get what you are saying, I totally understand that a chance in voltage will reboot the machine, it is not what I am asking.

I found threads on this forum about it previously not supporting 20v/3a, but now it does. I cant find these threads now again, but I believe it was a change in the device tree blob.
This leads me to believe that one can define the maximum negotiated voltage.
What I’m wanting to do, is to just not allow any negotiated voltage higher than 12 from the start, so that it does not change when another device is plugged in/out.

Ah yes, I think that was a discussion under “Introducing Rock 5 Model B” I believe.
In Linux it might be possible to set a target for your PD but from what I have read it’s only if the firmware allows it and on top of that it must be PD 3.0.
Unfortunately Rock 5 Model B only supports PD 2.0 from everything I’ve read.
So aside from altering the PD firmware to only accept certain voltages the only think you can do is build a board that restricts your voltage and amps to the 12v 1.67a and place it between your power supply and Rock 5.
Everyone here will probably tell you NOT to do either of these things given the Rock 5 isn’t some $20 pie but I’m a thinker and now I’m interested.
I’ll keep looking into this and see if I can find out anything more.

I also think this is a problem on the charger side, I have a number of multi port USB-A/USB-C chargers, and it seems as though all of them will re-negotiate all ports when another device is plugged in. I don’t think it matters what voltage the device(s) are drawing, the adapter has to negotiate the power draw on each port to determine what volt/amp combination it is sending where in order to stay within power budget while supplying each device.

I think a dedicated power supply is definitely the best option here.

One thing I did with my Raspberry Pi is use a USB-C PoE splitter, that way i could power it straight from PoE, it’s just a buck/boost converter inside to drop the voltage down. You might try that route. The one I have delivers 5v on USB-C though, not 12v.

Yes, all of my dual port PD power supplies change V/A when multiple devices are plugged in.
This might not be the case for high end models intended for testing and such but it seems to be the case for generic chargers.
What about sacrificing a USB cable and adding a 12V/1.5A L7812 voltage regulator. There not very expensive and should insure his board only gets 12v so it shouldn’t restart.

@Cyborgium

We have one dtbo to fix your issue. Please try the following steps.

1.Update the kernel to version >=5.10.110-34

$ sudo su
# apt update
# apt install -y linux-5.10-rock-5-latest

2.Add dtbo

# echo "dtoverlay=rock-5b-pd-max-voltage-12v" >> /boot/config.txt
# update_extlinux.sh

3.Reboot and confirm that.

root@rock-5b:~# sensors | grep in0
in0:          12.00 V  (min = +12.00 V, max = +12.00 V)

Ah that’s great!

I tried it and it does work like a charm. So thank you for that!
Unfortunately it doesn’t solve my problem, the power still gets cut for a short moment when another device is plugged in.
Of course this isn’t something you can fix, this will just be weird firmware that’s running on the plug.

I appreciate the time you spent on it though.

I’ll just have to get a second plug. This issue can be considered closed.

1 Like

@Stephen

No matter what USB-C PD i use, it always uses the lowest 5V.
Tested with usb-c 12v (radxa), 33W (xiaomi), 65W (radxa)
Can you advise or suggest a fix to set it to 9V, and 3A?

tcpm_source_psy_4_0022-i2c-4-22
Adapter: rk3x-i2c
in0:           5.00 V  (min =  +5.00 V, max =  +5.00 V)
curr1:         0.00 A  (max =  +0.00 A)

Current dts

	usb_con: connector {
		compatible = "usb-c-connector";
		label = "USB-C";
		data-role = "dual";
		power-role = "sink";
		try-power-role = "sink";
		op-sink-microwatt = <1000000>;
		sink-pdos =
			<PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)
			PDO_FIXED(9000, 3000, PDO_FIXED_USB_COMM)
			PDO_FIXED(12000, 1500, PDO_FIXED_USB_COMM)>;

I tried this (without success):

				<PDO_FIXED(9000, 3000, PDO_FIXED_USB_COMM)
				PDO_FIXED(12000, 1500, PDO_FIXED_USB_COMM)>;

fusb302-4-0022

[ 1.250401] sw reset
[ 1.254214] fusb302 device ID: 0x91
[ 1.258934] pd := off
[ 1.258939] vbus is already Off
[ 1.258942] charge is already Off
[ 1.258946] vconn is already Off
[ 1.259793] pd header := Sink, Device
[ 1.259819] cc1=Open, cc2=Open
[ 1.264443] start drp toggling
[ 1.266424] IRQ: 0x80, a: 0x00, b: 0x00, status0: 0x83
[ 1.266427] IRQ: VBUS_OK, vbus=On
[ 1.273668] IRQ: 0x01, a: 0x40, b: 0x00, status0: 0x81
[ 1.273670] IRQ: TOGDONE
[ 1.279521] detected cc1=Open, cc2=Rp-def
[ 1.279527] cc1=Open, cc2=Rp-def
[ 1.480440] pd header := Sink, Device
[ 1.480471] vbus is already Off
[ 1.485317] pd := on
[ 1.797618] sending PD message header: 8d
[ 1.797630] sending PD message len: 0
[ 1.799839] IRQ: 0x41, a: 0x00, b: 0x00, status0: 0x81
[ 1.799851] IRQ: BC_LVL, handler pending
[ 1.802203] IRQ: 0x41, a: 0x00, b: 0x00, status0: 0x80
[ 1.802215] IRQ: BC_LVL, handler pending
[ 1.804231] IRQ: 0x41, a: 0x00, b: 0x00, status0: 0x81
[ 1.804249] IRQ: BC_LVL, handler pending
[ 1.806272] IRQ: 0x00, a: 0x10, b: 0x00, status0: 0x81
[ 1.806289] IRQ: PD retry failed
[ 1.809350] IRQ: 0x41, a: 0x08, b: 0x00, status0: 0x81
[ 1.809357] IRQ: BC_LVL, handler pending
[ 1.809362] IRQ: PD hardreset sent
[ 1.815404] pd := off
[ 1.815428] vconn is already Off
[ 1.843948] BC_LVL handler, status0=0x81
[ 2.193112] pd header := Sink, Device
[ 2.844004] pd header := Sink, Device
[ 2.848723] pd := on
[ 3.161513] IRQ: 0x41, a: 0x08, b: 0x00, status0: 0x81
[ 3.161516] IRQ: BC_LVL, handler pending
[ 3.161518] IRQ: PD hardreset sent
[ 3.166887] pd := off
[ 3.166893] vconn is already Off
[ 3.167694] pd header := Sink, Device
[ 3.197033] BC_LVL handler, status0=0x81
[ 3.818593] pd header := Sink, Device
[ 3.823366] pd := on

tcpm-4-0022

[ 1.250117] Setting usb_comm capable false
[ 1.254732] Setting voltage/current limit 0 mV 0 mA
[ 1.254737] polarity 0
[ 1.254753] Requesting mux state 0, usb-role 0, orientation 0
[ 1.255550] state change INVALID_STATE -> SNK_UNATTACHED [rev1 NONE_AMS]
[ 1.255575] CC1: 0 -> 0, CC2: 0 -> 0 [state SNK_UNATTACHED, polarity 0, disconnected]
[ 1.255583] Start toggling
[ 1.275405] CC1: 0 -> 0, CC2: 0 -> 3 [state TOGGLING, polarity 0, connected]
[ 1.275409] state change TOGGLING -> SNK_ATTACH_WAIT [rev1 NONE_AMS]
[ 1.275413] pending state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED @ 200 ms [rev1 NONE_AMS]
[ 1.475460] state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED [delayed 200 ms]
[ 1.475472] state change SNK_DEBOUNCED -> SNK_ATTACHED [rev1 NONE_AMS]
[ 1.475478] polarity 1
[ 1.475483] Requesting mux state 1, usb-role 2, orientation 2
[ 1.476332] state change SNK_ATTACHED -> SNK_STARTUP [rev1 NONE_AMS]
[ 1.476338] state change SNK_STARTUP -> SNK_DISCOVERY [rev3 NONE_AMS]
[ 1.476343] Setting voltage/current limit 5000 mV 0 mA
[ 1.476352] vbus=0 charge:=1
[ 1.476360] state change SNK_DISCOVERY -> SNK_WAIT_CAPABILITIES [rev3 NONE_AMS]
[ 1.481093] pending state change SNK_WAIT_CAPABILITIES -> SNK_SOFT_RESET @ 310 ms [rev3 NONE_AMS]
[ 1.791114] state change SNK_WAIT_CAPABILITIES -> SNK_SOFT_RESET [delayed 310 ms]
[ 1.791120] AMS SOFT_RESET_AMS start
[ 1.791123] state change SNK_SOFT_RESET -> AMS_START [rev3 SOFT_RESET_AMS]
[ 1.791125] state change AMS_START -> SOFT_RESET_SEND [rev3 SOFT_RESET_AMS]
[ 1.791127] PD TX, header: 0x8d
[ 1.800590] PD TX complete, status: 2
[ 1.800602] state change SOFT_RESET_SEND -> HARD_RESET_SEND [rev3 SOFT_RESET_AMS]
[ 1.800608] AMS SOFT_RESET_AMS finished
[ 1.800609] AMS HARD_RESET start
[ 1.800611] PD TX, type: 0x5
[ 1.804066] PD TX complete, status: 0
[ 1.804073] state change HARD_RESET_SEND -> HARD_RESET_START [rev3 HARD_RESET]
[ 1.808633] state change HARD_RESET_START -> SNK_HARD_RESET_SINK_OFF [rev3 HARD_RESET]
[ 1.808636] vconn:=0
[ 1.808640] Requesting mux state 1, usb-role 2, orientation 2
[ 2.183633] pending state change SNK_HARD_RESET_SINK_OFF -> SNK_HARD_RESET_SINK_ON @ 650 ms [rev3 HARD_RESET]
[ 2.833667] state change SNK_HARD_RESET_SINK_OFF -> SNK_HARD_RESET_SINK_ON [delayed 650 ms]
[ 2.833677] AMS HARD_RESET finished
[ 2.834499] state change SNK_HARD_RESET_SINK_ON -> SNK_STARTUP [rev3 NONE_AMS]
[ 2.834504] state change SNK_STARTUP -> SNK_DISCOVERY [rev3 NONE_AMS]
[ 2.834507] Setting voltage/current limit 5000 mV 0 mA
[ 2.834516] state change SNK_DISCOVERY -> SNK_WAIT_CAPABILITIES [rev3 NONE_AMS]
[ 2.839146] pending state change SNK_WAIT_CAPABILITIES -> HARD_RESET_SEND @ 310 ms [rev3 NONE_AMS]
[ 3.149169] state change SNK_WAIT_CAPABILITIES -> HARD_RESET_SEND [delayed 310 ms]
[ 3.149173] AMS HARD_RESET start
[ 3.149175] PD TX, type: 0x5
[ 3.152765] PD TX complete, status: 0
[ 3.152778] state change HARD_RESET_SEND -> HARD_RESET_START [rev3 HARD_RESET]
[ 3.157419] state change HARD_RESET_START -> SNK_HARD_RESET_SINK_OFF [rev3 HARD_RESET]
[ 3.157422] vconn:=0
[ 3.157425] Requesting mux state 1, usb-role 2, orientation 2
[ 3.158232] pending state change SNK_HARD_RESET_SINK_OFF -> SNK_HARD_RESET_SINK_ON @ 650 ms [rev3 HARD_RESET]
[ 3.808432] state change SNK_HARD_RESET_SINK_OFF -> SNK_HARD_RESET_SINK_ON [delayed 650 ms]
[ 3.808447] AMS HARD_RESET finished
[ 3.809316] state change SNK_HARD_RESET_SINK_ON -> SNK_STARTUP [rev3 NONE_AMS]
[ 3.809325] state change SNK_STARTUP -> SNK_DISCOVERY [rev3 NONE_AMS]
[ 3.809331] Setting voltage/current limit 5000 mV 0 mA
[ 3.809351] state change SNK_DISCOVERY -> SNK_WAIT_CAPABILITIES [rev3 NONE_AMS]
[ 3.814583] pending state change SNK_WAIT_CAPABILITIES -> SNK_READY @ 310 ms [rev3 NONE_AMS]
[ 4.124805] state change SNK_WAIT_CAPABILITIES -> SNK_READY [delayed 310 ms]

Do you have a module installed in the top M.2 slot? If so, take it out and see if it works then.

I’ve seen reports of some wifi modules breaking the I2C bus, which then makes PD fail.

No, i only have the HDMI + camera, keyboard and mouse attached.
I have plans to push it to the limits, like attach nvme + 3 cameras + usb sata, so i guess i need at least 27W to avoid being hit with reboot, freeze, etc…