Spark Logic

SST26VF064B Library… help?

rexnanet Thu Aug 25, 2016 9:11 am

Hi,

Has anyone managed to get the SST26VF064B flash to work on the STM32duino?
I’ve managed to get it detected and the reading part seems to be OK (SPI bus is OK and I can read the ID correctly) but I can’t write on it…

The results from running the test code from SerialFlash library:
Raw SerialFlash Hardware Test

Read Chip Identification:
JEDEC ID: BF 26 43
Part Nummber: SST26VF064
Memory Size: 1048576 bytes
Block Size: 65536 bytes
0x05 = 0
0x35 = A
0x72 = 0
0x42 = FF

Reading Chip...
Reading...
addr = 0, data = FF FF FF FF FF FF FF FF
addr = FF8, data = FF FF FF FF FF FF FF FF
addr = 1000, data = FF FF FF FF FF FF FF FF
(....)
addr = FFFF8, data = FF FF FF FF FF FF FF FF

Writing 512 signatures
error writing signature at 0
Read this: FF FF FF FF FF FF FF FF
Expected: 00 00 00 00 15 F5 95 4B

Tests Failed :{

The flash chip may be left in an improper state.
You might need to power cycle to return to normal.

Replies

ahull Thu Aug 25, 2016 10:40 am

According to the datasheet.

The WP# is used in conjunction with the WPEN and IOC bits in the Configuration register to prohibit write operations
to the Block-Protection register. This pin only works in SPI, single-bit and dual-bit Read mode

So it looks like you need to re-read chapter 4 of the datasheet “4.1 Device Protection.” .. and TABLE 4-1: WRITE PROTECTION LOCK-DOWN STATES

:D Unfortunately I don’t have the device to play with, so that is about as much as I can say on the subject.

rexnanet Fri Aug 26, 2016 10:16 am

That was the first thing I did :) But seems I need to re-read 4 or 5 more times :)
But even with WPEN and IOC disabled doesn’t seem to have effect.

I’m trying to copy the code from the microchip example to see if I can get better results.
I’ve tried to erase the full chip but don’t know if it worked correctly because I now read all zeroes…

Stay tuned for the next episode of “Flash wars” :D

ahull Fri Aug 26, 2016 2:26 pm

rexnanet wrote:Stay tuned for the next episode of “Flash wars” :D

ahull Sat Aug 27, 2016 9:24 am

I’m still waiting for the next thrilling episode. :D

Image

rexnanet Sun Aug 28, 2016 4:48 pm

@ahull
Wait no more!!! :D
Here it is:

Raw SerialFlash Hardware Test
Setup configuration register
GlobalBlockProtectionUnlock
Write prot clear
Done

Read Chip Identification:
JEDEC ID: BF 26 43
Part Nummber: SST26VF064
Memory Size: 1048576 bytes
Block Size: 65536 bytes
STATUS 0x05 = 0
CONFIG 0x35 = A

Reading Chip...
Reading...
addr = 0, data = FF FF FF FF FF FF FF FF
(..)
addr = FFFF8, data = FF FF FF FF FF FF FF FF

Writing 512 signatures

Double Checking All Signatures:
all 512 signatures read ok

Checking Signature Pairs
all 255 signature pairs read ok

Checking Read-While-Write (Program Suspend)
write 256 bytes at 256
write time was 1369 microseconds.
read-while-writing: 00 00 00 00 15 F5 95 4B
test passed, good read while writing

Checking Read-While-Erase (Erase Suspend)
erase time was 18573 microseconds.
erase correctly erased 65536 bytes
read-while-erasing: 00 00 00 00 15 F5 95 4B
test passed, good read while erasing

All Tests Passed :-)

Test data was written to your chip. You must run
EraseEverything before using this chip for files.

ahull Sun Aug 28, 2016 8:41 pm

The story is staring to get pretty interesting.

Image

Keep us posted with your progress.

rexnanet Fri Sep 02, 2016 9:52 am

…on the quest to have the serial upload python script working in Windows… :) (yes, I said it… Windows…)
:arrow: Python – installed.
:arrow: Pyserial – installed.
:arrow: Testing… not yet :)

ahull Fri Sep 02, 2016 11:38 am

Let us know how the testing goes.

Image

Image

What is the purpose of this mysterious device?

zmemw16 Fri Sep 02, 2016 7:06 pm

ahull wrote:The story is staring to get pretty interesting.

