Writing to AT26 serial flash with SAM-BA

Microchip in-system programming solution: SAM-BA

Moderators: nferre, fab

User avatar
pingswept
Posts: 59
Joined: Mon Jul 19, 2010 8:47 pm

Writing to AT26 serial flash with SAM-BA

Fri Oct 08, 2010 7:55 pm

(This thread is a branch from an earlier thread forum/viewtopic.php/f,26/t,19615/ about compiling applets.)

Hi all,

I'm trying to write AT91Bootstrap into an SST25VF032B serial flash on a AT91SAM9G20 custom board with SAM-BA 2.9. I have added the JEDEC ID and correct page size (1 byte) to at26.c with this line:

Code: Select all

{"SST25VF032B", 0x004A25BF, 4 * 1024 * 1024,   1, 64 * 1024, AT26_BLOCK_ERASE_64K}
When I read data back from the chip, I get all 0xFFFFFFFF. I am inclined to believe that this is because the writing is failing, rather than the reading, as the chip appears to respond correctly to other commands.

In all the screenshots below:
  • SCK = yellow
  • SI = blue (9G20 to serial flash)
  • SO = purple (serial flash to 9G20)
Here's a scope shot of what happens when the 9G20 boots. It executes a 0x05 "read status" request and gets the proper 0x1C response from the chip. Then the 9G20 issues a high-speed-read request, followed by the address 0x000000, a dummy byte, and a long series of clock pulses to crank out the data. As you can see in the zoomed-out top window, the SO line stays high after the status response. Given that the status response is reasonable, I'm inclined to believe that the chip is really empty.

Image

So then the question is: why is writing to the chip failing?

(Tim, you were right that I was still using the wrong version of AT91Bootstrap. But that shouldn't matter, at least for testing writing, right? Obviously, it will matter when I'm trying to load U-boot and so on.)

I've gone through the AT26 initialization and write process fairly carefully. SAM-BA correctly retrieves the JEDEC ID, as you can see below.

Image

When I use SAM-BA's "send file" command, I can see the 9G20 write-enable the chip and issue a 64-KB block erase command. It then polls the chip while waiting for the erase to complete. My scope's memory can't hold the whole data stream, but if I take a snap shot early on in the transfer, I can see data getting sent.

For example, here's a shot of data being transmitted. The first clump is the write-enable. The large clump starts with the command 0x02, byte-program. The address is 0x000D13, and the data byte is 0xE5. The last clump is a status request and response. When I look at location 0x000D13 in my binary, I see 0xE5.

Image

At this point, I'm somewhat baffled. I suspect that I'm missing something, but I don't know what. Suggestions of debugging strategies or workarounds are welcome. (I'm ordering some Macronix chips today as an alternate path.)
Brandon Stafford
Rascal Micro
falingtrea
Location: Mounds View, MN
Posts: 209
Joined: Wed Jan 09, 2008 5:09 pm

Re: Writing to AT26 serial flash with SAM-BA

Tue Oct 12, 2010 10:12 pm

I don't know if this makes much difference, but i am using Samba 1.10 version.

The other thing to check is the max clock speed of the part you are using. These flash memory parts have a 2x read capability, so if you have -50 parts the max write is only 25 MHz and the max read is 66 MHz. The -80 parts are 33MHz write amd 80 MHz read. The -50 parts I have will read (including JEDEC ID) at 44 mHz but will not write. I have not tested them at 33 MHz yet to see if they will write.
Tim Barr
Multitech Inc.
User avatar
pingswept
Posts: 59
Joined: Mon Jul 19, 2010 8:47 pm

Re: Writing to AT26 serial flash with SAM-BA

Tue Oct 12, 2010 11:03 pm

Hi Tim,

Thanks for the suggestions. I'll try SAM-BA 2.10 and see if that works differently. (I'm assuming you meant 2.10, not 1.10.)

I think the clock speed is probably not at fault-- SCLK is running around 1 MHZ, and I believe the parts are rated at either 50 or 85 MHz.

My best guess is that the problem is with the chip select. I'll have to investigate that further. (See my other recent post (forum/viewtopic.php/f,9/t,19628/) in the SAM9 forum for the details.)

I appreciate the ideas,
Brandon
Brandon Stafford
Rascal Micro
falingtrea
Location: Mounds View, MN
Posts: 209
Joined: Wed Jan 09, 2008 5:09 pm

Re: Writing to AT26 serial flash with SAM-BA

Wed Oct 13, 2010 8:13 pm

Heheh, I just ran into a similar problem with the SST25VF080B and Linux. It has to do with the write protect bits. The SST parts power up with the protect bits set. So you can't do writes or erases from power up. The Linux MTD driver clears the write protect bits only for Atmel parts, so I was not able to write or erase the SST parts. I checked SAM-BA v2.10 and the code does try to clear the protect bits before an erase or a write. So that explains why I could write to the part in SAM-BA but not Linux. Also, the #WP pin only locks the user from changing the state of the write protect bits. It does not disable write protect completely.
Tim Barr
Multitech Inc.

Return to “SAM-BA”

Who is online

Users browsing this forum: No registered users and 1 guest