Serial install problems on NSA310

The procedure involving usb reset is described on the devicepage.

1 Like

Thank you for your help, really appreciate your effort.
I have a 16GB USB3 Fat32 formatted flash connected to front NAS port, with two files as stated here: https://openwrt.org/toh/zyxel/nsa310b
There is no other disk connected to the NAS.
I have a serial cable connected to the NAS, communication is OK (using Kittty/Putty).
There is standard FW in the NAS and I want to replace it with OpenWRT.

Maybe this is it - how should I stop it? Pressing On/Off button on the NAS? When exactly?

What about serial cable ? Is it connected ?
e.g:

Yep; I could interrupt the U-boot pressing esc, but usb reset gave me 0 storage devices found (USB flash is in the front). Will try more and describe my results here. Thanks:)

Maybe you have older/smaller USB flash ?

I have a 16GB FAT32 formatted disk, but who knows - will try another one...

Tried two different USB3 16GB FAT32 and one USB2 1GB FAT formatted, both USB ports with no luck:

NSA310>> usb reset
(Re)start USB...
USB:   scanning bus for devices... 1 USB Device(s) found
       scanning bus for storage devices... 0 Storage Device(s) found
NSA310>> fatload usb 1 0x1000000 u-boot.kwb
** Can't read from device 1 **

** Unable to use usb 1:1 for fatload **
NSA310>> fatload usb 0 0x1000000 u-boot.kwb
** Can't read from device 0 **

** Unable to use usb 0:1 for fatload **
NSA310>>

There are all LEDs on and the On/Off button on the device is not responsive.

You are writing commands in the device firmware shell. These commands must be written in the uboot shell.
Below you are writing it in the uboot shell, which is the correct place.

For some reason the stock bootloader is unable to detect the USB drives you are using. I don't know why, but some people did have issues like that.

You have to transfer the files with tftp, it's a bit more annoying, I'll post instructions below.

If you install successfully with the following instructions I'll update the wiki with this additional method.

Prepare the tftp server and the files you want to transfer as described here: https://openwrt.org/docs/guide-user/troubleshooting/tftpserver?s[]=tftp#tftp_server_on_windows
Set your PC's ethernet port to have fixed IP address 192.168.1.10 and connect it with an ethernet cable to the NSA310 ethernet port.

boot the NSA310 and reach the uboot (bootloader) console by pressing a key as soon as you see the prompt.

You should see
NSA310>>

Now write

setenv ipaddr 192.168.1.1
setenv serverip 192.168.1.10

Then you can begin the file transfer with
tftp 0x1000000 u-boot.kwb

It should show a progress bar and will tell you if the transfer was successful.

If it's good, then you can proceed with the other instructions, to install the OpenWrt uboot


nand erase 0x0 0x100000
nand write 0x1000000 0x00000 0x100000
reset

Then write your device's mac address as written in the sticker under the NSA310 ( the AB:CD:EF:00:00:00 you see below is an example MAC address, please write your device's MAC in the terminal)

setenv ethaddr AB:CD:EF:00:00:00
saveenv

Then, you can try with normal instructions as you have just installed a different uboot, that should be able to read from USB.

usb reset
fatload usb 0 0x2000000 nsa310.bin

If it fails again, you must use tftp again to load OpenWrt firmware too.
write

setenv ipaddr 192.168.1.1
setenv serverip 192.168.1.10
tftp 0x2000000 nsa310.bin

and then proceed with

nand erase.part ubi
nand write 0x2000000 ubi 0x600000
reset

And OpenWrt should be installed.

Thank you very much for the instructions, I will try them and report later.

I have been trying for several hours without success (from two PCs, Win - tftpd32 + Solarwinds, Ubuntu) so the problem seems to be in the NSA310:

NSA310>> setenv ipaddr 192.168.1.1
NSA310>> setenv serverip 192.168.1.10
NSA310>> tftp 0x1000000 u-boot.kwb
Using egiga0 device
TFTP from server 192.168.1.10; our IP address is 192.168.1.1
Filename 'u-boot.kwb'.
Load address: 0x1000000
Loading: T T T T T T T T T T
Retry count exceeded; starting again
NSA310>>

Giving up for now, maybe I'll try later.
Thanks for your help anyway!

@ir11: Any update so far?
I had the same issue like you. Using four different USB Sticks which didn't work. After that I used the "oldest" USB stick I found supporting USB 1.1 only and it worked. Unfortunately I didn't manage to test the TFTP method on the stock u-boot (thx @bobafetthotmail for the description). Suprisingly I was not able to get a network connection for TFPT, using uboot.2017.07-tld-1.nsa310...

I updated the flashing instructions, trying to collect all information I pulled from different source on one page Table of Hardware - Zyxel NSA310. As this is more or less my first entry, I am looking forward to your feedback

1 Like

Where does the information that the NSA310b image works on an 310s come from? It would surprise me if that is true, as the 310s is a different NAS, with a different SoC. At least the ZyXEL firmware cannot be exchanged.

1 Like

