Error setting up UBI system

Hi, I am trying to write a filesystem to the nand on my board and getting some errors (see below). Is my nand bad? Can I work around it?

Thanks

Command:

ubiformat -y /dev/mtd4 -f rootfs.ubi

Output:

ubiformat: mtd4 (nand), size 530055168 bytes (505.5 MiB), 4044 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 4043 – 100 % complete
ubiformat: 4038 eraseblocks have valid erase counter, mean value is 5
ubiformat: 1 eraseblocks are supposedly empty
ubiformat: 5 bad eraseblocks found, numbers: 2647, 2649, 2650, 2651, 4022
ubiformat: flashing eraseblock 427 – 100 % complete
ubiformat: formatting eraseblock 2645 – 61 % complete libmtd: error!: cannot write 512 bytes to mtd4 (eraseblock 2645, offset 0)
cannot write 512cannot write 512

ubiformat: error!: cannot write EC header (512 bytes buffer) to eraseblock 2645
error 5 (Input/output error)
libmtd: run torture test for PEB 2645
libmtd: error!: erased PEB 2645, but a non-0xFF byte found
ubiformat: marking block 2645 bad
libmtd: error!: MEMSETBADBLOCK ioctl failed for eraseblock 2645 (mtd4)
error 5 (Input/output error)

which nand chip are you using?

It is actually a LogicPD torpedo board with onboard 512mb flash. It is an omap3 similar to the original beagle board or gumstix.

Thanks

can you flash_earse /dev/mtd4 0 0 ?

This is what I get when I try to do flash_erase:

root@overo:~# flash_erase /dev/mtd4 0 0
Erasing 128 Kibyte @ 14a80000 – 65 % complete flash_erase: Skipping bad block at 14aa0000
Erasing 128 Kibyte @ 14ac0000 – 65 % complete flash_erase: Skipping bad block at 14ae0000
Erasing 128 Kibyte @ 14b00000 – 65 % complete flash_erase: Skipping bad block at 14b20000
flash_erase: Skipping bad block at 14b40000
flash_erase: Skipping bad block at 14b60000
Erasing 128 Kibyte @ 1f6a0000 – 99 % complete flash_erase: Skipping bad block at 1f6c0000
Erasing 128 Kibyte @ 1f960000 – 100 % complete

After doing the flash_erase, the ubiformat completed:

ubiformat: mtd4 (nand), size 530055168 bytes (505.5 MiB), 4044 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 4043 – 100 % complete
ubiformat: 4037 eraseblocks are supposedly empty
ubiformat: 6 bad eraseblocks found, numbers: 2645, 2647, 2649, 2650, 2651, 4022
ubiformat: warning!: 1 of 4038 eraseblocks contain non-ubifs data
ubiformat: warning!: only 0 of 4038 eraseblocks have valid erase counter
ubiformat: erase counter 0 will be used for all eraseblocks
ubiformat: note, arbitrary erase counter value may be specified using -e option
ubiformat: use erase counter 0 for all eraseblocks
ubiformat: flashing eraseblock 427 – 100 % complete
ubiformat: formatting eraseblock 4043 – 100 % complete