Skip to main content

AT25SF128A-SHB-T Problems when reflashing


3 months ago

Posted by GianLuca Trombin 25 points 4 replies

Hi everyone,

I'm using this QSPI Flash on a couple of projects based on ST microcontrollers. I'm using this Flash to run hold my application code and some images.

I wrote my drivers. No problem for the first time. I can erase and write.

Then when I try to erase and program again it doesn't work anymore. It seems that this flash cannot be erased (I tried to erase single 4K sectors, 32K block and full chip).

This happening on 50% of the assembled memories. I'm really worried...

I'm attaching my driver.

Any idea? Please help!

Thank you very much in advance

Attachment Size 932.63 KB

3 months ago

GianLuca Trombin 25 points

Hi again,

more info after some debugging.

It seems that BP0-BP4 of Status Register are always 1 in the flash that doesn't work anymore.

And I cannot set them to 0.

Why is this happening? Any idea?

And is there a way to recover from this?

Thank you


3 months ago

gordonmacnee 220 points

Hello GianLuca,

I could not open the zip file. Would you resend it (I use 7-zip)?

If BP4-BP0 are all 1 then the device is protected against writes (see section of the datasheet).

Check table 3 section 6.4.3 and see what the SRP1:SRP0 bits are set to. They need to be set to 0. Then you can clear the STATUS reg Byte1 by sending a Write Enable command and then 0x00 to STATUS reg 1. This will clear the protection bits.


3 months ago

GianLuca Trombin 25 points

Hi Gordon, 

thank you for your reply first of all.

Maybe I'm wrong but it seems that I cannot upload archives other than zip (if you want you can send me a mail: I will reply with the code archived on your preferred format).

Then, we are not able to recover setting BP0-BP4 to 0 again, as well as the SRPs

Our procedure is this:


SEND WRITE REGISTER 1 COMMAND (with associated data = 0x00)

READ BACK REGISTER 1. This is always 252 (or 0xFC or 11111100b)

Is there a way to recover these flash memories? I'm quite worried because we are starting the Mass Production...

If you need more info to go deeper feel free to ask, of course!

Reading the JEDEC ID we are having (0x1F, 0x89, 0x01) for working flash and for not erasable flash


Let us know plase!

Thank you again


3 months ago

GianLuca Trombin 25 points


Have you contacted ST or your ST distributor?

-> No and sincerely I don’t understand why should I 😊 Some of your chip works regularly (for example, last night I had more than 300 cycles of Full Chip Erase / Write), other ones after a couple of cycles stop working and we have the B0-B4 set to 1.

Which micro controller and eval board are you using?

-> Two ones: STM32F750 and STM32H7B0

Does the Flash fail EVERY time?

-> Some of them never fails, other ones always fail after the first 2-3 cycles (good / bad ratio is around 50%)

Is the Flash memory being written correctly but is failing to read back?

-> Don’t know really. How could we understand this?

Is it a small area that is failing?

-> No, it seems to be the whole area (B0=B1=B2=B3=B4=1)

Is it your code update that is failing or your data logging info?

-> Both ones

How are you reading and writing to the failing part of the memory?  

-> Both indirect mode and Memory Mapped mode

Any other info?