Report
4 months ago.

SPIF Block Device using SST25VF

Hi there!

I have some questions when using a SST25VF Flash memory device, with the help of mbed's SPIFBlockDevice.

I understand on how it can read and write a data, based on the library, but right now, I wanted to make this SST25VF as a data logging device. The idea is that it will receive data from a sensor which will have 100 Hz sampling rate.

The question is that, I notice that in spif.program() we need to set the address. Now, when we wanted to use as a datalogger, which will accept data every 1/100 second, how will this address be like? How can we increment this address so we will not have overlapping data which can corrupt the data? Also, is it correct, as this has 4Kbyte sectors, that mean that 1 address can store 4Kbyte worth of data?

I am quite lost here and would love to have help. Oh, I am using an offline compiler, with STM32F4 discovery board, and here is the datasheet of SST25VF: https://www.elfa.se/Web/Downloads/_t/ds/SST25VF016Bx_eng_tds.pdf

Thank you very much!!

Cheers, Stanley

Comment on this question

1 Answer

3 months, 3 weeks ago.

Hi Stanely, The program() API provides you with an interface to program a specific address. It is up to you how you want to store the data that is coming in every second. Do you want to keep updating the same address or have a data structure that gets written at that interval? If so, you would have to increment your write address accordingly. Hope this helps.

Thanks,

Naveen,

Team mbed.

Hi Naveen, thank you for your answer!

Yes I think I would like to increment the address. However Naveen, now I am having trouble as the read data is messed up! It shows some unknown characters like boxes or " ÿ" Fyi, I am using the same program as the example. Do you know what might be the problem? Thanks!

posted by Stanley Setiawan 28 Nov 2018

Hi Stanley, Also, each address represents a single byte of data. A sector size of 4KiB means that a 4KiB must be erased at once, but each byte can be programmed independently. example: https://github.com/ARMmbed/mbed-os-example-blockdevice/blob/master/main.cpp#L97-L108

You may also want to consider using a filesystem which may be more handy to create a log. See https://github.com/ARMmbed/mbed-os-example-filesystem

posted by Naveen Kaje 28 Nov 2018

Ahh okay I will try it first. One quick question.. for these libraries and examples, as I am using a different type of flash device (SST25VF) should I change some things inside the libraries?

posted by Stanley Setiawan 28 Nov 2018

Hi again Naveen, I have tried to compile and use the links that you gave me, but I keep on getting error messages which states that it fail to mount and no filesystem are found.. FYI, I already add SPIF block device, MISO MOSI pin names etc in the custom_targets.json. Are there something that I can add/delete to make it work?

And.. this maybe is a dumb question, but can a Flash Memory device save a .txt file? This example allows us to save a .txt file right?

Thank you a lot Naveen! best regards, Stanley

posted by Stanley Setiawan 28 Nov 2018

To post an answer, please log in.