Image

Keep us posted with your progress.

rexnanet Mon Sep 12, 2016 8:23 am

zmemw16 wrote:ahull wrote:

got the next generation interested? st is next

martinayotte Mon Sep 12, 2016 12:21 pm

I love Python ! :D
I’m using it since more than 16 years (almost never use Perl any more since then)
What is exactly the problem you’re facing ?

rexnanet Mon Sep 12, 2016 2:21 pm

martinayotte wrote:I love Python ! :D
I’m using it since more than 16 years (almost never use Perl any more since then)
What is exactly the problem you’re facing ?

rexnanet Tue Sep 13, 2016 9:51 am

martinayotte wrote:
What is exactly the problem you’re facing ?

martinayotte Tue Sep 13, 2016 1:44 pm

Did you have first uploaded the CopyFromSerial sketch into your STM ?

(For the time printing and divide by zero, it is probably simply because your file is so small, it took less than a second)

rexnanet Wed Sep 14, 2016 8:08 am

martinayotte wrote:Did you have first uploaded the CopyFromSerial sketch into your STM ?

martinayotte Wed Sep 14, 2016 12:48 pm

For debugging, I would rather use a second serial port to do some debug prints and leave the first one for the CopyFromSerial functionalities.

rexnanet Wed Sep 14, 2016 3:47 pm

Yeeeaaaaaahhhh…. :)
That might become the “last resort” option :)
I was hoping to keep this as simple as possible but that might seem the best option…

rexnanet Thu Sep 22, 2016 2:11 pm

Going to try the “last resort” option :)

But I have a question:
What is the Serial-UART correlation?

“Serial” is used by the USB serial connection.
I’ve tried to use “Serial2” and connected the serial adapter to USART2 (PA_2 and PA_3 pins) but got no output. Then got to switch attention to other things and stopped there… :)

I’ve found this code from Roger but haven’t checked whether the constant is defined or not:
/*
* Roger Clark
*
* 2015/05/28
*
* Moved definitions for Hardware Serial devices from HardwareSerial.cpp so that each board can define which Arduino "Serial" instance
* Maps to which hardware serial port on the microprocessor
*/

#ifdef SERIAL_USB
DEFINE_HWSERIAL(Serial1, 1);

DEFINE_HWSERIAL(Serial2, 2);

DEFINE_HWSERIAL(Serial3, 3);
#else
DEFINE_HWSERIAL(Serial, 1);

DEFINE_HWSERIAL(Serial1, 2);

DEFINE_HWSERIAL(Serial2, 3);
#endif

rexnanet Tue Oct 04, 2016 8:44 am

New episode:

Finally got USART2 to work.
After making a test sketch that was successful, I returned to the original sketch and…tada… it works :D
Did I make any modification for it to work… no. But it did, so next…

Debugging episodes:

1- After adding debug found out the first problem:
I made a test text file with some letters in it and named it “test.txt”.
Then I found that on the sketch the only letters allowed are CAPS!!!! I was like “what?!?!?!? why?????? It’s not that difficult to add and would save me a lot of work…”
So I added it to the sketch… (but also renamed the file to move forward, just in case…) :)

2- After some small mods, the sketch would end but nothing was written…
The Flash Buffer is set to 4096 bytes but the USB Buffer is set to 128 bytes. The file had 908 bytes and after 128 bytes the sketch moved on and ended without nothing written on the flash.
Still haven’t found out what is going on but moved the USB Buffer to 4096 and the sketch ended successfully.

Uploaded the “read files from flash” sketch I made and BAAAAMMM the file got written!!! :D :D :D :D :D

This is a big step forward :)

Now somethings still need to be done:
1- find out what is the deal with the USB buffer size, because I suspect I can’t write files bigger than 4096 bytes with this issue…
2- test with multiple files being written.
3- test the speed!!!!
4- connect to the ILI9341 and get some pictures going!!!! :D

Edit:
1- find out what is the deal with the USB buffer size, because I suspect I can’t write files bigger than 4096 bytes with this issue… – haven’t looked at this
2- test with multiple files being written. – OK
3- test the speed!!!! – Working OK @ SPI=36Mhz. Overclock still to come :D
4- connect to the ILI9341 and get some pictures going!!!! :D – “most probably” OK (Got some picture showing but the image was not ok in the flash because of the “Esc” stuff on the sketch. I’ll explain that later…

Sign in to reply