AP7000 flash write/erase problems

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I have a design with AP7000 and AT48BV640D flash and it works quite well except for some problems with erase and program in the flash.

Using the JTAGICE mkII I'm able to erase and program it in full, including Linux filesystem (jffs2). It works most of the time with the mkII, but ocasionally I get some errors and have to do the process all over again.

After writting with the jtag, u-boot can't program the flash with saveenv, it fails most often. Only once I was able to get it right. The same happens with Linux. I'm unable to write to the flash from linux. Reading never fails, since I'm able to load u-boot and the full linux system without problems.

I wonder if there is any hints on what I should look for. What are the critical points in connecting the flash to the AP7000?

My prototype had an error connecting OE and CE, they were swapped, so we cut those tracks on the PCB and corrected them with 2 wire-ups. I'm a bit apreensive in making new boards without being sure that correcting only those tracks on the board will solve those problems. The wires length is roughly the same as the tracks on the board were.

I've sent a message to the Atmel flash memory support a few days ago, but no response so far.

Any help is appreciated. Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have you double checked your schematic with the application note for schematic checklist and AP700X?

Is your timing adjusted to match your system setup?

Hans-Christian

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, the schematic seems fine looking at the app note from AP7000. The memory have no further advices (such as additional pull ups or pull downs required).

I belive that if it was the case of a wrong line, it would not work with the JTAGICE mkII at all.

U-Boot don't have any timings to configure as far as I can tell, the linux kernel does, but I'm unsure what values are supposed to get there. I'm using NGW's values (AT49BV642D).

Isn't the kernel and u-boot supposed to get that from CFI?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No, IIRC both U-Boot and the Linux kernel needs timing info for the flash.

One note is that I think the AT49BV640D needs a fixup in the kernel, try googling for the part name and you should find a patch for me fixing it. I was under the intention that it was added some time ago.

Hans-Christian

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah, you sent me a link to my message on the linux kernel mailing list and your fix seems to be there. At least for kernel 2.6.29.

I did have to enable that CFI command set module though. Without that, it wouldn't even mount the rootfs.

Could you direct me to where I should configure the flash timings in the u-boot?
atngw100 doesn't have flash.c anymore it uses the generic CFI driver, stk1000 still does, but it looks like that driver has no timings at all, it just writes the commands and waits for response.

Or perhaps I'm missing something. :(

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Look for stuff which alters the SMC, the SMC (Static Memory Controller) handles the timing on the external bus interface (EBI).

I'm at home, and do not recall from the back of my head.

Hans-Christian

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I really think there is no such thing in u-boot. I've looked up everywhere, and the only reference I could find was some defines that are not used (I grep'ed all the source).
I guess u-boot just takes the default settings, that should work somehow, otherwise, how would the CPU be able to load u-boot in the first place?

I've found that the board was mounted with AT48BV640DT, which has the last sectors with 4k instead of 32k. But that should only affect the u-boot environment, not the rest of the use cases. :(

If I boot from the SDCard, then mount the mtdblock1, trying to write to the flash gives me the following errors in /var/log/messages:

Quote:

Dec 31 23:02:19 localhost user.warn kernel: Erase at 0x00020000 failed immediately: -EROFS. Is the sector locked?
Dec 31 23:02:19 localhost user.warn kernel: Erase at 0x00010000 failed immediately: -EROFS. Is the sector locked?
Dec 31 23:02:19 localhost user.warn kernel: Erase at 0x00000000 failed immediately: -EROFS. Is the sector locked?
Dec 31 23:02:19 localhost user.warn kernel: Erase at 0x007c0000 failed immediately: -EROFS. Is the sector locked?

But it really is mounted rw, not ro.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok. I found a SMC setup at the cpu/at32ap/cpu.c. But it's very unfrendly. I simply can't add my board setup without messing with all other boards.

Anyway, that doesn't matter right now, I need to get this working first. And to do that, I can't figure out how to correlate NWE_PULSE, NWE_SETUP, and friends found in the AP7000 datasheet with Tas, Tah, etc found in the flash datasheet.

The documentation is very hard to understand when the nomenclatures doesn't match. I'm completely lost.

I do know is that, all the read times are the same for both memories (AT49BV640D and AT49BV642D) for the "Word Load Waveforms" - God help me that this means "Write the darn thing" - The only difference is:

     AT49BV640D       AT49BV642D
tas  20               0
tah  0                25

And I don't know where to make those changes :(