Possible failure in the 8GB RAM purchased last week, I hadn't used it until today, it's in the NAND

Good afternoon @Dot_Brian Dot Bal. I initially downloaded it from there, but I can’t burn it with either Rufus or BalenaEtcher. They say it’s not a bootable file and it won’t burn them.

Do I have to do it in a special way?

I put the file first and then the SD card, and it let me burn it. Now I’ll try it later, while I’m doing some work with another router.

Thank you very much.

The NAND image is intended to be flashed directly from OpenWRT after booting from the SD using these commands:

mtd erase /dev/mtd0
dd if=here_the_NAND_image.img of=/dev/mtdblock0

If you preserve the original partition structure, this will work on the first attempt.

Edit: The NAND image file is either copied directly to a USB pen drive (via simple copy-paste) or downloaded with OpenWRT using wget or curl, without the use of tools like Rufus. Once the image is inside the OpenWRT system, in a folder or similar location, it´s when you use the specified commands.

Okay, thanks for the clarification, but it wouldn’t even let me burn the SD image to the SD card; it said “not bootable.” Now it does let me burn it.

I’ll follow your advice later, putting the image on a USB flash drive and sending the messages you posted via SSH.

Thank you very much.

i cannot tell about ubi, but i flashed my bl2 and uboot this way (also see a skipping bad block)

BPI-R4> mtd list
List of MTD devices:
* spi-nand0
  - device: spi_nand@0
  - parent: spi@1100a000
  - driver: spi_nand
  - path: /spi@1100a000/spi_nand@0
  - type: NAND flash
  - block size: 0x20000 bytes
  - min I/O: 0x800 bytes
  - OOB size: 128 bytes
  - OOB available: 56 bytes
  - 0x000000000000-0x000010000000 : "spi-nand0"
BPI-R4> mtd erase spi-nand0
Erasing 0x00000000 ... 0x0fffffff (2048 eraseblock(s))
Skipping bad block at 0x05320000
BPI-R4> load usb 0:1 $loadaddr 
Failed to load 'bpi-r4.itb'
BPI-R4> load usb 0:1 $loadaddr bpi-r4_spim-nand_8GB_bl2.img
254821 bytes read in 530 ms (468.8 KiB/s)
BPI-R4> mtd write spi-nand0 $loadaddr 0x0 0x100000
Writing 1048576 byte(s) (512 page(s)) at offset 0x00000000
BPI-R4> load usb 0:1 $loadaddr bpi-r4_spim-nand_8GB_fip.bin
300049 bytes read in 32 ms (8.9 MiB/s)
BPI-R4> mtd write spi-nand0 $loadaddr 0x580000 0x200000
Writing 2097152 byte(s) (1024 page(s)) at offset 0x00580000

from within sdcard-uboot, booted up without errors


NOTICE:  BL2: v2.12.0(release):f1b02f8cc-bpi-r4-spim-nand
NOTICE:  BL2: Built : 11:09:06, Apr 10 2025
NOTICE:  WDT: Cold boot
NOTICE:  WDT: disabled
NOTICE:  CPU: MT7988
NOTICE:  EMI: DDR4 4BG mode
NOTICE:  EMI: Using DDR unknown settings
NOTICE:  EMI: Detected DRAM size: 8192 MB
NOTICE:  EMI: complex R/W mem test passed
NOTICE:  LVTS: Enable thermal HW reset
NOTICE:  SPI_NAND parses attributes from parameter page.
NOTICE:  SPI_NAND Detected ID 0xef
NOTICE:  Page size 2048, Block size 131072, size 268435456
NOTICE:  BL2: Booting BL31
NOTICE:  BL31: v2.12.0(release):f1b02f8cc-bpi-r4-spim-nand
NOTICE:  BL31: Built : 11:09:08, Apr 10 2025


U-Boot 2025.01-bpi-g310915161542-dirty (Apr 10 2025 - 11:08:33 +0000)

