[SOLVED] ZBT-WG1602 Stuck Into boot loop

That's a contradiction, isn't it ?

i think you missed the last paragragh.
i am having the issues with openwrt version 19 build. That's why i have posted my query. (edited)

depends on if it was part of the same paragraph, or not :wink:

but let me rephrase, what where you successful in doing, using openwrt 19 ?

The 1602 has a watchdog that cannot be deactivated. It triggers even when the router is booted in flash mode. You have to feed it via GPIO. There's a watchdog script in the original firmware, but the GPIO layout seems different in Openwrt. Here's my adaption:

#!/bin/sh

wdgpio=483
usbgpio=486
low=1
hig=0

if [ ! -f /sys/class/gpio/gpio$wdgpio/value ]; then
    echo $wdgpio > /sys/class/gpio/export
    echo out > /sys/class/gpio/gpio$wdgpio/direction

    # enable usb3
    echo $usbgpio > /sys/class/gpio/export
    echo out > /sys/class/gpio/gpio$usbgpio/direction
    echo $low >/sys/class/gpio/gpio$usbgpio/value

fi

while [ 1 ]
do
        echo $low >/sys/class/gpio/gpio$wdgpio/value
        sleep 1
        echo $hig >/sys/class/gpio/gpio$wdgpio/value
        sleep 1
        echo $low >/sys/class/gpio/gpio$wdgpio/value
        sleep 1
        echo $hig >/sys/class/gpio/gpio$wdgpio/value
        sleep 30

done

edit: I admit I only now read the full thread, this is my dts file. I cheated:

#include "mt7621_zbtlink_zbt-wg3526.dtsi"

/ {
        compatible = "zbtlink,zbt-wg1602", "mediatek,mt7621-soc";
        model = "Zbtlink ZBT-WG1602";
};

&i2c {
        status = "disabled";
};

&firmware {
        reg = <0x50000 0xfb0000>;
};

Anyway, the watchdog is going to be your next challenge. I think it can also be solved via DTS too but I never got around diving deep into this. It's been a while since I was hacking around with that device.

I have disabled watchdog by my script.

#!/bin/ash

#for example watchdog gpio is 2
wd_gpio="3"

echo $wd_gpio > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio$wd_gpio/direction

while [ 1 ]
do
    echo 1 >/sys/class/gpio/gpio$wd_gpio/value
    sleep 1
    echo 0 >/sys/class/gpio/gpio$wd_gpio/value
    sleep 1
	
	echo 1 >/sys/class/gpio/gpio$wd_gpio/value
    sleep 1
    echo 0 >/sys/class/gpio/gpio$wd_gpio/value
    sleep 1
	
	echo 1 >/sys/class/gpio/gpio$wd_gpio/value
    sleep 1
    echo 0 >/sys/class/gpio/gpio$wd_gpio/value
    sleep 1
done

output of: printenv

bootcmd=tftp
bootdelay=1
baudrate=115200
ethaddr="00:AA:BB:CC:DD:10"
ipaddr=192.168.1.1
serverip=192.168.1.100
netmask=255.255.255.0
stdin=serial
stdout=serial
stderr=serial

I have fixed the issue by myself. I have added the below lines into the DTS file.

compatible = "denx,uimage";

partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

Below is the full DTS file.

/dts-v1/;
#include "mt7621.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	model = "ZBT-WG1602";
	
	chosen {
		bootargs = "console=ttyS0,115200";
	};

	gpio-leds {
		compatible = "gpio-leds";

		4g2 {
			label = "4g2";
			gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
		};
		4g {
			label = "4g";
			gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
		};
		card {
			label = "card";
			gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
		};
	};
	
	gpio_export {
		compatible = "gpio-export";
		#size-cells = <0>;

		4g2 {
			gpio-export,name = "4g2";
			gpio-export,output = <0>;
			gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
		};
		4g {
			gpio-export,name = "4g";
			gpio-export,output = <0>;
			gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
		};
		usb_sw {
			gpio-export,name = "usb_sw";
			gpio-export,output = <1>;
			gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
		};
	};


	gpio-keys-polled {
		compatible = "gpio-keys-polled";
		#address-cells = <1>;
		#size-cells = <0>;
		poll-interval = <20>;

		reset {
			label = "reset";
			gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};
	};
};

&sdhci {
	status = "okay";
};

&spi0 {
	status = "okay";

	m25p80@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <10000000>;
		m25p,chunked-io = <32>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;
		

			partition@0 {
				label = "u-boot";
				reg = <0x0 0x30000>;
				read-only;
			};

			partition@30000 {
				label = "u-boot-env";
				reg = <0x30000 0x10000>;
				read-only;
			};

			factory: partition@40000 {
				label = "factory";
				reg = <0x40000 0x10000>;
			};

			firmware: partition@50000 {
				compatible = "denx,uimage";
				label = "firmware";
				reg = <0x50000 0xfb0000>;
			};
		};
	};
};

&pcie {
	status = "okay";
};

&ethernet {
	mtd-mac-address = <&factory 0xe000>;
};

&pinctrl {
	state_default: pinctrl0 {
		gpio {
			ralink,group = "wdt", "i2c", "uart2", "uart3", "rgmii2";
			ralink,function = "gpio";
		};
	};
};

1 Like

How to add this device to the original OpenWrt Repo?

I meant that I want to add this device in OpenWrt Github Repo not locally in my build system.

Either create a PR or send a patch to the mailing list.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.