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

sd_flash_write internal buffer

Hello,

Should the application guarantee that the data sent to sd_flash_write is available until it receives the callback or will the softdevice make a copy of the data in an internal buffer? Seems like using 1k RAM just for this would be a bit wasteful. Wondering if I can keep the data om the RAM stack or not.

Parents
  • You need to keep the data available until the callback arrives, the softdevice doesn't copy it.

  • If it is documented somewhere I can't find it today either. But it is the case and if you think about it long enough you'll realise it's the only really sensible way it could work. The data already exists in memory so there's not much point copying it so it exists twice. Yes perhaps you are just about to release it, but perhaps you aren't.

    The softdevice is also designed to take the minimum amount of memory possible - to give you the maximum amount to use for what you need, so having it keep a few K of buffer space just incase someone is flash writing wouldn't make sense, much better the application sets aside the memory if it needs it, statically or on the heap, that gives all the control to the application.

Reply
  • If it is documented somewhere I can't find it today either. But it is the case and if you think about it long enough you'll realise it's the only really sensible way it could work. The data already exists in memory so there's not much point copying it so it exists twice. Yes perhaps you are just about to release it, but perhaps you aren't.

    The softdevice is also designed to take the minimum amount of memory possible - to give you the maximum amount to use for what you need, so having it keep a few K of buffer space just incase someone is flash writing wouldn't make sense, much better the application sets aside the memory if it needs it, statically or on the heap, that gives all the control to the application.

Children
No Data
Related