Issues with SERCOMM NA502S (A1 Smart Home) and OpenWRT

Hello,

I have a SERCOMM NA502S (A1 Smart Home) hub. Since the A1 SmartHome service is discontinued, I want to repurpose the hub with OpenWRT.

Initially, I faced an issue where OpenWRT worked after installation, but I couldn’t access the device after a reboot (no ash over serial / no SSH). I tried various solutions from this forum without success.

Now, I have a new problem: after installing OpenWRT, I go to the webGUI LuCi -> System -> Backup / Flash Firmware -> Flash new firmware image. I upload the Sysupgrade file, but during the reboot, I get the following error message:

Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to recover

I have tried the following Kernel files with their corresponding Sysupgrade files:

23.05.4
23.05.3
23.05.2
22.03.7 (The kernel installed, but when using the Sysupgrade file, I got an error message: “The device is supported, but the config is incompatible with the new image (1.1->1.0). Please upgrade without keeping config (sysupgrade -n). Image check failed.”)

I also tried the snapshot Kernel and Sysupgrade files.

i copied the whole loop down there

Any ideas what I am missing?

Please choose the operation:
   1: Load system code to SDRAM via TFTP.
   2: Load system code then write to Flash via TFTP.
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   9: Load Boot Loader code then write to Flash via TFTP.
STANDALONE_LOAD_ADDR is 0xa1200000
..
******************************************
    Uboot StandAlone Entry
******************************************
                                                                            0

******************************************
    Uboot StandAlone Entry
******************************************

Flash Sector Number : 522.

***************************************************
    Sercomm Boot Version 2.00.6

***************************************************
Entering Firmware : Everything is OK.

=================================================
Check image validation:
Image1 Header Magic Number --> OK
Image2 Header Magic Number --> OK
Image1 Header Checksum --> OK
Image2 Header Checksum --> OK
Image1 Data Checksum --> ........................................................................................OK
Image2 Data Checksum --> ...........................................OK

Image1: OK Image2: OK

=================================================
..kernel addr :0xbfd40000

flash base: 0xbfc00000, kernel addr :0xbfd40000, bootloader size: 0x80000, config size 0x80000, fac size : 0x40000
..Erasing NAND Flash...
.Writing to NAND Flash...
done

3: System Boot system code via Flash.
## Booting image at bfd40000 ...
   Image Name:   MIPS OpenWrt Linux-5.15.162
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    5754115 Bytes =  5.5 MB
   Load Address: 80001000
   Entry Point:  80001000
........................................................................................   Verifying Checksum ... OK
   Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to recover

===================================================================
                MT7621   stage1 code 13:15:05 (ASIC)
                CPU=50000000 HZ BUS=16666666 HZ
==================================================================
Change MPLL source from XTAL to CR...
do MEMPLL setting..
MEMPLL Config : 0x11100000
3PLL mode + External loopback
=== XTAL-40Mhz === DDR-1200Mhz ===
PLL3 FB_DL: 0x9, 1/0 = 599/425 25000000
PLL2 FB_DL: 0x10, 1/0 = 647/377 41000000
PLL4 FB_DL: 0x14, 1/0 = 782/242 51000000
do DDR setting..[00320381]
Apply DDR3 Setting...(use customer AC)
          0    8   16   24   32   40   48   56   64   72   80   88   96  104  112  120
      --------------------------------------------------------------------------------
0000:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0001:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0002:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0003:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0004:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0005:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0006:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0007:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0008:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0009:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000A:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000B:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000C:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000D:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
000E:|    0    0    0    0    0    0    0    0    0    0    1    1    1    1    1    1
000F:|    0    0    0    0    0    1    1    1    1    1    1    1    1    1    1    0
0010:|    1    1    1    1    1    1    1    1    1    1    0    0    0    0    0    0
0011:|    1    1    1    1    1    0    0    0    0    0    0    0    0    0    0    0
0012:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0013:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0014:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0015:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0016:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0017:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0018:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
0019:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001A:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001B:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001C:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001D:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001E:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
001F:|    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
rank 0 coarse = 16
rank 0 fine = 40
B:|    0    0    0    0    0    0    0    0    0    0    1    1    1    0    0    0
opt_dle value:11
DRAMC_R0DELDLY[018]=00001E1E
==================================================================
                RX      DQS perbit delay software calibration
