Ubiquiti ER‑X‑SFP: Add GPIO for PoE

Somebody finally figured out how to enable PoE for the Ubiquiti ER‑X‑SFP.

insmod i2c-gpio-custom bus0=0,3,4
echo pca9555 0x25 >/sys/bus/i2c/devices/i2c-0/new_device


I tried to add a proper entry to the .dts file that adds the GPIO pins but I wasn't successful as I have less to zero knowledge on how all this entries work together. But I guess for somebody who knows what he is doing it would be fairly easy to get it working with the information from the wiki.

Could somebody help me out on this?

After more hours of trial and error I found a working solution.

i2c@0 {
	reg = <0>;
	#address-cells = <1>;
	#size-cells = <0>;
	compatible = "i2c-gpio";
	gpios = <&gpio0 3 0 /* sda */
		&gpio0 4 0 /* scl */

	gpio@25 {
		reg = <0x25>;
		compatible = "nxp,pca9555";


Congrats! Have you submitted the patch?

Not yet, want to do some more testing and check if we need to split up the device tree as ER-X and ER-X SFP have different PoE capabilities.

1 Like

Ah cool, i had the unit on my desk and was going to try it out today. looking fwd to seeing your results, the normal ERX has a POE port aswell, would be nice if i could get it to work :slight_smile:

As of today the echo command produces an error (and seems not be necessary and more):

# insmod i2c-gpio-custom bus0=0,3,4
# echo pca9555 0x25 >/sys/bus/i2c/devices/i2c-0/new_device 
ash: write error: Invalid argument

Also the GPIO export doesn't work anymore and more or less seems not be needed:

# echo "499" > /sys/class/gpio/export
ash: write error: Resource busy

Finally my PoE setup is following:

 # enable poe-out eth0
 echo "out" > /sys/class/gpio/gpio496/direction
 echo "0" > /sys/class/gpio/gpio496/value
 # enable poe-out eth1
 echo "out" > /sys/class/gpio/gpio497/direction
 echo "1" > /sys/class/gpio/gpio497/value
 # enable poe-out eth2
 echo "out" > /sys/class/gpio/gpio498/direction
 echo "1" > /sys/class/gpio/gpio498/value
 # enable poe-out eth3
 echo "out" > /sys/class/gpio/gpio499/direction
 echo "1" > /sys/class/gpio/gpio499/value
 # enable poe-out eth4
 echo "out" > /sys/class/gpio/gpio500/direction
 echo "1" > /sys/class/gpio/gpio500/value

I intend to change the OpenWrt wiki, but I'm unsure why the commands have changed. Can someone confirm above and/or comment?

$ git log --oneline|grep $device_name might shed some light on what changed in the source code.

New URL: https://openwrt.org/toh/ubiquiti/ubiquiti_edgerouter_x_er-x_ka

The old page is for archival purposes only and does not receive updates any more.

Thanks. I checked already upfront the new wiki page. In the sense of the PoE my questions was still the same (since the wiki page is the same on that part). I did some more tests today and I'm going to edit the wiki now with the latest status as of OpenWrt 19.07(-rc2).