cancel
Showing results for 
Search instead for 
Did you mean: 

AT25SF128A External Flash Loader

Nbaşa.1
Associate II

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?

15 REPLIES 15
Nbaşa.1
Associate II

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.

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 Venmo
Up vote any posts that you find helpful, it shows what's working..
Nbaşa.1
Associate II

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;

  }

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 Venmo
Up vote any posts that you find helpful, it shows what's working..
Nbaşa.1
Associate II

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 II

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