CPU:   MediaTek MT7988
Model: mt7988-rfb
DRAM:  8 GiB
Core:  56 devices, 21 uclasses, devicetree: separate
MMC:   mmc@11230000: 0
Loading Environment from nowhere... OK
In:    serial@11000000
Out:   serial@11000000
Err:   serial@11000000
=> board_late_init...
bootmedia:spim-nand
Net:   
Warning: ethernet@15100000 (eth0) using random MAC address - 8a:b2:0b:e8:94:c3
eth0: ethernet@15100000
Hit any key to stop autoboot:  0 
BPI-R4> mtd list
spi-nand: spi_nand spi_nand@0: Winbond SPI NAND was found.
spi-nand: spi_nand spi_nand@0: 256 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
jedec_spi_nor spi_nor@0: unrecognized JEDEC id bytes: ff, ff, ff
List of MTD devices:
* spi-nand0
  - device: spi_nand@0
  - parent: spi@1100a000
  - driver: spi_nand
  - path: /spi@1100a000/spi_nand@0
  - type: NAND flash
  - block size: 0x20000 bytes
  - min I/O: 0x800 bytes
  - OOB size: 128 bytes
  - OOB available: 56 bytes
  - 0x000000000000-0x000010000000 : "spi-nand0"
BPI-R4>

but do not know how i can test the nand itself then.

maybe spi-frequency is too high?

You can’t store the NAND image on the SD card (before booting) because it’s needed to boot OpenWRT. It must either be placed on a USB drive or downloaded directly from the web into a folder within the OpenWRT system.

In my case the error was showing for the NAND. It’s not showing on the eMMC which is what I am using now. Don’t remember about the SD (I could build one and test if needed). I am using UBI and have formatted the NAND manually multiple times. Also tried to mark the blocks as bad. Neither helped. So really not clear where the error is coming from. I have tried both with the “official” image and a self built one amd both got the same issue, so as far as I can tell it’s something to do with some of the chips. Not necessarily bad, just maybe with slightly different hardware parameters?

Good evening @Dot_Brian Dot B, yes, I’m sure I’ll boot from the SD card and write the NAND to a USB drive.

I’ll boot from the SD card and send your commands.

Let’s try it.

If for some reason you’re unable to flash the NAND image to the mtdblock0 partition and you’re getting errors,no worries, that’s actually pretty common after messing with the original partition layout. It happened to me earlier today, since my partition setup was different from the stock one after spending days testing various BL2s, OpenWRT builds, preloaders, and so on.

There are several ways to restore the partition layout to its original state so you can flash the NAND back onto it, but the simplest method is to flash the official 8GB image for the BPI-R4 onto the SD card using Rufus. During the first booting, the layout will be restored to one compatible with the steps for flashing the NAND with the commands described.

Also, make sure to keep the NAND image (the one already downloaded + copy&pasted earlier) you want to flash stored on a USB drive plugged into the device, as we’ll be using it later to write back to the NAND.

Before we get started, I strongly recommend connecting the debug UART cable. It’s the only reliable way to monitor what’s happening during the installation process otherwise, it’s really hard to know what stage you’re in or if anything has gone wrong.

Choose the 8GB image prepared for flashing to SD

Once you’ve flashed the image to the SD card using Rufus (or similar), boot the BPI-R4 from it and wait. Since it’s the first time, it will detect that the NAND partitions aren’t in the expected format and will automatically update the layout. After that, you’ll be able to write the image from the USB drive back to the NAND.

Don’t worry if it seems to hang at this message:

kmodloader: done loading kernel modules from blah blah blah

It can take 10 minutes or more to move past that, this is totally normal. Just be patient. In my case, I left it running for about 20 minutes while I did other things, and when I came back, it had already finished.

Also, don’t forget to press ENTER once it’s done booting so the OpenWRT splash screen appears, if I remember correctly, it won’t show unless you press a key.

Once OpenWRT is fully loaded, mount the USB drive and flash the image to the NAND using the following commands:

mount -t vfat /dev/sda1 /mnt
cd /mnt

mtd erase /dev/mtd0
dd if=name_of_the_NAND_image.img of=/dev/mtdblock0

After running the above commands, wait for one or two minutes for the NAND image to be written. Once it’s done, try booting from the NAND and check if the errors are gone (also check if it recognizes the full 8GB of RAM).

I went through this process myself earlier today, and I also had a bunch of defective sectors (only when booting from the NAND) like many people here, but now with the stock 8GB image, I don’t have any issues.

Once you’ve fixed the NAND, you can go ahead and reinstall the OpenWRT build of your choice on the SD card.

1 Like

Good evening @Dot_Brian Dot B, I followed the steps indicated.

I saved the original image mtk-bpi-r4-8g-MP4_1-SD-20250318 to SD before starting to power up the router. I saved the official image mtk-bpi-r4-8g-MP4_1-NAND-20250318 to USB in FAT 32 format.

I followed the steps indicated and looked at what I got. I’m attaching an image to see if you can see what I’m doing wrong.

I hope for your help, thank you.

remove “// change the image” from the command just this:

