This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

using external flash MX25R1635FZUIL0 with nrf52 - having issues of writting and reading when multiple tasks are using the flash

Hello, I am using MX25R1635FZUIL0 with nrf52  and my device is working with freertos.  I have three different tasks using/accessing  the flash functions but when i read back the data for all the 3 tasks i read some values as 0 and some as 0xFF and some correct values. But I need 100% correct data.my task 1 n 2 are sampling data at a speed of 256 Hz and then calling flash write function so when these two works together my error rate reduces but when i start the 3rd task which samples data at 16kHz i get only 1-2 % correct data for task 1 n 2 and almost all 0xFF for task 3. Can anyone please help me what should i do to get all the data correctly from flash 

Parents Reply Children
  • I can see that in all the tasks you are handling the flash events using the Queue with ext_flash_queue_handle. So they should not be conflicting with each other as the processing is only done in ext_flash.c. 

    I think there is one flash access in two of your other tasks that probably access flash in the wrong way and hence making the MX25R chip go into some unstable state after that?

  • can u please tell which tasks are they where I am accessing flash in the wrong way?

  • I do not know as i do not know the specs of this chip and this chip is external to Nordic so I do not have knowledge on it.

    You said that it works with one task right? I would recommend you to add only one more task for testing to see how it goes and if the flash access does not work as intended then you can debug the code in the other task you accessed. This way you can exclude tasks which are functioning ok.

    I also think debugging this without any logic analyzer or oscilloscope to proble I/O pins will be difficult.

  • ok thanku Susheel , and yes i have checked with gsr n spo2 tasks working together and I used to get only 1-2% of error rate but when i introduce MIC task the issue arises. Meanwhile I will see if am able to manage logic analyzer or not as its a bit difficult for me to get it ryt now

  • Hello Susheel, after trying to debug the issue I can confirm that when all 3 tasks working together when the data has been collected the value reads zero sometimes for this I found out that even if the value is written properly it reads wrong but when it is written n read immediately after that then it reads correct value but when later all the tasks have completed recording then when I read it gives wrong data sometimes so for this what can be the issue n how can I correct it?? Secondly I have a doubt can semaphore working be a problem ? I mean when it is released then there can be delay in taking it or vice-versa? I mean is there a way how can achieve tasks synchronous in such scenario?

Related