Since I recently made the same journey through the SDK as Dominik describes here: https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1096852/am2434-custom-flash-driver-for-am2434-error/4062973?tisearch=e2e-sitesearch, I would like to share my findings with you.
I am working on my custom PCBA with AM2434 and IS25LP128F in QSPI mode.
First a few words about the custom flash configuration file flash_nor_ospi_quad_device_xxxx.c.
- Do not use flash_nor_qspi_device_xxxxx.c in any case!
- .NOR_SR_WIP points to the WriteInProgress bit in the status register. This parameter is mandatory for programming multiple pages of your flash can be guaranteed.
- The struct is not sufficient for all flash, or contains inapplicable parameters. Some flash can only be configured via opcodes, in contrast to what the driver currently provides via the three status registers. Therefore I have added the following entries for my case:
.NOR_CMD_RDBR = 0x16U, READ BANK ADDRESS REGISTER
.NOR_CMD_EN4B = 0xB7U, Enter 4-byte Address Mode
.NOR_CMD_WRSR = 0x01U, Write status registers
.NOR_CMD_QPIEN = 0x35U, Enter QPI mode
.NOR_CMD_QPIDI = 0xF5U, Exit QPI mode
Correct, you have to replace the accesses to status registers of the flash with opcodes in the SDK if necessary. Starting point for this is Flash_norQspiOpen()
In Flash_norQspiSetAddrLen() the address length can be changed to 4 byte. In my case I had to change the register access by opcode
cmd = devDefines->NOR_CMD_EN4B;
status = Flash_norQspiCmdWrite(config, cmd, cmdAddr, numAddrBytes, NULL, 0);
and used
cmd = devDefines->NOR_CMD_RDBR;
status = Flash_norQspiCmdRead(config, cmd, cmdAddr, numAddrBytes, &readStatus, 1);
to check the effectiveness.
In Flash_norQspiSetMode1s1s4s() :
cmd = devDefines->NOR_CMD_WRSR;
status = Flash_norQspiCmdWrite(config, cmd, cmdAddr, numAddrBytes, ®Data, 1);
In Flash_norQspiSetQuadDataWidth() :
/* Enable Quad data width configuration */
cmd = devDefines->NOR_CMD_QPIEN;
respectively
/* Disable Quad data width configuration */
cmd = devDefines->NOR_CMD_QPIDI;
Flash_norQspiCmdWrite(config, cmd, regAddr, cmdAddrLen, NULL, 0);
readDataCapDelay was defined as unsigned int32, which underflows if the ID of your flash cannot be read. This is the dead loop Dominik was talking about. Here you are stuck if something is wrong with the 114 or 444 mode.
So far so good. With these steps you should be able to address the flash correctly.
Sector Erase does not seem to be supported yet by the SDK.