This question is a continuation of MQX MFS Nandflash ECC Failed
After getting a working solution and testing it several times, I now have the same error again.
The solution I found is not working anymore, and I can only guess at what sequence of events led to a working solution before.
Symptoms:
- Using MFS nandflash example (with ffs wearlevelling), I get ECC_FAILURE / NFC_ECC_STATUS_CORFAIL
- Using Mqx nand driver I get the same error inside nfc.c
- Setting BSP_ECC_SIZE to 0 gives a working system using Mqx nand driver.
Since my tests pass using BSP_ECC_SIZE=0, I assume this is a problem with the configuration or with the ECC engine in the cpu ( Vybrid MVF61NN151CMK50 )
My setup is as decribed in previous thread.
Jon
Hello Jon,
Unfortunately we don't have the specific hardware in order to test or reproduce your issue. However according your inputs I can suggest to erase all the nand device and/or try repair. Since we have change the ECC the partition table may damage some blocks of the device and we need to mark and identified, before try again.
Or have you try with a new device, and see if the setup that you use before it is working?
Have a great day,
Sol
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Sol,
I am a colleague of Jon, and supporting him with this issue.
After some testing, we found that some cards are able to read/write from/to the NAND Flash device, however some are not.
As Jon explains, we have two methods of testing the NFC. One using the BSP driver, and another using the FFS/MFS drivers, bundled with MQX. The BSP driver does work when setting NUM_ECC_BYTES > 0, and returns NANDFLASHERR_ECC_FAILED when attempting to read. Setting NUM_ECC_BYTES = 0 however seems to work fine.
The FFS/MFS solution seem to work fine, even with NUM_ECC_BYTES=4 or NUM_ECC_BYTES=8.
Some of our cards, those used in initial testing of the NFC, seem to have reached a state where nothing works. We will have one of our HW Engineers take a look at this.
We have examined and compared the sources of the BSP driver and the NFC driver included in the FFS/MFS-driver. There are several differences between the two, most of it due to the FFS/MFS-driver also reading some meta-data with every read. However, we noticed one curious difference we cannot quite understand:
[C++] MQX Vybrid NFC ECC check - Pastebin.com
The confusing part is the offset added to VIRTUAL_PAGE_SIZE. VIRTUAL_PAGE_SIZE=512 and num_ecc_bytes=15 have been confirmed to be identical on both setups, so why do the BSP check the NFC_ECC_STATUS_CORFAIL flag at offset NFC_ECC_STATUS_OFFSET=0x0C, and FFS check it at offset (num_ecc_bytes + 4) = 19 = 0x13?
NFC_ECC_STATUS_OFFSET is defined on the top of nfc.c, and only used twice in this file, only to check status flags. It is never used in defining the location of the status field, and thus its origin and use is unclear.
The FFS driver is also using a magic number when adding 4, but the motivation for this is found in the reference manual:
NOTE
The address of the ECC status byte = Buffer n's start address +NFC_CFG[ECCAD] + 4 (n=0,1,2,3).
- Vybrid Reference Manual (Rev. 8), Ch. 10.3.4.2. Page 1724.
The two drivers appear to use different definitions of the ECC status word. It therefore seem to us that we are missing some information.
Could you elaborate on this.
/Tom
Edit:
Here are the values for ECCAD:
BSP - NFC_CFG[ECCAD] = 65
FFS - NFC_CFG[ECCAD] = 66
soledad can you continue with the follow up?
Let me check with the team
Someone??? 2 years and no answer... jonalvik someone contacted you? did you find the solution??
I never found a stable working solution to using the built-in ECC controller, so we implemented ECC caculation and checking in SW instead, and stored it in the NAND spare area. Slower and non-standard, but it works.
Jon
Can you please share example for your solution?
So it should work without any modification with the BSP flash driver?
Hi
Erasing the entire device (also trying repair if possible before failure) has been a part of my routine when testing different configurations.
I suspect that the problem is related to the fact that the flash has 16bit interface vs 8bit on the Vybrid tower kit.
Both the nandflash drivers in mfs and mqx-nand fails in the same place.
Have the drivers ever been tested with 16bit NAND flash?
Jon
Still stuck on this issue.
I suspect that the problem is related to the fact that the flash has 16bit interface vs 8bit on the Vybrid tower kit.
Both the nandflash drivers in mfs and mqx-nand fails in the same place.
Have the drivers ever been tested with 16bit NAND flash?
Jon