Skip to main content
Nbaşa.1
Associate II
October 15, 2021
Question

AT25SF128A External Flash Loader

  • October 15, 2021
  • 8 replies
  • 8659 views

Hi,

I used MT25QL128 flash memory in my project. This product was obsolute then, I decided to use AT12SF128 flash memory instead of MT25QL128 . Now, I use STM32 Cube Programmer and can not write external memory . Program give "memory edition verification error".

help please?

This topic has been closed for replies.

8 replies

NDura.16
Associate
October 15, 2021

Hi,

I have the same problem. I haven't solved yet. If you solve , can you share the solution?

Thank you

Tesla DeLorean
Guru
October 16, 2021

@NDura.16​ can you expand on details about your platform and implementation.

Do you have a serial port for debugging? Which pins/usart ?

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Guru
October 15, 2021

Zero hits on AT12SF128

https://www.adestotech.com/wp-content/uploads/AT25SF128A.pdf

https://www.dialog-semiconductor.com/sites/default/files/2021-02/DS-AT25SF128A-168.pdf

You'd likely need code your own loader, or get one written.

Step#1 would be to get your own BSP code working to read, write and erase the memory device.

What STM32? What pins?

Convey some actual details of your implementation.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Nbaşa.1
Nbaşa.1Author
Associate II
October 15, 2021

Thank you for your suggest.

I wrote ".stldr" file for MT25QL128. Pins are quadspi IO pins for my own microcontroller(STM32F746). I arranged gpio settings for these pins in loader code. It work with MT25QL128 . However, these configurations do not work for AT12SF128. Also, pins are same because pcb board is not changed. I can do chip erase and sector erase but I cant read and write in external memory.

Andreas Bolsch
Lead III
October 16, 2021

Hm, the AT25S128 seems to use a rather conventional instruction set. As long as the block protection bits in status register remain cleared, loader code for MT25QL128 should work after some simple modifications:

  • If ID is checked, it has to be adjusted, furthermore 0x9F works only in 1-line mode.
  • Write Enable only in 1-line mode
  • Read Status Register only in 1-line mode
  • If Quad I/O Fast Read 0xEB is used: instruction in 1-line, address and data in 4-line mode, and one extra M byte after address has to set up properly (via one alternate byte, or maybe one extra dummy byte with all pull-ups enabled or all pull-downs enabled)
  • Quad Page Program 0x32: instruction and address 1-line, data 4-line
  • no configuration required (i.e. no QE bit, no Enter Quad Mode)

In a sense, the AT25S128 is much simpler than the MT25QL128 as there is no configuration required/possible (no QE bit, no Enter Quad Mode). Since chip erase and sector erase works, all boils down to the *different* 1-line/4-line mix for read/program and the extra M byte for read.

Tesla DeLorean
Guru
October 18, 2021

