This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F2808: Datalogger for an embedded system

Part Number: TMS320F2808

Hello all,

I have been facing following problem. I have implemented a datalogger i.e. software running on a MCU which creates periodic snapshots of a system state (values of some quantities of the system). These snapshots are stored in a circular buffer in external flash memory. This circular buffer causes that the oldest snapshots are overwritten by the newest ones which is desired behavior. Another requirement is that the datalogger has to work correctly also in case the MCU is restarted. Due to this fact there needs to be a mechanism how to recognize where in the external flash memory the last snapshot has been stored.

I have decided to fullfill this requirement in following way. The external flash memory is divided into sectors which consist of 512 bytes. So I collect several snapshots into one block and I append so called header at the beginning of this block. At beginning I have decided to use only 8 sectors of the external flash so the header contains block number which goes through values 1,2,…9. This algoritm works pretty well but only for small sizes of circular buffer. In case I have extended size of the circular buffer into several thousands of blocks (the external flash memory contains 2^{23} sectors) I have found that the time needed for founding sector for continuing in storing of the snapshots after MCU reset is unacceptably long. So I have been looking for another solution how to find sector for continuing in snapshot storage after MCU reset in quicker manner.

Does anybody have any idea? Thanks for any suggestions.

  • Hi,

    May be you can dedicate block 1 to always store the last updated block number. In this way, you can always refer to block 1 to find the latest updated block. Once you read block 1, you can go to the last updated block and check for a valid key (which you can define as needed, and can be programmed at the end of the update) to make sure that the data is valid (this is to help make sure that the last update went correctly without any problem). If valid key is not present, you can go to the last but one block.

    I would suggest to think in similar lines and do some research to find a better solution for your problem.
    I don't think I can help further on this, since this is not an issue related to TMS320F2808.

    Hope this helps.

    Thanks and regards,
    Vamsi