I am facing similar problem. I am trying to program a S29GL512N flash device interfaced to a MPC8347 custom board. I use a CodeWarrior USB TAP rev.A with CodeWarrior v8.8 running on Windows XP SP3. The board contains two S29GL512N11 modules (2x64MB) connected to the LBC/GPCM. Only CS0 is connected to the flash modules. CS0 goes through some SN74LVC chip to select which device to boot from. First flash module is mapped to 0xF8000000-0xFBFFFFFF and second one to 0xFC000000-0xFFFFFFFF. The flash already contains a valid u-boot (0xFFF00000) and linux kernel (0xF8000000). I am trying to flash new u-boot and debug it.
With CW flash programmer, I can read the device (verify, checksum), but I can't write (program). I either face:
- "couldn't write flash driver to target, CCSProtocolPlugin: Error reading memory [SAP: corrupt read]" or
- "couldn't write flash driver to target, CCSProtocolPlugin: Error writing memory [Invalid handle]" or
- "target timed out"
When I uncheck "verify target writes", driver seems to be loaded correctly and status says "programming", but it never leaves this state (10 min). I get following log:
======================================================================
=== Execute: Program
=== Timestamp: Thu Feb 6 10:45:28 2014
=== Flash Device: S29GL512N
=== Flash Organization: 64Mx8x2
=== Flash Mem Start Addr: 0xF8000000
=== Flash Mem End Addr: 0xFFFFFFFF
======================================================================
Informing other connection clients that the target is being 'clobbered'.
Loading Flash Device Driver at: 0x00005000
Flash Driver Buffer is at: 0x00006DA0
Flash Driver Buffer Size is: 0x0000E260
Done
Initialization Command Succeeded
Programming 0x00010000 bytes of Target Memory at 0xFE300000
Program Command Cancelled
From CW flash programmer I select:
I use following target init file:
# setMMRBaseAddr 0xFF400000
writereg MBAR 0xFF400000
#################################
# Local Bus Local Access Windows
#################################
# WINDOW 1 - FLASH
writemem.l 0xff400028 0xF8000000 # LBLAWBAR1 - begining at 0xf8000000
writemem.l 0xff40002C 0x8000001A # LBLAWAR1 - enable, size = 128MB
# WINDOW 3 - u-boot stack
writemem.l 0xff400038 0xe4000000 # LBLAWBAR3 - begining at 0xe4000000
writemem.l 0xff40003c 0x80000011 # LBLAWAR3 - enable, size = 256KB
# SICRL
# LDP_A = LDP[0-3]
writemem.l 0xff400114 0x80000000
# SICRH
# TSOBI1 = 1 output buffer for 40 Ohms, 3.3V
writemem.l 0xff400118 0x00000002
# Enable Core in ACR
# COREDIS:0 cpu enabled,
# PIPE_DEP:000 1 transaction
# RPTCNT:000 1 transaction
# APARK:00 park to master
# PARKM:0000 e300 core
writemem.l 0xff400800 0x00000000
# machine check interrupts enable,
# floating-point enable,
# exception vectors at 0x0000_0000
writereg MSR 0x3000
# ACR - bits 10-11 should get a value different than '00'
# when the core is operating at below x2 of the system clock
ANDMem.l 0xff400800 0x00300000
# prevent debugger to build stack trace after reset
writereg SP 0x0F
I must be doing something wrong, question is what? When flash driver cannot be loaded in DDR, I assume either I am trying to load it to the wrong place, either the DDR has not been initialized correctly.
I read ANFlashProg.pdf and successfully recovered manufacturer and device ID with following script. Problem here is the flash base address I put in this script is wrong. I put 0xFF80 although the flash starts at 0xF800. I tried with the right address, but either I get "read error" or read 0xFFFF instead of 0x227E. Does anyone have an idea what is happening here? Do you know how I can successfully program my flash device?
# change p:
# Set device to Read state (reset?)
change p:FF800000 f0f0 16bit
# Get Mfg and Device ID values
change p:FF800AAA aaaa 16bit
change p:FF800554 5555 16bit
change p:FF800AAA 9090 16bit
# Display Mfg ID value at offset 0
# Display Dev ID value at offset 2
display p:FF800000..FF800004 16bit
# ff800000 $0001 $227e
# Reset device to Read state
change p:FF800000 f0f0 16bit