==================================================================
1.0-15 bit dq delay value
==================================================================
bit|     0  1  2  3  4  5  6  7  8  9
--------------------------------------
0 |    13 7 11 10 13 6 13 5 5 12
10 |    8 13 8 13 6 11
--------------------------------------

==================================================================
2.dqs window
x=pass dqs delay value (min~max)center
y=0-7bit DQ of every group
input delay:DQS0 =30 DQS1 = 30
==================================================================
bit     DQS0     bit      DQS1
0  (1~58)29  8  (1~55)28
1  (1~52)26  9  (1~54)27
2  (1~55)28  10  (1~54)27
3  (1~56)28  11  (1~55)28
4  (1~59)30  12  (1~59)30
5  (1~55)28  13  (1~55)28
6  (1~58)29  14  (1~56)28
7  (1~58)29  15  (1~57)29
==================================================================
3.dq delay value last
==================================================================
bit|    0  1  2  3  4  5  6  7  8   9
--------------------------------------
0 |    14 11 13 12 13 8 14 6 7 15
10 |    11 15 8 15 8 12
==================================================================
==================================================================
     TX  perbyte calibration
==================================================================
DQS loop = 15, cmp_err_1 = ffff0000
dqs_perbyte_dly.last_dqsdly_pass[0]=15,  finish count=1
dqs_perbyte_dly.last_dqsdly_pass[1]=15,  finish count=2
DQ loop=15, cmp_err_1 = ffff01aa
DQ loop=14, cmp_err_1 = ffff0080
dqs_perbyte_dly.last_dqdly_pass[1]=14,  finish count=1
DQ loop=13, cmp_err_1 = ffff0080
DQ loop=12, cmp_err_1 = ffff0000
dqs_perbyte_dly.last_dqdly_pass[0]=12,  finish count=2
byte:0, (DQS,DQ)=(9,8)
byte:1, (DQS,DQ)=(8,8)
20,data:89
[EMI] DRAMC calibration passed

===================================================================
                MT7621   stage1 code done
                CPU=50000000 HZ BUS=16666666 HZ
===================================================================


U-Boot 1.1.3 (May  2 2017 - 17:01:08)

Board: Ralink APSoC DRAM:  256 MB
relocate_code Pointer at: 8ffac000

