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

after you do the erase do a hex dump of the area and make sure it is really erased

hd -s8M -n1k

Ussually this happens when the format tries to set a bit that has already been set which means the erase didn’t really work.

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:

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

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

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!

-Albrecht

The source code (if included) is a zip file that’s placed in $QNX_TARGET/usr/src/archives/qnx. To install the source for a proprietary BSP, you must manually expand its directory structure from this archive.


server+ | project+ | linux+