dd if=name_of_the_NAND_image.img of=/dev/mtdblock0
1 Like

I just realized it now, sorry.

Thanks for your help.

Hello, it’s already recorded, there are no more errors in the NAND…root@OpenWrt:/mnt# dd if=mtk-bpi-r4-8g-MP4_1-NAND-20250318.img of=/dev/mtdblock0 151808+0 records in 151808+0 records out

Here’s an image of how it recognizes the 8GB in the NAND.

F0: 102B 0000
FA: 1042 0000
FA: 1042 0000 [0200]
F9: 0000 0000
V0: 0000 0000 [0001]
00: 0000 0000
BP: 0600 0041 [0000]
G0: 1190 0000
EC: 0000 0000 [1000]
MK: 0000 0000 [0000]
T0:0000 01AD[0101]
Jump to BL

NOTICE: BL2: v2.11.0(release):
NOTICE: BL2: Built : 11:21:00, Mar 8 2025
NOTICE: WDT: Cold boot
NOTICE: WDT: disabled
NOTICE: CPU: MT7988
NOTICE: EMI: DDR4 4BG mode
NOTICE: EMI: Using DDR unknown settings
NOTICE: EMI: Detected DRAM size: 8192 MB
NOTICE: EMI: complex R/W mem test passed
WARNING: CASN page check failed
WARNING: Fail to read CASN page. Try reading parameter page
NOTICE: SPI_NAND parses attributes from parameter page.
NOTICE: SPI_NAND Detected ID 0xef
NOTICE: Page size 2048, Block size 131072, size 268435456
NOTICE: Initializing NMBM...
NOTICE: NMBM management region starts at block 1920 [0x0f000000]
WARNING: Block 1033 is bad
NOTICE: Bad block 1033 [0x08120000]
NOTICE: NMBM has been initialized in read-only mode
NOTICE: BL2: Booting BL31
NOTICE: BL31: v2.11.0(release):
NOTICE: BL31: Built : 11:21:04, Mar 8 2025


U-Boot 2024.10-rc2 (Mar 08 2025 - 11:10:17 +0800)

CPU: MediaTek MT7988
Model: mt7988-rfb
 (mediatek,mt7988-spim-nand-rfb)
DRAM: 8 GiB
Core: 48 devices, 12 uclasses, devicetree: separate

Initializing NMBM...
spi-nand: spi_nand spi_nand@0: CASN page check failed
spi-nand: spi_nand spi_nand@0: Fallback to read ID
spi-nand: spi_nand spi_nand@0: Winbond SPI NAND was found.
spi-nand: spi_nand spi_nand@0: 256 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
Could not find a valid device for nmbm0
NMBM management region starts at block 1920 [0x0f000000]
Bad block 1033 [0x08120000]
Signature has been written to block 2047 [0x0ffe0000]
Main info table has been written to block 1920
Backup info table has been written to block 1923
Logic block 1919 mapped to physical block 2046
NMBM has been successfully created

Loading Environment from MTD... *** Warning - bad CRC, using default environment

In: serial@11000000
Out: serial@11000000
Err: serial@11000000
Net:
Warning: ethernet@15100000 (eth0) using random MAC address - 8e:b9:cb:c6:98:a8
eth0:ethernet@15100000

 ***U-Boot Boot Menu***

 1. Startup system (Default)
 2.Upgrade firmware
 3. Upgrade ATF BL2
 4. Upgrade ATF FIP
 5. Upgrade ATF BL31 only
 6.Upgrade bootloader only
 7.Upgrade single image
 8. Load image
 9. Start Web failsafe
 0. U-Boot console
