Hi,
I am using the fsl_flexspi.c driver to access NOR flash. The blocking API seems to work ok, but when I switched to the non-blocking functions, I found that reading from flash failed for a 4096 block. In fact, it fails for any block length > 8 bytes.
If I read a block of 4096 bytes, the IPCMDDONE flag is raised before all the bytes are received. It seems to consistently occur when 120 bytes are remaining to be read. If I modify the isr so that it effectively ignores the IPCMDDONE flag, then it carries on receiving bytes and I get the full 4096 byte block. So I have modified fsl_flexspi.c to workaround this issue.
My questions are:
I have uploaded my demo project that shows this problem.
It is basically the evkmimxrt1020_iled_blinky demo with evkmimxrt1020_flexspi_nor_polling_transfer merged in. The demo is modified so that it runs from internal ram (SRAM_OC). I have copied the file flexspi_nor_flash_ops.c to flexspi_nor_flash_ops_non_blocking.c. Both files have been modified, the latter uses the non-blocking api.
Note:
In main() it does the following (after the initialisation etc):
In MCUXpresso change the settings so that the preprocessor symbol is as follows:
This is what I saw with different block lengths (change TEST_BLOCK_SIZE):
Block length bytes | Remainder when IPCMDDONE received | Result |
4096 | 120 | Fail |
2048 | 120 | Fail |
1024 | 120 | Fail |
512 | 120 | Fail |
256 | 120 | Fail |
128 | 112 | Fail |
64 | 48 | Fail |
32 | 24 | Fail |
16 | 8 | Fail |
8 | 0 | Pass |
4 | 0 | Pass |
1 | 0 | Pass |
The workaround is as follows (not necessarily the best way):
IMPORTANT: This mechanism relies on the flexspi_transfer_t::dataSize field being set to a valid size or zero for this to work, especially for commands that do not take a size, such as chip erase. If dataSize is set to a non-zero value for chip erase etc, then the callback will not be called.
Info:
Thanks for your help.
Kind regards.
Hello @rshipman ,
Thank you for providing us this workaround solving the problem, I'm going to contact the internal SDK group so they can deliberate about the addition of this fix on a future SDK release.
With respect of your questions, as soon as we have a correct answer to these, we will let you know.
BR,
Habib.