nand flash problem on the SAMA5D3 xplained board

For SAMA5D2 Xplained, SAMA5D3 Xplained and SAMA5D4 Xplained

Moderator: nferre

jupiterwang
Posts: 3
Joined: Fri Jun 17, 2016 4:05 am

nand flash problem on the SAMA5D3 xplained board

Wed Jun 22, 2016 11:34 am

we have sama5d3 cpu, the nand flash is K9F4G08U0E, according to the "linux4sam/bin/view/Linux4SAM/Sama5d3XplainedMainPage" compile the bootstrap, uboot, linux, ubi rootfs, and it can work; but when we produce about 100 pieces board, abount 10%-20% board encounter the nand flash problem, here is the log message:


RomBOOT


AT91Bootstrap 3.8-alpha7 (2015?1′ 11??? 17?—¥ ???????o? 16:17:44 CST)

1-Wire: Loading 1-Wire information ...
1-Wire: ROM Searching ... Done, 0x0 1-Wire chips found

WARNING: 1-Wire: No 1-Wire chip found

1-Wire: Using default information

1-Wire: SYS_GPBR2: 0x481242a, SYS_GPBR3: 0x6a0823

NAND: ONFI not supported
NAND: Manufacturer ID: 0xec Chip ID: 0xdc
NAND: Disable On-Die ECC
Nand flash is not ONFI compliant, use 2-bit/512-byte ecc.
NAND: Initialize PMECC params, cap: 0x4, sector: 0x200
NAND: Image: Copy 0x80000 bytes from 0x40000 to 0x26f00000
NAND: Done to load image


U-Boot 2015.01-linux4sam_5.0-alpha7-dirty (Mar 21 2016 - 10:51:26)

CPU: SAMA5D31
Crystal frequency: 12 MHz
CPU clock : 528 MHz
Master clock : 132 MHz
I2C: ready
DRAM: 256 MiB
NAND: NAND chip is not ONFI compliant, assume ecc_bits is 2 in 512 bytes512 MiB
MMC: mci: 0
In: serial
Out: serial
Err: serial
address 0x58, Found invalid MAC address: 0:0:0:0:0:0
address 0x59, Found invalid MAC address: 0:0:0:0:0:0
Net: MII devices:
MII devices: 'macb0'
Current device: 'macb0'
miiphy_register: non unique device name 'macb0'
macb0
Error: macb0 address not set.
, macb0
Error: macb0 address not set.

Hit any key to stop autoboot: 0

NAND read: device 0 offset 0x180000, size 0x80000
524288 bytes read: OK

NAND read: device 0 offset 0x200000, size 0x600000
6291456 bytes read: OK
Kernel image @ 0x22000000 [ 0x000000 - 0x396190 ]
## Flattened Device Tree blob at 21000000
Booting using the fdt blob at 0x21000000
Loading Device Tree to 2fb31000, end 2fb3c430 ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 3.18.0-linux4sam_5.0-alpha7-00007-g8cef8bf-dirty (root@wws-ubuntu) (gcc version 4.7.4 (Ubuntu/Linaro 4.7.4-2ubuntu1) ) #225 Fri Apr 8 15:13:10 CST 2016
CPU: ARMv7 Processor [410fc051] revision 1 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache

device tree list:
[ 'atmel,sama5d31ek' 'atmel,sama5d3xmb' 'atmel,sama5d3xcm' 'atmel,sama5d31' 'atmel,sama5d3' 'atmel,sama5' ]

