cancel
Showing results for 
Search instead for 
Did you mean: 

Can't erase external flash sector on a B-U585I-IOT02A board with STM32CubeIDE functions.

Marty
Associate

I'm trying unsuccessfully to erase a 4K sector at 0x73ff0000 using STM32CubeIDE code, but the STM32CubeProgrammer works fine.  I've tried using BSP_OSPI_NOR_Erase_Block() and MX25LM51245G_BlockErase() with no luck.

My code base is the HTTP_IOT_WebServer example.  My basic code is (where addr=0x73FF0000 and EFLASH_SECTOR_MASK=0x03FFF000)

 -------------------------------------------

BSP_OSPI_NOR_DisableMemoryMappedMode(0);

 

rc = MX25LM51245G_BlockErase(&hospi_nor[0], MX25LM51245G_SPI_MODE, MX25LM51245G_STR_TRANSFER,

HAL_OSPI_ADDRESS_32_BITS, addr & EFLASH_SECTOR_MASK,

MX25LM51245G_ERASE_4K);

 

BSP_OSPI_NOR_DisableMemoryMappedMode(0);

 -------------------------------------------

Any idea why this doesn't work? Is the Programmer doing anything I'm not doing?

 

-Marty

3 REPLIES 3

Read the Status Register, and check the BPB (Block Protection Bits)

 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Status Reg = 0x00 before and after attempt to erase.  The BP0-BP3 bits are zero, no protection.

-Marty

>>Any idea why this doesn't work? Is the Programmer doing anything I'm not doing?

The memory is not in the mode you think it is?

ie Not in SPI mode, not in 32-bit mode

Look at what exactly is being sent. Describe the nature of the failure. Does it complete immediately? Ignore the command? Not erase? Not respond to other commands?

You've sent a Write Enable? It spends some time in Wait for Complete? A 64KB sector erase at a 64 KB boundary? Zero-Basis address?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..