`F0: 102B 0000
FA: 1042 0000
FA: 1042 0000 [0200]
F9: 0000 0000
V0: 0000 0000 [0001]
00: 0000 0000
BP: 0600 0041 [0000]
G0: 1190 0000
EC: 0000 0000 [1000]
MK: 0000 0000 [0000]
T0:0000 01AD[0101]
Jump to BL

NOTICE: BL2: v2.11.0(release):
NOTICE: BL2: Built : 11:21:00, Mar 8 2025
NOTICE: WDT: Cold boot
NOTICE: WDT: disabled
NOTICE: CPU: MT7988
NOTICE: EMI: DDR4 4BG mode
NOTICE: EMI: Using DDR unknown settings
NOTICE: EMI: Detected DRAM size: 8192 MB
NOTICE: EMI: complex R/W mem test passed
WARNING: CASN page check failed
WARNING: Fail to read CASN page. Try reading parameter page
NOTICE: SPI_NAND parses attributes from parameter page.
NOTICE: SPI_NAND Detected ID 0xef
NOTICE: Page size 2048, Block size 131072, size 268435456
NOTICE: Initializing NMBM...
NOTICE: NMBM management region starts at block 1920 [0x0f000000]
WARNING: Block 1033 is bad
NOTICE: Bad block 1033 [0x08120000]
NOTICE: NMBM has been initialized in read-only mode
NOTICE: BL2: Booting BL31
NOTICE: BL31: v2.11.0(release):
NOTICE: BL31: Built : 11:21:04, Mar 8 2025


U-Boot 2024.10-rc2 (Mar 08 2025 - 11:10:17 +0800)

CPU: MediaTek MT7988
Model: mt7988-rfb
 (mediatek,mt7988-spim-nand-rfb)
DRAM: 8 GiB
Core: 48 devices, 12 uclasses, devicetree: separate

Initializing NMBM...
spi-nand: spi_nand spi_nand@0: CASN page check failed
spi-nand: spi_nand spi_nand@0: Fallback to read ID
spi-nand: spi_nand spi_nand@0: Winbond SPI NAND was found.
spi-nand: spi_nand spi_nand@0: 256 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
Could not find a valid device for nmbm0
NMBM management region starts at block 1920 [0x0f000000]
Bad block 1033 [0x08120000]
Signature has been written to block 2047 [0x0ffe0000]
Main info table has been written to block 1920
Backup info table has been written to block 1923
Logic block 1919 mapped to physical block 2046
NMBM has been successfully created

Loading Environment from MTD... *** Warning - bad CRC, using default environment

In: serial@11000000
Out: serial@11000000
Err: serial@11000000
Net:
Warning: ethernet@15100000 (eth0) using random MAC address - 8e:b9:cb:c6:98:a8
eth0:ethernet@15100000

U-Boot Boot Menu

  1. Startup system (Default) 2.Upgrade firmware
  2. Upgrade ATF BL2
  3. Upgrade ATF FIP
  4. Upgrade ATF BL31 only 6.Upgrade bootloader only 7.Upgrade single image
  5. Load image
  6. Start Web failsafe
  7. U-Boot console`

thanks a lot.

1 Like

Good job! Glad to help :slight_smile:

The NAND should be used strictly as a fallback, due to its limited storage capacity and the fact that it’s running an outdated version of OpenWRT.

Keep the BPI-R4 booting from the SD card or eMMC, as they offer significantly more storage and can run an up-to-date OpenWRT release. That said, at least the NAND is now error-free.

1 Like

Correct, and it doesn’t let you install any packages, so it’s not worth having it on eMMC either.

I currently have it on eMMC, and it recognizes the 8GB.

Regards

You can install additional packages on this (or any) old snapshot, but you must manually fetch and install the exact package versions that correspond to the OpenWRT snapshot build (21.02 for the NAND in this case) from here:

OpenWRT Releases

Alternatively, you can get opkg install working by adding a custom feed to /etc/opkg/customfeeds.conf that points to the appropriate release URL. Once added, you can update and install packages as usual.

But honestly, I wouldn’t bother. The NAND has just 128 MB of storage, which is nothing compared to the 8 GB on the eMMC or the tens of GBs available on an SD card. It really only makes sense to keep the NAND around as a fallback (or as a bridge between the SD and eMMC).

1 Like

Good evening @Dot_Brian Dot B, I knew I would have saved it in my favorites, since many times the snapshots are missing a certain kmod library. I have to search those pages and others I have saved, since they don’t usually add it to the downloads.

Currently, the version I’m using is very complete and I have everything I need. The creator is usually very kind and if you’re missing anything, he’ll add the kmod you need in a new version. I’ll give you the link to the thread where @woziwrt started the project, which he’s taken quite far, but he doesn’t release versions anymore, but he left how to compile and its sources. Now there’s my colleague @RafalB82 who has followed the project. I’ll leave you the link in case you want to visit it, where you currently have all the versions that @RafalB82 releases. Another colleague has also joined who is also releasing versions, @Zerogiven, but I haven’t tried any of his. The ones from @RafalB82 work perfectly for the 10GB XGS-PON ONU SFP 8311-was-110 that I use, since it detects it perfectly, so the 10GB I have contracted give me about 8GB symmetrical, more or less.

Thread page thread page

Page of all versions of @RafalB82, where I create a NAND just to access eMMC. @RafalB82