Can one of the parties here please establish the model of STM32 involved, the pins used for QSPI (explicitly state the ones you've used/chosen), and the availability of a debug/diagnostic UART connection (again explicit pins, and clocking source for your design)

Again if the board copies the DISCO or EVAL reference design, these details would also be useful in building a test BSP, and External Loader.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Nbaşa.1
Nbaşa.1Author
Associate II
October 19, 2021

Microcontroller is STM32F746IGT , then I use PB2(CLK), PF8(IO0) , PF9(IO1), PF7(IO2), PF6(IO3) , PB6(CS). I used default STM Loader code. I changed this code for these pins. Now, I make chip erase and sector erase. But, I do not read in memory, show in picture. My read command is "0x6B" .

I have progressed on the subject but could not reach the result.

Nbaşa.1
Nbaşa.1Author
Associate II
October 22, 2021

I started to write loader code from the beginning. Now , I send write enable command , WEL bit is setted 1. But, chip does not go into QUAD mode, because I do not write status register 2 . I have to do this before I can read memory.

Tesla DeLorean
Guru
October 22, 2021

Sure, for Quad Mode commands SR2.QE needs to be set.

This is indicative of SR2.QE == 0

READ QUAD-6B

00000000 : 99 99 99 99 99 99 99 99-99 99 99 99 9D DD DF FF ................

00000010 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000020 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000030 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000040 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000050 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000060 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000070 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

The READ DUAL will work properly.

From a functionality stand-point the chip is a mix of the MICRON and WINBOND

Here where SR2.QE=1

READ ID

AT25SF128A

00000000 : 1F 89 01 1F 89 01 1F 89-            ........

REG1 0000 REG2 0002

READ QUAD-6B (000040)

00000000 : 11 22 45 67 FF FF FF FF-FF FF FF FF FF FF FF FF ."Eg............

00000010 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000020 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000030 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000040 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000050 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000060 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000070 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

READ DUAL (000000)

00000000 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000010 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000020 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000030 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000040 : 11 22 45 67 FF FF FF FF-FF FF FF FF FF FF FF FF ."Eg............

00000050 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000060 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

00000070 : FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Nbaşa.1
Nbaşa.1Author
Associate II
October 22, 2021

How can I set SR2.QE ?? My code is :

  sCommand.Instruction = 0x50;

  sCommand.InstructionMode = QSPI_INSTRUCTION_1_LINE;

  sCommand.AddressSize = QSPI_ADDRESS_32_BITS;

  sCommand.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;

  sCommand.DdrMode = QSPI_DDR_MODE_DISABLE;

  sCommand.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;

  sCommand.SIOOMode = QSPI_SIOO_INST_EVERY_CMD;

  sCommand.AddressMode = QSPI_ADDRESS_NONE;

  sCommand.Address = 0;

  sCommand.DataMode = QSPI_DATA_NONE;

  sCommand.DummyCycles = 0;

  if (HAL_QSPI_Command(&hqspi, &sCommand, HAL_QPSI_TIMEOUT_DEFAULT_VALUE)

    != HAL_OK) {

    return HAL_ERROR;

  }

   

  sCommand.Instruction = 0x31;

  sCommand.InstructionMode = QSPI_INSTRUCTION_1_LINE;

  sCommand.AddressSize = QSPI_ADDRESS_32_BITS;

  sCommand.AlternateByteMode = QSPI_ALTERNATE_BYTES_1_LINE;

  sCommand.DdrMode = QSPI_DDR_MODE_DISABLE;

  sCommand.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;

  sCommand.SIOOMode = QSPI_SIOO_INST_EVERY_CMD;

  sCommand.AddressMode = QSPI_ADDRESS_NONE;

  sCommand.Address = 0;

sCommand.AlternateBytes = 0x02; // QE bit set 1

sCommand.AlternateBytesSize=1;

  sCommand.DataMode = QSPI_DATA_NONE;

  sCommand.DummyCycles = 0;

  if (HAL_QSPI_Command(&hqspi, &sCommand, HAL_QPSI_TIMEOUT_DEFAULT_VALUE)

    != HAL_OK) {

    return HAL_ERROR;

  }

  if (QSPI_AutoPollingMemReady(0x35,HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {

    return HAL_ERROR;

  }

Tesla DeLorean
Guru
October 22, 2021

I use a more regular read/write method on the status registers

The Alternate Byte mode, probably

 s_command.AlternateByteMode  = QSPI_ALTERNATE_BYTES_1_LINE;

 s_command.AlternateBytesSize = QSPI_ALTERNATE_BYTES_8_BITS;

 s_command.AlternateBytes   = 0x02;

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Nbaşa.1
Nbaşa.1Author
Associate II
October 22, 2021

I changed command arrangements then solve problem. Firstly, I create project file and debug methods. Now, Only I have to create Linker file (.stldr file ) for STM32 cube programmer.

NDura.16
Associate
November 3, 2021

Hi,

I use same flash memory ( at25sf128) in my project and I can read data from flash correctly, I checked it. However, The images does not have correct view on LCD.

Have you ever had this problem?

0693W00000GWSA7QAP.jpg