The 310S has the same SoC of NSA310-320-325 but its hardware config is closer to NSA320-325 (most important thing is that it's not using the silly realtek ethernet and is instead using the SoC's own ethernet controller) and should boot and mostly work with that image, as it worked on Debian back then when they were writing the device tree files for these devices https://forum.doozan.com/read.php?2,22241 and only LEDs and power button don't work (as they used different GPIO pins to operate them).

The Zyxel NAS with different SoCs (Marvell Armada) are those from NAS326 and onwards.

Another possible workaround is to use the Sata port. Format it as FAT32 and place the files in it, then

ide reset
fatload ide 0 0x2000000 nsa310.bin

should load the files from the SATA drive.

So for NSA310S I must use NSA325 OpenWrt Image? I tried NSA310b image (as written in the instructions), but Ethernet interface not working

NSA310b uses different ethernet controller so it will not work.

With NSA325 image ethernet is the same so it should work, LEDs and power button will not work.

And is there a way to get the power button working on NSA310S?

The only way is to add official support for the nsa310s in OpenWrt, as the file that defines what GPIO pins are used as buttons and leds (the dts file) is compiled and integrated in the kernel image.

it's easier than adding support for most other devices as it is more or less a carbon copy of what was done to add NSA325, just take the dts file from other projects that support this device like bodh's Debian https://forum.doozan.com/read.php?2,12096

I could provide better directions than this if someone is interested but I'm not doing it myself as I don't have the time and device to test.

I am interested. I can try compile OpenWRT, but I don't know where I get correct dts file for NSA310S.

It's in the *.patch file (it's a text file) in the linux-5.5.1-kirkwood-tld-1-bodhi.tar.bz2 archive form the forum thread I linked above.

It might be easier than I said, there is no need to add official support, you can just compile for NSA310b and just hijack its dtb file to be for your device instead.

download the sources of OpenWrt, then open the file /openwrt/target/linux/kirkwood/files-5.4/arch/arm/boot/dts/kirkwood-nsa310b.dts (this is the dts file of the NSA 310b), delete all text and paste this text (please copy this from inside a Linux system or a text editor that is using Unix line terminator setting or it will mess up the formatting of the text) so now the dts file is correct for your device.

/* 
 * Device tree file for the Zyxel NSA 310S NAS box, hacked to disguise itself as a NSA 310b for OpenWrt
 *
 * Copyright (c) 2015-2016, bodhi <mibodhi@gmail.com>
 *
 * Based on 
 * Copyright (c) 2014, Adam Baker <linux@baker-net.org.uk>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 *
 * Based upon the board setup file created by Peter Schildmann 
 */

/dts-v1/;

#include "kirkwood.dtsi"
#include "kirkwood-6281.dtsi"

