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:
Thank you in advance.
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:
Looking forward to your reply!
Victor.
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
Hello Stefan,
Thanks for the information! Please notice the following statement from the datasheet of the memory that you are using.
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?
Regards,
Victor.
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
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;
}