Nand not being recognized

Hello, I have faced the problem that sometimes router is not able to boot. After debugging I find out that NAND is not being recognized properly. Need opinion is this a hardware problem?

This is the error when boot fails:

Format: Log Type - Time(microsec) - Message - Optional Info
Log Type: B - Since Boot(Power On Reset),  D - Delta,  S - Statistic
S - QC_IMAGE_VERSION_STRING=BOOT.BF.3.1.1-00120
S - IMAGE_VARIANT_STRING=DAABANAZA
S - OEM_IMAGE_VERSION_STRING=CRM
S - Boot Config, 0x00000021
S - Reset status Config, 0x00000000
S - Core 0 Frequency, 0 MHz
B -       261 - PBL, Start
B -      1338 - bootable_media_detect_entry, Start
B -      1678 - bootable_media_detect_success, Start
B -      1692 - elf_loader_entry, Start
B -      5068 - auth_hash_seg_entry, Start
B -      7210 - auth_hash_seg_exit, Start
B -    577088 - elf_segs_hash_verify_entry, Start
B -    694237 - PBL, End
B -    694260 - SBL1, Start
B -    785266 - pm_device_init, Start
D -         7 - pm_device_init, Delta
B -    786711 - boot_flash_init, Start
D -     56330 - boot_flash_init, Delta
B -    847184 - boot_config_data_table_init, Start
D -      3795 - boot_config_data_table_init, Delta - (419 Bytes)
B -    854718 - clock_init, Start
D -      7552 - clock_init, Delta
B -    866313 - CDT version:2,Platform ID:8,Major ID:1,Minor ID:1,Subtype:0
B -    869727 - sbl1_ddr_set_params, Start
B -    874825 - cpr_init, Start
D -         2 - cpr_init, Delta
B -    879207 - Pre_DDR_clock_init, Start
D -         4 - Pre_DDR_clock_init, Delta
D -     13176 - sbl1_ddr_set_params, Delta
B -    892945 - pm_driver_init, Start
D -         2 - pm_driver_init, Delta
B -    963384 - sbl1_wait_for_ddr_training, Start
D -        27 - sbl1_wait_for_ddr_training, Delta
B -    979224 - Image Load, Start
D -    152401 - QSEE Image Loaded, Delta - (297752 Bytes)
B -   1132052 - Image Load, Start
D -      1445 - SEC Image Loaded, Delta - (2048 Bytes)
B -   1142468 - Image Load, Start
D -    244341 - APPSBL Image Loaded, Delta - (500064 Bytes)
B -   1387207 - QSEE Execution, Start
D -        60 - QSEE Execution, Delta
B -   1393421 - SBL1, End
D -    701269 - SBL1, Delta
S - Flash Throughput, 2004 KB/s  (800635 Bytes,  399395 us)
S - DDR Frequency, 537 MHz


U-Boot 1.5 [ ,r16279-5cc0535800] (Jul 24 2023 - 14:33:19)

smem ram ptable found: ver: 1 len: 3
DRAM:  256 MiB
machid : 0x8010100
NAND:  SF NAND unsupported id:0:70:41:70SF NAND unsupported id:0:70:41:70SF: Detected default with page size 64 KiB, total 16 MiB
SF: Detected XTX Technology with page size 64 KiB, total 16 MiB
ipq_spi: page_size: 0x100, sector_size: 0x10000, size: 0x1000000
32 MiB
MMC:
In:    serial
Out:   serial
Err:   serial
machid: 8010100
flash_type: 0
Hit any key to stop autoboot:  0
nand1: offset 08000000 beyond flash size 01000000
Error initializing mtdparts!

This is when device boots successfully:

Format: Log Type - Time(microsec) - Message - Optional Info
Log Type: B - Since Boot(Power On Reset),  D - Delta,  S - Statistic
S - QC_IMAGE_VERSION_STRING=BOOT.BF.3.1.1-00120
S - IMAGE_VARIANT_STRING=DAABANAZA
S - OEM_IMAGE_VERSION_STRING=CRM
S - Boot Config, 0x00000021
S - Reset status Config, 0x00000010
S - Core 0 Frequency, 0 MHz
B -       261 - PBL, Start
B -      1338 - bootable_media_detect_entry, Start
B -      1678 - bootable_media_detect_success, Start
B -      1692 - elf_loader_entry, Start
B -      5068 - auth_hash_seg_entry, Start
B -      7209 - auth_hash_seg_exit, Start
B -    577087 - elf_segs_hash_verify_entry, Start
B -    694221 - PBL, End
B -    694245 - SBL1, Start
B -    785251 - pm_device_init, Start
D -         7 - pm_device_init, Delta
B -    786695 - boot_flash_init, Start
D -     56332 - boot_flash_init, Delta
B -    847173 - boot_config_data_table_init, Start
D -      3795 - boot_config_data_table_init, Delta - (419 Bytes)
B -    854707 - clock_init, Start
D -      7567 - clock_init, Delta
B -    866317 - CDT version:2,Platform ID:8,Major ID:1,Minor ID:1,Subtype:0
B -    869730 - sbl1_ddr_set_params, Start
B -    874826 - cpr_init, Start
D -         2 - cpr_init, Delta
B -    879208 - Pre_DDR_clock_init, Start
D -         4 - Pre_DDR_clock_init, Delta
D -     13175 - sbl1_ddr_set_params, Delta
B -    892945 - pm_driver_init, Start
D -         2 - pm_driver_init, Delta
B -    963361 - sbl1_wait_for_ddr_training, Start
D -        27 - sbl1_wait_for_ddr_training, Delta
B -    978981 - Image Load, Start
D -    152233 - QSEE Image Loaded, Delta - (297752 Bytes)
B -   1131642 - Image Load, Start
D -      1442 - SEC Image Loaded, Delta - (2048 Bytes)
B -   1142043 - Image Load, Start
D -    244101 - APPSBL Image Loaded, Delta - (500064 Bytes)
B -   1386543 - QSEE Execution, Start
D -        60 - QSEE Execution, Delta
B -   1392770 - SBL1, End
D -    700524 - SBL1, Delta
S - Flash Throughput, 2006 KB/s  (800635 Bytes,  398994 us)
S - DDR Frequency, 537 MHz


