Hello Everyone,
I am using MK60FX512VLQ12 microcontroller, CW10.6 and MQX4.1.
In our project we are using nandflash, usb, sd card, GPRS etc. Important data we are storing in nandflash and whenever required we are reading that data from nandflash and doing process as per requirement.Sometimes (3-4 times) we observed that due to some power issue nandflash is erased or corrupted, i.e whatever data we stored in nandflash is got erased even though after storing any data to nandflash we are closing and reopening it to store data successfully.
We decided to use low voltage detection here,and have done all changes in BSP for LVD interrupt, so that whenever low voltage is detected we will close nandflash.
but we are facing problem that if I used below code
main()
{
printf("hello world\n");
Cpu_INT_LVD_LVWInterrupt(INT_LVD_LVW);
while(TRUE)
{
}
}
then I observed that everytime interrupt is occured for LVD (I have written printf statement there for checking as "LVW")
but if we added some process in while loop then rarely interrupt occured for LVD (printf statement written for LVD came only once or twice if tested for 10-20 times).
Please help me how to detect LVD in this case.
Thanks.
Hi,
Data lost in NAND flash during power off is known issue.
There are two available solutions:
- Opt1: after writing data to NAND user must execute flush data.
- Opt2: Auto flush by Low Voltage Detection feature of Kinetis. When LVD triggered it will flush cache to save data.
In attachment you can find patches for this solutions. Unfortunately this patch is based on MQX4.0.2/MQX4.1.1 and Kinetis K70. However I suppose that it should not be difficult to bend it for your. case.
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi RadekS,
Thanks for reply and your time.
I am trying option1 and 2 now...
Thanks.