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

How to use pstorage raw and pstorage parallel?

Hi,

I'm using SDK 11.0 and I want to implement a firmware update procedure over GSM. The firmware data packets should be received via UART (which is connected to the GSM modem) while running the application, After some CRC checkings the data packet should be saved to bank 1 of the flash area. I think therefore I need the pstorage_raw module as used in the bootloader. On the other side, I need the device manager for storing bonding information. After a look in the sources I saw, that pstorage_init() and pstorage_register() are different, but needed in both cases. Is it possible to use both modules or is there an other option, which I didn't saw yet?

Kind regards, 

Christian

  • Hi Christian, 

    As you can find in the code, the pstorage_raw library simply provide the direct access to flash with a queue. It lacks the swap page as in the pstorage library. 

    pstorage_raw is not made to be used at the same time with the pstorage. But from my point of view it should be possible to use them in the same application, but not at the same time. 

    What you need to do is to change the name of pstorage_init and other functions in pstorage_raw.c that have the same name as in pstorage.c 

    The most challenging part is pstorage_sys_event_handler() where the libraries listen for softdevice's event so that it would continue the queue after a successful flash activity. 
    Currently in pstorage_raw.c there already a flag flash_access to check if it's requested by the module or not. But it doesn't guarantee the behavior when both pstorager running at the same time, and both have something in its own queue. 

    I think what you should do is to make sure there will be no pstorage.c activity when you are receiving the data in GSM. You may use a flag to block any activity for pstorage to start (for example bonding) when you are receiving image via GSM. 
    Again, the libraries were not designed to work in parallel, and I haven't tried this myself so I can't guarantee 100% that it would work.

Related