Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - NOR flash driver doesn't recognize partition: (8 Items)
   
NOR flash driver doesn't recognize partition  
Hello,

I am writing a FFS3 NOR flash driver for an i.MX31 based board. The device is a Spansion S71WS128PC0HF3 burst-mode NOR 
Flash (16MB, 16 bit bus width) connected to CS5 of the WEIM. I can boot the system from this flash and I created an EFS 
and burnt it into the flash via JTAG debugger. I wrote a small test program that simply maps in the base address and 
scans for the 'QSSL' signature of the partition - it finds it at the correct address. However, when I run my flash 
driver it doesn't recognise it.

The auto-detect of the device works ((devf  t1::f3s_flash_probe:248) chip total = 1, bus_width = 2, interleave = 1)
Erasing via flashctl works. 
flashctl -p/dev/fs0 -o8M -l8M -e -v
Erasing device /dev/fs0
................................................................
(devf  t2::f3s_table_find:66) fs0p0 raw U: 80
# 
Formatting fails, though:
# flashctl -p/dev/fs0p0 -o8M -l8M -f -v
Formatting device /dev/fs0p0
amd_poll: 163 program error
(devf  t2::amd_v2wordwrite:113) over poll waiting for write completion
(devf  t2::f3s_ext_write:197) fs0p0 bad H[00] P[40] # 000010
DCMD_F3S_FORMAT failed (errno 5)
flashctl: format failed

I tried various write() functions of the MTD library but always the same. Maybe the writing works but reading doesn't? I
 supply NULL for the v2read callout, so it should use memcpy(), which works, as seen from my test program.

Any ideas greatly appriciated. Thank you.

-Albrecht
Re: NOR flash driver doesn't recognize partition  
I partially solved the problem. The erase did work, the problem was that the standard v2 read function uses memcpy to 
transfer the data, which does 32 bit accesses. This board doesn't seem to like that, or the interface/the flash chip 
must be configured in some way, I don't know, anyhow I wrote my own v2read callout and supplied a 16 bit memcpy function
. Now I can read from the device, It recognizes the partition (I constructed an EFS with system builder and burnt it to 
flash with Lauterbach debugger), I can run programs from the partition.

However, I am still unable to write anything to the device. I use the v2write callout f3s_aCFI_v2write, which seems to 
be the one for all modern chips (is this one??), but I always get this error message: 

[code]
amd_poll: 163 program error
(devf  t2::f3s_aCFI_v2write:233) over poll waiting for write completion
[/code]

It seems that it is trying to read back the writtten value, which doesn't succeed. readmem, as I understand, is a 
function pointer assigned at startup, so it should call my own 16bit v2read function, or not??

Any ideas appriciated, thank you.

Regards,
Albrecht
RE: NOR flash driver doesn't recognize partition  
Gunter,

Could you please start the driver with three v options (-vvv) and post
the output from the startup?   Readmem() is a function pointer that gets
assigned to a 8-bit, 16-bit, 32-bit routine, based on the buswidth
detected by the probe code.  Running with -vvv will output this buswidth
and interleave.

> -----Original Message-----
> From: Gunter Geigemueller [mailto:community-noreply@qnx.com] 
> Sent: May 25, 2009 4:14 AM
> To: general-filesystems
> Subject: Re: NOR flash driver doesn't recognize partition
> 
> I partially solved the problem. The erase did work, the 
> problem was that the standard v2 read function uses memcpy to 
> transfer the data, which does 32 bit accesses. This board 
> doesn't seem to like that, or the interface/the flash chip 
> must be configured in some way, I don't know, anyhow I wrote 
> my own v2read callout and supplied a 16 bit memcpy function. 
> Now I can read from the device, It recognizes the partition 
> (I constructed an EFS with system builder and burnt it to 
> flash with Lauterbach debugger), I can run programs from the 
> partition.
> 
> However, I am still unable to write anything to the device. I 
> use the v2write callout f3s_aCFI_v2write, which seems to be 
> the one for all modern chips (is this one??), but I always 
> get this error message: 
> 
> [code]
> amd_poll: 163 program error
> (devf  t2::f3s_aCFI_v2write:233) over poll waiting for write 
> completion [/code]
> 
> It seems that it is trying to read back the writtten value, 
> which doesn't succeed. readmem, as I understand, is a 
> function pointer assigned at startup, so it should call my 
> own 16bit v2read function, or not??
> 
> Any ideas appriciated, thank you.
> 
> Regards,
> Albrecht
> 
> 
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post29922
> 
> 
Re: RE: NOR flash driver doesn't recognize partition  
Here is the output:

# devf-iprc -vvv
Flash Development Library - HEAD
Build: Oct 20 2008 21:16:02
MTD Build: Jun  5 2009, 14:29:46
SAM Electronics IPRC QNX 6.4.0 NOR Flash Driver v1.1.0
Copyright (C) 2009 BitCtrl Systems GmbH All rights reserved.
# devf: Mapped device memory: Phys=A0000000, Virt=28000000, size=0x01000000
(devf  t1::f3s_skt_attach:109) fs0 socket SAM IPRC NOR Flash

(devf  t1::f3s_flash_probe:97) trying device width = 4

(devf  t1::f3s_flash_probe:108) bus width  = 8, interleave = 2
(devf  t1::f3s_flash_probe:108) bus width  = 4, interleave = 1

(devf  t1::f3s_flash_probe:97) trying device width = 2

(devf  t1::f3s_flash_probe:108) bus width  = 8, interleave = 4
(devf  t1::f3s_flash_probe:108) bus width  = 4, interleave = 2
(devf  t1::f3s_flash_probe:108) bus width  = 2, interleave = 1
(devf  t1::f3s_flash_probe:248) chip total = 1, bus_width = 2, interleave = 1
(devf  t1::f3s_skt_attach:135) fs0 array CFI_MirrorBit_Workaround U: 80 S: 020000
(devf  t1::f3s_table_find:66) fs0p0 raw U: 80

I believe it is correct, one 16-bit device. Usually, since this is a custom board, I have a hard-coded line

set_flash_config( 2, 1 );

in the open routine, but during my trials to get it working I commented it out to see if the auto-detect woks - it does,
 I think.

Is it possible that this particular device 

Spasion S71WS128PC0HF3 burst-mode NOR Flash (16MB)

requires a custom write-routine? I know that such devices exist.

Thank you for your help.

-Albrecht
Re: RE: NOR flash driver doesn't recognize partition  
I made a big step forward, but still not working 100% correct.

The v2write routine was named v2write_ads, and I linked against v2write only. So only now I am using the v2write routine
 that was supplied with the BSP for the ADS board.

It appears that some data can be written but when I write larger files I get the following error messages:

