Skip to main content
Klassic
Associate II
June 2, 2023
Solved

Unable to erase external NOR flash memory while read, write works.

I am using STM32L496ZG to interface ISSI IS29GL064-70TLET nor flash by using HAL library. I used CUBE MX to generate the code and running code on Keil compiler. I am able to detect device ID, write and read block. But unable to erase data. I have used example code provided in application note AN4761.

Erase code snippet is below:

WRITE_READ_ADDR 0x8000

NOR_BANK_ADDR 0x64000000

HAL_NOR_ReturnToReadMode(&hnor1);

/* Erase the NOR memory block to write on */

HAL_NOR_Erase_Block(&hnor1, WRITE_READ_ADDR, NOR_BANK_ADDR);

/* Return the NOR memory status */

if(HAL_NOR_GetStatus(&hnor1, NOR_BANK_ADDR, NOR_TIMEOUT_VALUE) !=

HAL_NOR_STATUS_SUCCESS)

{

/* Erase Error */

HAL_UART_Transmit(&huart2, (uint8_t *) "Erase error" , 12, 100);

  return NOR_STATUS_ERASE_ERROR;

}

The status returns erase success. But the bits are still the same, they don't turn to ones at all.

Can any one please help me out on this?

This topic has been closed for replies.
KMINH.1
KMINH.1Best answer
Associate II
November 8, 2023

Thanks everyone for your answers.
The erase operation worked when I shortened the long wires I was using between stm board and flash IC. Perhaps the signal transmission was failing or weak signals.

Anyways, am grateful for the support I got from u all.

29 replies

Pavel A.
August 3, 2023

32 KW = 64 Kbytes = 0x10000

FMC maps the NOR so that even in 16-bit mode it looks to the CPU "normally". 64 Kbytes sector occupies 64Kbytes in the FMC address space.

Klassic
KlassicAuthor
Associate II
August 3, 2023

Ok. Also, Can u plz tell me how do I debug the erase operation? What registers do I need to look at while sending erase cmd? This may be more helpful in solving.

Thanks

Pavel A.
August 3, 2023

You just step thru the code and watch the variables. Maybe, use debug prints. While writing/erasing, avoid interference of the debugger in the flash access cycles (simply speaking, do not open debugger memory views on the flash). Hope the FMC esoteric timing parameters are already correct, as reads and writes work. Good luck.

 

KMINH.1
KMINH.1Best answer
Associate II
November 8, 2023

Thanks everyone for your answers.
The erase operation worked when I shortened the long wires I was using between stm board and flash IC. Perhaps the signal transmission was failing or weak signals.

Anyways, am grateful for the support I got from u all.

Amel NASRI
ST Technical Moderator
November 9, 2023

Hi @KMINH.1 ,

I'm not sure if you are speaking about the initially described issue by @Klassic . I wanted to mark your reply as accepted solution but I need your confirmation first.

-Amel

To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.