Part Number: PROCESSOR-SDK-AM437X
Hello,
I am running the QSPI_BasicExample_idkAM437x_armExampleProject on a Sitara AM437x IDK. I am using the SDK version 6.3.0.106.
It seems to me that I found a second bug in the SPI NOR flash driver when writing/reading data to/from the NOR flash using the configuration mode of the SPI-driver. Let me first summarize the problem and make a remark before I add a detailed description.
Summary
I believe that the flash write and read code accesses a wrong (unintended) memory area because of a missing byte swap instruction, since the flash device MX66L51235F flash needs to receive the most significant address byte first.
Remark
With the current example project, it is impossible to identify addressing problems. Initially the flash device is empty (all bits are ‘1’) and that example project always writes the same bit patterns to the same memory location. The test will always pass, even if the program would write to a non-erased memory address, since the data is already there and no different bits would be programmed from ‘1’ to ‘0’.
Detailed description
When I look at the function called S25FLFlash_BlockErase, I see that there is a byte swap of the address value taking place in the code, I highlight that code in a red rectangle:
Later on that byte-swapped tempAddr variable is being transmitted:
This might be a required action, since the highest address byte information has to be placed first on the SPI bus, see here from the Macronix MX66L51235F datasheet the block erase instruction:
But for all flash transactions the most significant byte has to be sent first. Here a screenshot of the page program sequence out of the Macronix datasheet, which the example project uses:
But when I now look inside the function SF25FL_ConfigMode_Write, which is called by SF25FL_bufferWrite, then I don’t find any byte swap of the address, the transaction.txBuf pointer points to a non-swapped variable. See here a comment that I added in the red rectangle:
And the same might be valid also for the SF25FL_bufferRead function:
Can you please check if this is correct?
Additional comment:
I identified the mismatch because the S25FLFlash_BlockErase uses the SPI driver also in config mode (“if(QSPI_OPER_MODE_CFG == object->qspiMode)”).
Maybe that the problem can also appear for Flash read/write the following case? “if(QSPI_OPER_MODE_MMAP == object->qspiMode)”





