I am writing into one handle which max count is 2000.
Then I do a loop from i=0 to 1999, writing 16 bytes at each ID=i.
The first 292 calls are succesfull (and valid datas can be reread), then my Q2501B hangs.
The data flash remains unusable until I enter a WOPEN=3 command.
Hi pcorgier,
The problem might be due to the fact that flash write operations should not be performed repetitiously in a loop. This is because, each write operation in flash will take some time. Also, some internal processes (like garbage collection) etc will be performed on each write. Hence, as the amount of data in the flash increases, each of these operations (garbage collection etc) will take more and more time.
Hence, as a precaution, you should subscribe to a timer after each call to adl_flhWrite () API and only in the timer handler should you write to the flash again. This will provide enough time to ADL library to perform internal stuff (like garbage collection etc).
When you use a loop to write to flash (instead of using a timer), your Open-AT application will issue adl_flhWrite () APIs to ADL library without any consideration for the time it takes to actually write into flash.
This might cause stack overflow (as now ADL internal functions are in process and your applicaiton still makes calls to adl_flhWrite ()) or may also cause watchdog reset (as OAT is not leaving the CPU).
Hence, it is best to write to flash using a timer when the number of flash objects to write is greater than 100.
Hi pcorgier,
ADL user Guide specifies that at a timer at the most 2000 object identifiers for flash memory can exist (ADL User Guide, Section 3.5.2).
So, could you please check if your application tries to manipulate object identifiers greater than 2000.
If possible, you can start afresh by erasing all the flash data (by executing AT+WOPEN=3 command) and then observe the behavior.
Usually ADL_FLH_RET_ERR_NO_ENOUGH_IDS is returned if the flash write operation fails due to limitation of number of available IDs.