You got the NAND flash drive on March 29th, and inside there’s a folder called slim. There’s the version.

Speed ​​test taken on eMMC on version 6.6.86, although other versions, like 6.6.79, also used to give me the same result. However, the one I have saved is from the latest version, and I always use WireGuard VPN.

Greetings

1 Like

i had no issue to update the bl2 but it seems that nand is more reluctant…

root@OpenWrt:~/8gb# mtd erase /dev/mtd0
Could not open mtd device: /dev/mtd0
Could not open mtd device: /dev/mtd0
root@OpenWrt:~/8gb# dd if=/root/8gb/bl2nand.img of=/dev/mtdblock0
[  534.806647] mtdblock: MTD device 'bl2' is NAND, please consider using UBI block devices instead.
dd: error writing '/dev/mtdblock0': Operation not permitted
1+0 records in
0+0 records out
root@OpenWrt:~/8gb#

i am on snapshot version of openwrt:

root@OpenWrt:~/8gb# uname -a
Linux OpenWrt 6.6.87 #0 SMP Wed Apr 16 12:38:34 2025 aarch64 GNU/Linux

That’s happening because the partition table has been modified from what the commands expect to find.

To restore the NAND to its factory state, you’ll need to follow the steps I outlined in my big post a few messages above (using the BPI-R4 “official” SD image). Just as a curiosity, you can run the lsblk command before and after applying the SD image change, you’ll notice that the partition layout changes slightly.

Once you’ve completed those steps and reflashed the NAND, you’re free to install whichever version you prefer on the SD card.

That said, I noticed in an earlier post that you mentioned receiving your board this week. If you’re not seeing any bad block errors and still have the original NAND image intact, you likely don’t need to go through this process. It’s not meant as an update, rather it’s intended to revert the NAND back to its factory condition.

Good morning, correct, the NAND I could not put the BL2 NAND that was recorded in any way,

but putting the 24.10 that you wanted in the NAND then you will get defective blocks but do not worry since it only recognizes 4 GB, after installing in EMMC if you want you burn the official one and those blocks will disappear, from there there are no problems in making the BL2 of EMMC can be put without problems and recognize the 8 GB of RAM, by the way I gave more space to the EMMC, first I downloaded cfdisk, then through ssh you send this instruction cfdisk /dev/mmcblk0 and you will get these options resize give it and with the low arrows to dev/mncblockp5 you will get about 443 megabytes I think I remember, give it the dimension you want, I gave it 5G, you have to put it like that and Then press Wirte and then press Yes. mmcblkOp5

When you restart the EMMC, you’ll have those 5GB in disk storage. If you don’t see them, don’t worry. From backup/flsh software, go to the Flash new firmware image option and update with openwrt-mediatek-filogic-bananapi_bpi-r4-squashfs-sysupgrade.itb. You’ll see them appear on the next restart. I’m leaving you photos of the entire process.

backup-flash.sofware Flash new firmware image

1 Like

i was just curious as i am waiting for other stuff and i could see the following thanks to your first post:

root@OpenWrt:/mnt/sda1/BPI-R4-8G-BE1350-WIFI_MP4_1-SDK-20240318# mtd erase /dev/
mtd0
Unlocking /dev/mtd0 ...
Erasing /dev/mtd0 ...

Skipping bad block at 0x2520000
Skipping bad block at 0x2b00000
Skipping bad block at 0x34c0000
Skipping bad block at 0x45c0000
Skipping bad block at 0x4660000
Skipping bad block at 0x5500000
Skipping bad block at 0x5b80000
Skipping bad block at 0x7920000
Skipping bad block at 0x9ea0000
Skipping bad block at 0xbb60000
Skipping bad block at 0xd1c0000
Skipping bad block at 0xd380000
Skipping bad block at 0xe320000
Skipping bad block at 0xe940000
Skipping bad block at 0xede0000
Skipping bad block at 0xee40000
Skipping bad block at 0xf000000

i didnt wrote anything into nand or even emmc as i didnt know how to do it and i prefer sd card or nvme :smiling_face:

root@OpenWrt:/mnt/sda1/BPI-R4-8G-BE1350-WIFI_MP4_1-SDK-20240318# dd if=mtk-bpi-r
4-8g-MP4_1-NAND-20250318.img of=/dev/mtdblock0
151808+0 records in
151808+0 records out
root@OpenWrt:/mnt/sda1/BPI-R4-8G-BE1350-WIFI_MP4_1-SDK-20240318#

it seems that now everything is aligned now. thank you for your help