U-Boot 1.5 [ ,r16279-5cc0535800] (Jul 24 2023 - 14:33:19)

smem ram ptable found: ver: 1 len: 3
DRAM:  256 MiB
machid : 0x8010100
NAND:  spi_nand: spi_nand_flash_probe SF NAND ID 0:b:e2:b
SF: Detected XT26G02A with page size 2 KiB, total 256 MiB
SF: Detected XTX Technology with page size 64 KiB, total 16 MiB
ipq_spi: page_size: 0x100, sector_size: 0x10000, size: 0x1000000
272 MiB
MMC:
In:    serial
Out:   serial
Err:   serial
machid: 8010100
flash_type: 0
Hit any key to stop autoboot:  0
Creating 1 MTD partitions on "nand1":
0x000008000000-0x000010000000 : "mtd=0"
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    126976 bytes
UBI: smallest flash I/O unit:    2048
UBI: VID header offset:          2048 (aligned 2048)
UBI: data offset:                4096
UBI: attached mtd2 to ubi0
UBI: MTD device name:            "mtd=0"
UBI: MTD device size:            128 MiB
UBI: number of good PEBs:        1022
UBI: number of bad PEBs:         2
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     3
UBI: available PEBs:             0
UBI: total number of reserved PEBs: 1022
UBI: number of PEBs reserved for bad PEB handling: 10
UBI: max/mean erase counter: 1/0
Read 0 bytes from volume kernel to 84000000
No size specified -> Using max size (4317184)
STM32: detected: 0x02 0x04 0xFC 0x03 0x02 0x00 0x00 0x00 0x00 0x00 0x98
## Booting kernel from FIT Image at 84000000 ...
   Using 'conf_mdtb@9' configuration
   Trying 'kernel@1' kernel subimage
     Description:  ARM OpenWrt Linux-5.4.229
     Type:         Kernel Image
     Compression:  gzip compressed
     Data Start:   0x840000e4
     Data Size:    3950195 Bytes = 3.8 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: 0x80208000
     Entry Point:  0x80208000
     Hash algo:    crc32
     Hash value:   7ef2f3cc
     Hash algo:    sha1
     Hash value:   39a7667dd0eb5fe6f26f73d08ad068e765e7b7e4
   Verifying Hash Integrity ... crc32+ sha1+ OK
## Flattened Device Tree from FIT Image at 84000000
   Using 'conf_mdtb@9' configuration
   Trying 'fdt@9' FDT blob subimage
     Description:  image-qcom-ipq4018-rutx-14_STM32.dtb
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x843e6698
     Data Size:    17512 Bytes = 17.1 KiB
     Architecture: ARM
     Hash algo:    crc32
     Hash value:   8fec3950
     Hash algo:    sha1
     Hash value:   ec7d585f71a3964883235705b15ec5ec9ae86279
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Booting using the fdt blob at 0x843e6698
   Uncompressing Kernel Image ... OK
   Loading Device Tree to 86ff8000, end 86fff467 ... OK
Using machid 0x8010100 from environment

Starting kernel ...

It appears you are using firmware that is not from the official OpenWrt project.

When using forks/offshoots/vendor-specific builds that are "based on OpenWrt", there may be many differences compared to the official versions (hosted by OpenWrt.org). Some of these customizations may fundamentally change the way that OpenWrt works. You might need help from people with specific/specialized knowledge about the firmware you are using, so it is possible that advice you get here may not be useful.

You may find that the best options are:

  1. Install an official version of OpenWrt, if your device is supported (see https://firmware-selector.openwrt.org).
  2. Ask for help from the maintainer(s) or user community of the specific firmware that you are using.
  3. Provide the source code for the firmware so that users on this forum can understand how your firmware works (OpenWrt forum users are volunteers, so somebody might look at the code if they have time and are interested in your issue).

If you believe that this specific issue is common to generic/official OpenWrt and/or the maintainers of your build have indicated as such, please feel free to clarify.