Config XHCI 40M PLL
******************************
Software System Reset Occurred
******************************
Allocate 16 byte aligned buffer: 8ffe1130
Enable NFI Clock
# MTK NAND # : Use HW ECC
NAND ID [C8 D1 80 95 40]
Device not found, ID: c8d1
Not Support this Device!
chip_mode=00000001
Support this Device in MTK table! c8d1
select_chip
[NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
Signature matched and data read!
load_fact_bbt success 1023
load fact bbt success
[mtk_nand] probe successfully!
mtd->writesize=2048 mtd->oobsize=64,    mtd->erasesize=131072  devinfo.iowidth=8
Env addr : 0x80000
..============================================
Ralink UBoot Version: 4.2.1.0
--------------------------------------------
ASIC MT7621AS (MAC to MT7530 Mode)
DRAM_CONF_FROM: Auto-Detection
DRAM_TYPE: DDR3
DRAM bus: 16 bit
Xtal Mode=3 OCP Ratio=1/3
Flash component: NAND Flash
Date:May  2 2017  Time:17:01:08
============================================
icache: sets:256, ways:4, linesz:32 ,total:32768
dcache: sets:256, ways:4, linesz:32 ,total:32768

 ##### The CPU freq = 880 MHZ ####
 estimate memory size =256 Mbytes

Reset switch ...
#Reset_MT7530

Please choose the operation:
   1: Load system code to SDRAM via TFTP.
   2: Load system code then write to Flash via TFTP.
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   9: Load Boot Loader code then write to Flash via TFTP.
STANDALONE_LOAD_ADDR is 0xa1200000
..
******************************************
    Uboot StandAlone Entry
******************************************


******************************************
    Uboot StandAlone Entry
******************************************

My two cents:

  • Those are not "kernels", the kernel is one (the most important one, probably) of the many packages that included in those releases.
  • Tell us the complete names of the files that you have installed.

i downloaded from here: https://firmware-selector.openwrt.org/

Linux kernel with minimal file system. Useful for first installation or recovery.

Model SERCOMM NA502S
Platform ramips/mt7621
Version 23.05.4 (r24012-d8dd03c46f)
Filename: openwrt-23.05.4-ramips-mt7621-sercomm_na502s-initramfs-kernel.bin

Model SERCOMM NA502S
Platform ramips/mt7621
Version 23.05.3 (r23809-234f1a2efa)
Filename: openwrt-23.05.2-ramips-mt7621-sercomm_na502s-initramfs-kernel.bin

Model SERCOMM NA502S
Platform ramips/mt7621
Version 23.05.2 (r23630-842932a63d)
Filename: openwrt-23.05.3-ramips-mt7621-sercomm_na502s-initramfs-kernel.bin

Model SERCOMM NA502S
Platform ramips/mt7621
Version 22.03.7 (r20341-591b7e93d3)
Filename: openwrt-22.03.7-ramips-mt7621-sercomm_na502s-initramfs-kernel.bin

Model SERCOMM NA502S
Platform ramips/mt7621
Version SNAPSHOT (r27094-e5dc16e60d)
filename: openwrt-ramips-mt7621-sercomm_na502s-initramfs-kernel.bin

This i can Flash these Firmwases whitch are called Kernel in their description

then i can use the cammandline interface or the webGUI LuCi

theren i download from the same page as before the sysupgrade File with the same version number i used before:

eg when i made the "firsttime" flash with:
Model SERCOMM NA502S
Platform ramips/mt7621
Version 22.03.7 (r20341-591b7e93d3)
Filename: openwrt-22.03.7-ramips-mt7621-sercomm_na502s-initramfs-kernel.bin

Then i upload for the Sysupgrade the firmaware file: openwrt-22.03.7-ramips-mt7621-sercomm_na502s-squashfs-sysupgrade.bin

The build for the similar NA502 was broken a few months ago, this might also be true for the NA502S. IIRC, it was some problem with kernel size and load address. I will check and report back.

Edit: Ah, easy to find: https://github.com/openwrt/openwrt/pull/14316

A similar patch is probably needed for the NA502S.

And the forum thread: Sercomm NA502 - MT7621 - LZMA ERROR 1

That’s why I tried the 22.03.7

And since then I am stuck in the boot loop

1 Like

I'm not sure if 22.03.7 ever worked. Can you compile a patched version with lzma-loader?

i tried to add it but i failed
i made a custom firmware
chose as far as i know the right settings:
Target: MediaTekRalink MIPS
Subtarget: MT7621
Device: SERCOMM NA502S
under Target Images
-> ramdisk -> Compression (lzma) -> lzma
-> squashfs 256 Block size (in KiB)

did i miss something?

Did you edit the Makefile similar to the patch? You only need to select target and subtarget, the defaults are fine for the rest.

How would I do this?

Once you've obtained the source code, edit the file target/linux/ramips/image/mt7621.mk. Find the section define Device/sercomm_na502s and add a line $(Device/uimage-lzma-loader) right after $(Device/nand).

The complete NA-502S section will then look like this:

define Device/sercomm_na502s
  $(Device/nand)
  $(Device/uimage-lzma-loader)
  IMAGE_SIZE := 20971520
  DEVICE_VENDOR := SERCOMM
  DEVICE_MODEL := NA502S
  DEVICE_PACKAGES := kmod-mt76x2 kmod-mt7603 kmod-usb3 kmod-usb-serial \
		kmod-usb-serial-xr_usb_serial_common -uboot-envtools
endef
TARGET_DEVICES += sercomm_na502s

Save and recompile. Please reset any changes you made when you ran make menuconfig, only change Target, Subtarget and Device to match the NA502S.

Sry for the late reply
I will try your suggestions tomorrow

I deleted the folders I used for compiling the firmware, then newly downloaded everything from Git. I created a new .config file and switched to the directory:

cd /home/dragoncraft/openwrt_23.05/target/linux/ramips/image/
nano mt7621.mk

I added the LZMA loader:

define Device/sercomm_na502s
  $(Device/nand)
  $(Device/uimage-lzma-loader)
  IMAGE_SIZE := 20971520
  DEVICE_VENDOR := SERCOMM
  DEVICE_MODEL := NA502S
  DEVICE_PACKAGES := kmod-mt76x2 kmod-mt7603 kmod-usb3 kmod-usb-serial \
                     kmod-usb-serial-xr_usb_serial_common -uboot-envtools
endef

Next, I compiled the firmware.

Then, I uploaded openwrt-ramips-mt7621-sercomm_na502s-initramfs-kernel.bin to the NA502S.

After configuring the device, I uploaded openwrt-ramips-mt7621-sercomm_na502s-squashfs-sysupgrade.bin.

and i still get the same error

   Uboot StandAlone Entry
******************************************
                                                                                                                                                            0

******************************************
    Uboot StandAlone Entry
******************************************
Flash Sector Number : 522.

***************************************************
    Sercomm Boot Version 2.00.6

***************************************************
Entering Firmware : Everything is OK.

=================================================
Check image validation:
Image1 Header Magic Number --> OK
Image2 Header Magic Number --> OK
Image1 Header Checksum --> OK
Image2 Header Checksum --> OK
Image1 Data Checksum --> ........................................................................................OK
Image2 Data Checksum --> ............................................OK

Image1: OK Image2: OK

=================================================
..kernel addr :0xbfd40000

flash base: 0xbfc00000, kernel addr :0xbfd40000, bootloader size: 0x80000, config size 0x80000, fac size : 0x40000
..Erasing NAND Flash...
.Writing to NAND Flash...
done

3: System Boot system code via Flash.
## Booting image at bfd40000 ...
   Image Name:   MIPS OpenWrt Linux-5.15.162
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    5754115 Bytes =  5.5 MB
   Load Address: 80001000
   Entry Point:  80001000
........................................................................................   Verifying Checksum ... OK
   Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to recover

anybody any ideas?

could it be that i am missing something or ist there a problem ?

I have a spare device in the basement, I just don't know when I find the time to dig it out. To me, it looks like your flash did not succeed, the image size is exactly the same as the previous build - this is very suspicious.

did you have time to find your test device?

Yeah, I found it last week :slight_smile:

In the meantime, the build succeeded, booted via TFTP, flashed to NAND and everything is working fine with the lzma-loader:

3: System Boot system code via Flash.
## Booting image at c1140000 ...
   Image Name:   MIPS OpenWrt Linux-6.6.48
   Image Type:   MIPS Linux Kernel Image (uncompressed)
   Data Size:    3215338 Bytes =  3.1 MB
   Load Address: 80001000
   Entry Point:  80001000
..................................................   Verifying Checksum ... OK
OK
No initrd
## Transferring control to Linux (at address 80001000) ...
## Giving linux memsize in MB, 256

Starting kernel ...



OpenWrt kernel loader for MIPS based SoC
Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
Decompressing kernel... done!
Starting kernel at 80001000...

[    0.000000] Linux version 6.6.48 (andy@x13y) (mipsel-openwrt-linux-musl-gcc (OpenWrt GCC 13.3.0 r27291-9bc782dfd8) 13.3.0, GNU ld (GNU Binutils) 2.42) #0 SMP Mon Sep  2 18:26:42 2024
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[...]

I'll prepare a PR.

PR submitted and accepted for snapshot: https://github.com/openwrt/openwrt/pull/16399
PR for 23.05 submitted and accepted at https://github.com/openwrt/openwrt/pull/16412

Snapshot builds should boot properly in 1-2 days. OpenWrt 23.05.5 should work properly now!