Machine model: Atmel SAMA5D31-EK
cma: Reserved 16 MiB at 0x2e800000
Memory policy: Data cache writeback
AT91: Detected soc type: sama5d3
AT91: Detected soc subtype: sama5d31
CPU: All CPU(s) started in SVC mode.
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
Kernel command line: console=ttyS0,115200 earlyprintk mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro,256K(env),256k(evn_redundent),256k(spare),512k(dtb),6M(kernel)ro,-(rootfs) rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs rw video=LVDS-1:800x600-16
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 235940K/262144K available (4938K kernel code, 229K rwdata, 1776K rodata, 204K init, 170K bss, 26204K reserved)
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xffe00000 (2048 kB)
vmalloc : 0xd0800000 - 0xff000000 ( 744 MB)
lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc0696ab8 (6715 kB)
.init : 0xc0697000 - 0xc06ca000 ( 204 kB)
.data : 0xc06ca000 - 0xc0703508 ( 230 kB)
.bss : 0xc0703508 - 0xc072def8 ( 171 kB)
NR_IRQS:16 nr_irqs:16 16
sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 21474836480000000ns
Console: colour dummy device 80x30
Calibrating delay loop... 351.43 BogoMIPS (lpj=1757184)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x204ae688 - 0x204ae6e0
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 2 part 30 variant 5 rev 1
pinctrl core: initialized pinctrl subsystem
regulator-dummy: no parameters
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor ladder
cpuidle: using governor menu
gpio-at91 fffff200.gpio: at address fefff200
gpio-at91 fffff400.gpio: at address fefff400
gpio-at91 fffff600.gpio: at address fefff600
gpio-at91 fffff800.gpio: at address fefff800
gpio-at91 fffffa00.gpio: at address fefffa00
pinctrl-at91 ahb:apb:pinctrl@fffff200: initialized AT91 pinctrl driver
drivers/pinctrl/pinctrl-at91.c->1406: +++++ power on lcd +++++
at_hdmac ffffe600.dma-controller: Atmel AHB DMA Controller ( cpy slave sg-cpy ), 8 channels
at_hdmac ffffe800.dma-controller: Atmel AHB DMA Controller ( cpy slave sg-cpy ), 8 channels
backlight-power-supply: 5000 mV
panel-power-supply: 3300 mV
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
at91_i2c f0014000.i2c: using dma0chan0 (tx) and dma0chan1 (rx) for DMA transfers
at91_i2c f0014000.i2c: AT91 i2c bus driver (hw version: 0x402).
Linux video capture interface: v2.00
Advanced Linux Sound Architecture Driver Initialized.
cfg80211: Calling CRDA to update world regulatory domain
Switched to clocksource tcb_clksrc
NET: Registered protocol family 2
TCP established hash table entries: 2048 (order: 1, 8192 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP: reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
futex hash table entries: 256 (order: -1, 3072 bytes)
msgmni has been set to 492
io scheduler noop registered (default)
platform backlight: Driver pwm-backlight requests probe deferral
atmel_usart f001c000.serial: ttyS1 at MMIO 0xf001c000 (irq = 28, base_baud = 4125000) is a ATMEL_SERIAL
atmel_usart f0020000.serial: ttyS2 at MMIO 0xf0020000 (irq = 29, base_baud = 4125000) is a ATMEL_SERIAL
atmel_usart f8024000.serial: ttyS4 at MMIO 0xf8024000 (irq = 31, base_baud = 4125000) is a ATMEL_SERIAL
atmel_usart ffffee00.serial: ttyS0 at MMIO 0xffffee00 (irq = 37, base_baud = 8250000) is a ATMEL_SERIAL
console [ttyS0] enabled
[drm] Initialized drm 1.1.0 20060810

=== drivers/gpu/drm/panel/panel-simple.c->panel_simple_platform_probe():
of_node: name=panel, type=<NULL>, full_name=/panel
id: name=, type=, compatible=atmel,12ts

platform panel: Driver panel-simple requests probe deferral
brd: module loaded
loop: module loaded
***** atmel_hlcdc.c: atmel_hlcdc_probe(): irq=44
device: name=(null)
platform_device: name=atmel-hlcdc-dc, id=-1, resources=0
platform atmel-hlcdc-dc: Driver atmel-hlcdc-display-controller requests probe deferral
atmel_nand_nfc 70000000.nfc: NFC is probed.
atmel_nand 60000000.nand: Use On Flash BBT
atmel_nand 60000000.nand: Using dma0chan2 for DMA transfers.
nand: device found, Manufacturer ID: 0xec, Chip ID: 0xdc
nand: Samsung NAND 512MiB 3,3V 8-bit
nand: 512MiB, SLC, page size: 2048, OOB size: 64
atmel_nand 60000000.nand: can't detect min. ECC, assume 2 bits in 512 bytes
atmel_nand 60000000.nand: Initialize PMECC params, cap: 4, sector: 512
atmel_nand 60000000.nand: Using NFC Sram read
Bad block table found at page 262016, version 0x01
Bad block table found at page 261952, version 0x01
nand_read_bbt: bad block at 0x000000000000
nand_read_bbt: bad block at 0x000000020000
nand_read_bbt: bad block at 0x000000060000
nand_read_bbt: bad block at 0x000000080000
nand_read_bbt: bad block at 0x0000000a0000
nand_read_bbt: bad block at 0x0000000e0000
nand_read_bbt: bad block at 0x000000100000
nand_read_bbt: bad block at 0x000000120000
nand_read_bbt: bad block at 0x000000160000
nand_read_bbt: bad block at 0x000000180000
nand_read_bbt: bad block at 0x0000001a0000
nand_read_bbt: bad block at 0x0000001e0000
nand_read_bbt: bad block at 0x000000200000
..........................................................
.........................................................
nand_read_bbt: bad block at 0x00001ffe0000
8 cmdlinepart partitions found on MTD device atmel_nand
Creating 8 MTD partitions on "atmel_nand":
0x000000000000-0x000000040000 : "bootstrap"
0x000000040000-0x0000000c0000 : "uboot"
0x0000000c0000-0x000000100000 : "env"
0x000000100000-0x000000140000 : "evn_redundent"
0x000000140000-0x000000180000 : "spare"
0x000000180000-0x000000200000 : "dtb"
0x000000200000-0x000000800000 : "kernel"
0x000000800000-0x000020000000 : "rootfs"


sometimes the log message is like that:

atmel_nand_nfc 70000000.nfc: NFC is probed.
atmel_nand 60000000.nand: Use On Flash BBT
atmel_nand 60000000.nand: Using dma0chan2 for DMA transfers.
nand: device found, Manufacturer ID: 0xec, Chip ID: 0xdc
nand: Samsung NAND 512MiB 3,3V 8-bit
nand: 512MiB, SLC, page size: 2048, OOB size: 64
atmel_nand 60000000.nand: Using NFC Sram read
Bad block table not found for chip 0
Bad block table not found for chip 0
Scanning device for bad blocks
Bad eraseblock 0 at 0x000000000000
Bad eraseblock 1 at 0x000000020000
Bad eraseblock 2 at 0x000000040000
Bad eraseblock 3 at 0x000000060000
Bad eraseblock 4 at 0x000000080000
Bad eraseblock 5 at 0x0000000a0000
Bad eraseblock 6 at 0x0000000c0000
Bad eraseblock 7 at 0x0000000e0000
Bad eraseblock 8 at 0x000000100000
Bad eraseblock 9 at 0x000000120000
........................................................
........................................................
Bad eraseblock 4093 at 0x00001ffa0000
Bad eraseblock 4094 at 0x00001ffc0000
Bad eraseblock 4095 at 0x00001ffe0000
No space left to write bad block table


they say that the nand flash is almost bad, i think it is impossible, bu i don't where is the problem. does anyone encounter similar problem before ?
dlad
Posts: 20
Joined: Mon Jul 27, 2015 4:27 pm

Re: nand flash problem on the SAMA5D3 xplained board

Wed Jun 22, 2016 3:42 pm

Hello,
If you have this problem only on some of your custom boards and others are fine. it is likely hardware related.
Did you check using an oscilloscope all your signals between sama5 and nandflash ?
Maybe some pads are not solder properly.

By the way, you should change your topic name, your board is not a Xplained board but a custom one.

Best regards
jupiterwang
Posts: 3
Joined: Fri Jun 17, 2016 4:05 am

Re: nand flash problem on the SAMA5D3 xplained board

Fri Jun 24, 2016 5:07 am

thanks for dlad's answer;
the linux version is 3.18.0; on almost "bad" block board, when execute the "nand erase" or "nand scrub" command under uboot command prompt, they don't list any nand flash bad block information; bootstrap, uboot, linux can boot normally, the problem is when linux driver scan nand flash to create bbt or check bbt, it says the flash is almost bad from address 0!
if it is hardware related , the bootstrap and uboot can boot ?
i don't know the problem is hardware related or nand flash driver related, by the way, the samsung nand flash K9F4G08U0E doesn't support ONFI, and 1 ECC Bit in 512 byte
blue_z
Location: USA
Posts: 1504
Joined: Thu Apr 19, 2007 10:15 pm

Re: nand flash problem on the SAMA5D3 xplained board

Fri Jun 24, 2016 8:58 pm

IMO you have at least two issues to resolve.
First, why do 10-20% of the boards have a NAND issue, and the rest do not? Have you analyzed chip date or lot codes?
Are these boards all 100% identical?
I can come up with a simple (and probable) explanation for the bad block messages, but that means that the boards are not 100% SW identical.

Second, why do some "bad" boards have a NAND chip that has no bad-block table, while your first log indicates there is a BBT?

Have all boards been treated identically, or were some guinea pigs for various procedures?

What changes, if any, have you made to the kernel source code to accommodate your NAND flash chip?
What value is used in the NAND header?
You mention "1 ECC bit in 512 byte". That's not in the datasheet; is that stated in the qualification report?
jupiterwang wrote:when execute the "nand erase" or "nand scrub" command under uboot command prompt...
Using `nand scrub ...` is simply shooting yourself in the foot. That will erase the BBT installed by the factory.
jupiterwang
Posts: 3
Joined: Fri Jun 17, 2016 4:05 am

Re: nand flash problem on the SAMA5D3 xplained board

Tue Jun 28, 2016 7:08 am

yes, all these boards are identical; we donwload bootstrap, uboot, dtb, linux, ubi rootfs to all these boards with sam-ba(version 2.16); for the almost "bad" flash board, first time boot, linux says "bad eraseblock at ...." error, after reboot, linux says "nand_read_bbt: bad block at ......" error, i think these two kinds of error are the same reason; firstly boot-->create bbt("bad eraseblock") --> second boot -->check bbt("nand_read_bbt");

"1 ECC bit in 512 byte" is from the samsung nand flash K9F4G08 specification, not from the atmel sama5d3 cpu datasheet;

according to the "1 ECC bit in 512 byte", in the sama5d3xcm.dtsi file, i try to change the "atmel,pmecc-cap = <4>;" to "atmel,pmecc-cap = <1>;" like this:
nand-bus-width = <8>;
nand-ecc-mode = "hw";
atmel,has-pmecc;
atmel,pmecc-cap = <1>;
atmel,pmecc-sector-size = <512>;
nand-on-flash-bbt;
status = "okay";

but it doesn't work;

i don't change the NAND Header value, maybe use the default value, so how can i see and change the Nand flash header ?
blue_z
Location: USA
Posts: 1504
Joined: Thu Apr 19, 2007 10:15 pm

Re: nand flash problem on the SAMA5D3 xplained board

Wed Jun 29, 2016 12:32 am

jupiterwang wrote:"1 ECC bit in 512 byte" is from the samsung nand flash K9F4G08 specification, ...
Is the "specification" available online?
jupiterwang wrote:... not from the atmel sama5d3 cpu datasheet;
I'm not that stupid to look for that detail in the Atmel datasheet.
The datasheet I was referring to was the Samsung Flash Memory K9F4G08U0E/K9K8G08U1E/K9K8G08U0E/K9WAG08U1E datasheet, Revision 1.2, Jun 2013. There's no document number.
This 51-page Samsung datasheet only mentions:
- ECC Requirement : Please refer to the qualification report
realbright
Posts: 10
Joined: Mon Jul 07, 2014 2:36 am

Re: nand flash problem on the SAMA5D3 xplained board

Thu Sep 01, 2016 8:46 am

by the way, Is it okay does not create BBT partition at the end of NAND flash??
Dose MTD preserve BBT area internally?
CarloTruax
Posts: 1
Joined: Thu Sep 15, 2016 8:32 pm

Re: nand flash problem on the SAMA5D3 xplained board

Mon Sep 19, 2016 7:19 pm

Hi..i am a new user here. As per my knowledge the linux version is 3.18.0; on almost "bad" block board, when execute the "nand erase" or "nand scrub" command under uboot command prompt, they don't list any nand flash bad block information; bootstrap, uboot, linux can boot normally, the problem is when linux driver scan nand flash to create bbt or check bbt, it says the flash is almost bad from address 0!if it is hardware related , the bootstrap and uboot can boot ?i don't know the problem is hardware related or nand flash driver related, by the way, the samsung nand flash K9F4G08U0E doesn't support ONFI, and 1 ECC Bit in 512 byte.

china pcb assembly

Return to “SAMA5 Xplained”

Who is online

Users browsing this forum: No registered users and 1 guest