I can not erase QSPI Flash W25Q32JV

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I can not erase QSPI Flash W25Q32JV

3,015 Views
stefan_ivanov
Contributor I

I am working on a project with a microcontroller  i.MX RT1052B and MCUXpresso 10.2.0 and EVKB-IMXRT1050. 

QSPI flash on our board is W25Q32JV which is 32Mb(4MB) serial flash. I want to erase, read, write to QSPI flash

in run time. I can write to and read from QSPI flash but can't erase the flash. From SDK folder: driver_examples\flexspi\nor\polling_transfer     I use the function:

status_t flexspi_nor_flash_erase_sector(FLEXSPI_Type *base, uint32_t address)
{
    status_t status;
    flexspi_transfer_t flashXfer;
    /* Write enable */
    flashXfer.deviceAddress = address;
    flashXfer.port = kFLEXSPI_PortA1;
    flashXfer.cmdType = kFLEXSPI_Command;
    flashXfer.SeqNumber = 1;
    flashXfer.seqIndex = NOR_CMD_LUT_SEQ_IDX_WRITEENABLE;
    status = FLEXSPI_TransferBlocking(base, &flashXfer);
    if (status != kStatus_Success)
    {
        return status;
    }
    flashXfer.deviceAddress = address;
    flashXfer.port = kFLEXSPI_PortA1;
    flashXfer.cmdType = kFLEXSPI_Command;
    flashXfer.SeqNumber = 1;
    flashXfer.seqIndex = NOR_CMD_LUT_SEQ_IDX_ERASESECTOR;
    status = FLEXSPI_TransferBlocking(base, &flashXfer);
    if (status != kStatus_Success)
    {
        return status;
    }
    status = flexspi_nor_wait_bus_busy(base);
    return status;
}

Thank you in advance. 



 

Labels (1)
0 Kudos
5 Replies

2,361 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Stefan,

With the information that you provide it's hard to understand the issue,  could you please tell more information about the problem you are facing, for example: 

  • From which memory and section are you running your application? 
  • Which section of the QSPI flash it's the one you are writing and reading?
  • How are you confirming that you are writing/reading correctly?
  • Which section of the QSPI flash it's the one you are trying to erase?

Looking forward to your reply! 

Victor.

0 Kudos

2,361 Views
stefan_ivanov
Contributor I

Hello Victor,

Thank you for your message.

My answers:

- From OCRAM/SRAM/.

-Only first page/256B/ offset 0.

-What I write I successfully read back the same.

-I am trying to erase 1st sector/offset 0/ or whole chip.

Best regards,

Stefan

0 Kudos

2,361 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Stefan,

Thanks for the information! Please notice the following statement from the datasheet of the memory that you are using.

pastedImage_1.png

Before writing on the memory, you need to erase the section in which you want to write. So, if you already confirmed that you are writing even you are not erasing, you are overstressing the memory. Don't write anymore in the memory until you are able to erase first.

Did you consider the next two things that are mentioned in the datasheet? 

pastedImage_2.png

Regards,

Victor.

0 Kudos

2,361 Views
stefan_ivanov
Contributor I

Hi Victor,

Thanks for the message.

Sorry, I didn't mention that I erase flash with the help of GUI Flash Tool of MCUXpresso.

I know all that. In first message I have explained the erase routine.

I do not overwrite the flash. I can read and write the flash. After writing the flash I erase it with GUI Flash Tool.

Regards,

Stefan

0 Kudos

2,361 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Stefan,

Sorry for my late response.

You need to modify the nor flash QE bit, IS25WP064AJBLE (this is the memory that comes with the EVK) is status register bit6, but winbond W25Q64JV (the memory you are using) QE bit is S9. For more details, you can check each nor flash datasheet. In conclusion, you need to modify this API code:

status_t flexspi_nor_enable_quad_mode(FLEXSPI_Type *base)
{
    flexspi_transfer_t flashXfer;
    status_t status;
    uint32_t writeValue = 0x0200;//0x40;// enable bit 9 in the status, it is QE bit.
    /* Write enable */
    status = flexspi_nor_write_enable(base, 0);
    if (status != kStatus_Success)
    {
        return status;
    }
    /* Enable quad mode. */
    flashXfer.deviceAddress = 0;
    flashXfer.port = kFLEXSPI_PortA1;
    flashXfer.cmdType = kFLEXSPI_Write;
    flashXfer.SeqNumber = 1;
    flashXfer.seqIndex = NOR_CMD_LUT_SEQ_IDX_WRITESTATUSREG;
    flashXfer.data = &writeValue;
    flashXfer.dataSize = 1;
    status = FLEXSPI_TransferBlocking(base, &flashXfer);
    if (status != kStatus_Success)
    {
        return status;
    }
    status = flexspi_nor_wait_bus_busy(base);
    return status;
}
Please let me know the results on your side.
Best regards,
Victor.
0 Kudos