/ {
	model = "ZyXEL NSA310b";
	compatible = "zyxel,nsa310b", "zyxel,nsa310", "marvell,kirkwood-88f6281", "marvell,kirkwood";

	memory {
		device_type = "memory";
		reg = <0x00000000 0x10000000>;
	};

	chosen {
		bootargs = "console=ttyS0,115200";
		stdout-path = &uart0;
	};

	ocp@f1000000 {
		pinctrl: pin-controller@10000 {
			pinctrl-names = "default";

			pmx_sata0: pmx-sata0 {
				marvell,pins ; /* NA */
				marvell,function = "sata0";
			};

			pmx_sata1: pmx-sata1 {
				marvell,pins ; /* NA */
				marvell,function = "sata1";
			};

                        pmx_usb_power: pmx-usb-power {
                                marvell,pins = "mpp21"; /* OK */
                                marvell,function = "gpio";
                        };

                        pmx_pwr_off: pmx-pwr-off {
                                marvell,pins = "mpp27"; /* OK */
                                marvell,function = "gpio";
                        };

                        pmx_btn_reset: pmx-btn-reset {
                                marvell,pins = "mpp24"; /* OK */
                                marvell,function = "gpio";
                        };

                        pmx_btn_copy: pmx-btn-copy {
                                marvell,pins = "mpp25"; /* OK */
                                marvell,function = "gpio";
                        };

                        pmx_btn_power: pmx-btn-power {
                                marvell,pins = "mpp26"; /* OK */
                                marvell,function = "gpio";
                        };

			pmx_led_hdd2_green: pmx-led-hdd2-green {
				marvell,pins = "mpp34"; /* OK */
				marvell,function = "gpio";
			};

			pmx_led_hdd2_red: pmx-led-hdd2-red {
				marvell,pins = "mpp12"; /* OK */
				marvell,function = "gpio";
			};

			pmx_led_usb_green: pmx-led-usb-green {
				marvell,pins = "mpp15"; /* OK */
				marvell,function = "gpio";
			};

                        pmx_led_copy_green: pmx-led-copy-green {
                                marvell,pins = "mpp22"; /* OK */
                                marvell,function = "gpio";
                        };

                        pmx_led_copy_red: pmx-led-copy-red {
                                marvell,pins = "mpp23"; /* OK */
                                marvell,function = "gpio";
                        };

			pmx_led_sys_green: pmx-led-sys-green {
				marvell,pins = "mpp28"; /* OK */
				marvell,function = "gpio";
			};

			pmx_led_sys_orange: pmx-led-sys-orange {
				marvell,pins = "mpp29"; /* OK */
				marvell,function = "gpio";
			};

			pmx_led_hdd1_green: pmx-led-hdd1-green {
				marvell,pins = "mpp16"; /* OK */
				marvell,function = "gpio";
			};

			pmx_led_hdd1_red: pmx-led-hdd1-red {
				marvell,pins = "mpp13"; /* OK */
				marvell,function = "gpio";
			};

/*
 			pmx_buzzer: pmx-buzzer {
 				marvell,pins = "mpp20";
 				marvell,function = "gpio";
 			};
*/

			pmx_pwr_sata1: pmx-pwr-sata1 {
				marvell,pins = "mpp33";
				marvell,function = "gpio";
			};
		};

                serial@12000 {
                        status = "ok";
                };

                sata@80000 {
                        status = "okay";
                        nr-ports = <2>;
                };

		rtc@10300 {
			status = "disabled";
		};

		i2c@11000 {
			status = "okay";
			ht1382: rtc@68 {
				compatible = "htk,ht1382";
				reg = <0x68>;
			};
		};
	};

	regulators {
                compatible = "simple-bus";
                #address-cells = <1>;
                #size-cells = <0>;
                pinctrl-names = "default";
		pinctrl-0 = <&pmx_usb_power &pmx_pwr_sata1>;

                usb0_power: regulator@1 {
                        compatible = "regulator-fixed";
                        reg = <1>;
                        regulator-name = "USB Power";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
                        regulator-always-on;
                        regulator-boot-on;
			enable-active-high;
                        gpio = <&gpio0 21 GPIO_ACTIVE_HIGH>;
                };

		sata1_power: regulator@2 {
			compatible = "regulator-fixed";
			reg = <2>;
			regulator-name = "SATA1 Power";
			regulator-min-microvolt = <5000000>;
			regulator-max-microvolt = <5000000>;
			regulator-always-on;
			regulator-boot-on;
			enable-active-high;
			gpio = <&gpio1 1 GPIO_ACTIVE_HIGH>;
		};
	};

        gpio_poweroff {
                compatible = "gpio-poweroff";
                pinctrl-0 = <&pmx_pwr_off>;
                pinctrl-names = "default";
                gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
        };

        gpio_keys {
                compatible = "gpio-keys";
                #address-cells = <1>;
                #size-cells = <0>;
                pinctrl-0 = <&pmx_btn_reset &pmx_btn_copy &pmx_btn_power>;
                pinctrl-names = "default";

                button@1 {
                        label = "Power Button";
                        linux,code = <KEY_POWER>;
                        gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>;
                };
                button@2 {
                        label = "Copy Button";
                        linux,code = <KEY_COPY>;
                        gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
                };
                button@3 {
                        label = "Reset Button";
                        linux,code = <KEY_RESTART>;
                        gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
                };
        };

	gpio-leds {
		compatible = "gpio-leds";
		pinctrl-0 = <&pmx_led_hdd2_green &pmx_led_hdd2_red
			     &pmx_led_usb_green
			     &pmx_led_sys_green &pmx_led_sys_orange
			     &pmx_led_copy_green &pmx_led_copy_red
			     &pmx_led_hdd1_green &pmx_led_hdd1_red>;
		pinctrl-names = "default";

		green-sys {
			label = "nsa310s:green:sys";
			gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "default-on";
		};
		orange-sys {
			label = "nsa310s:orange:sys";
			gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
		};
		green-hdd1 {
			label = "nsa310s:green:hdd1";
			gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
		};
		red-hdd1 {
			label = "nsa310s:red:hdd1";
			gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
		};
		green-hdd2 {
			label = "nsa310s:green:hdd2";
			gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
		};
		red-hdd2 {
			label = "nsa310s:red:hdd2";
			gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
		};
		green-usb {
			label = "nsa310s:green:usb";
			gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
		};
		green-copy {
			label = "nsa310s:green:copy";
			gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "ide-disk";
		};
		red-copy {
			label = "nsa310s:red:copy";
			gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
		};
	};
};

&nand {
        status = "okay";
        chip-delay = <35>;

        partition@0 {
                label = "uboot";
                reg = <0x00c0000 0x0080000>;
        };
	partition@140000 {
		label = "ubi";
		reg = <0x0140000 0x7ec0000>;
         };
};

&mdio {
	status = "okay";
	ethphy0: ethernet-phy@1 {
                compatible = "marvell,88e1510";
		reg = <1>;
	};
};

&eth0 {
	status = "okay";
	ethernet0-port@0 {
		phy-handle = <&ethphy0>;
	};
};

&pciec {
	status = "okay";
};

&pcie0 {
	status = "okay";
};

Save and compile for nsa310b, and you should get an OpenWrt image that will report itself as nsa310b but will be in fact using the correct hardware settings for a nsa310S

EDIT: fixed partitions in dts file

1 Like