(devf  t4::f3s_aCFI_v2write_iprc:313) program verify error
between  0x2897f768 and 0x2897f76c
memory = 0x2897f76a, offset =  0x97f768, left = 0, size = 4, bus_width = 2
(devf  t4::f3s_aCFI_v2write_iprc:313) program verify error
between  0x28944168 and 0x289441a8
memory = 0x289441a6, offset =  0x9441a8, left = 0, size = 64, bus_width = 2
amd_poll: 163 program error
(devf  t4::f3s_aCFI_v2write_iprc:271) over poll waiting for write completion
amd_poll: 163 program error
(devf  t4::f3s_aCFI_v2write_iprc:173) over poll waiting for write completion
(devf  t4::f3s_aCFI_v2write_iprc:313) program verify error
between  0x2897f624 and 0x2897f628
memory = 0x2897f626, offset =  0x97f624, left = 0, size = 4, bus_width = 2
(devf  t4::f3s_aCFI_v2write_iprc:313) program verify error
between  0x2894aa28 and 0x2894aa68
memory = 0x2894aa66, offset =  0x94aa68, left = 0, size = 64, bus_width = 2
amd_poll: 163 program error
(devf  t4::f3s_aCFI_v2write_iprc:271) over poll waiting for write completion
(devf  t4::f3s_aCFI_v2write_iprc:313) program verify error
between  0x289484e8 and 0x28948528
memory = 0x28948526, offset =  0x948528, left = 0, size = 64, bus_width = 2
(devf  t4::f3s_aCFI_v2write_iprc:313) program verify error
between  0x2897fd40 and 0x2897fd44
memory = 0x2897fd42, offset =  0x97fd40, left = 0, size = 4, bus_width = 2
(devf  t4::f3s_aCFI_v2write_iprc:313) program verify error
between  0x28947168 and 0x289471a8
memory = 0x289471a6, offset =  0x9471a8, left = 0, size = 64, bus_width = 2
(devf  t4::f3s_extptr_delete:288) fs0p1 sticky H[15] L[3C] P[4B]


Any suggestions? Many thanks!
Re: RE: NOR flash driver doesn't recognize partition  
Thanks for all the comments. Sorry having bothered you, it turned out to be a hardware problem on the customer's board. 
We initially overcame it by having the usual nanospin(6000) delays in the various CFI-routines replaced with 
nanospin(20000), and now we have a redesigned hardware that works with the standard settings.

Regards,
Albrecht
Re: NOR flash driver doesn't recognize partition  
> Hello,
> 
> I am writing a FFS3 NOR flash driver for an i.MX31 based board. The device is 
> a Spansion S71WS128PC0HF3 burst-mode NOR Flash (16MB, 16 bit bus width) 
> connected to CS5 of the WEIM. I can boot the system from this flash and I 
> created an EFS and burnt it into the flash via JTAG debugger. I wrote a small 
> test program that simply maps in the base address and scans for the 'QSSL' 
> signature of the partition - it finds it at the correct address. However, when
>  I run my flash driver it doesn't recognise it.
> 
> The auto-detect of the device works ((devf  t1::f3s_flash_probe:248) chip 
> total = 1, bus_width = 2, interleave = 1)
> Erasing via flashctl works. 
> flashctl -p/dev/fs0 -o8M -l8M -e -v
> Erasing device /dev/fs0
> ................................................................
> (devf  t2::f3s_table_find:66) fs0p0 raw U: 80
> # 
> Formatting fails, though:
> # flashctl -p/dev/fs0p0 -o8M -l8M -f -v
> Formatting device /dev/fs0p0
> amd_poll: 163 program error
> (devf  t2::amd_v2wordwrite:113) over poll waiting for write completion
> (devf  t2::f3s_ext_write:197) fs0p0 bad H[00] P[40] # 000010
> DCMD_F3S_FORMAT failed (errno 5)
> flashctl: format failed
> 
> I tried various write() functions of the MTD library but always the same. 
> Maybe the writing works but reading doesn't? I supply NULL for the v2read 
> callout, so it should use memcpy(), which works, as seen from my test program.
> 
> 
> Any ideas greatly appriciated. Thank you.
> 
> -Albrecht

hello , Gunter Geigemueller 
      I met the same problem just the same as you.I can erase my flash use flashctl but can't format it, how did you fix
 it? Thank you very much.

 Formatting device /dev/fs0p0
amd_poll: 163 program error
(devf  t2::amd_v2wordwrite:113) over poll waiting for write completion
(devf  t2::f3s_ext_write:197) fs0p0 bad H[00] P[40] # 000010
DCMD_F3S_FORMAT failed (errno 5)
 flashctl: format failed


Re: NOR flash driver doesn't recognize partition  
Hello Daniel Lee,
I have the same problem. When I try to formate the flash the same error occur. Do you have any solution?

Thank you!
Kevin