user block

Started by "yan...@omniverter.com [rabbit-semi]" December 7, 2016
I am using BL4S200. I want to use some of bytes to hold some critical parameters using user block. However, I don't know how to find address offset free for me because I don't want to use adc calibration, and some other reserved space. anybody know how to do it.

Basically I only have 100 bytes for my parameters, but when I use writeuserblock, it takes the time longer than I expect and also it looks like to reduce my program speed because my serial communication takes longer time. I found another function writeuserblockarray, which one I can use and which one is better?

Thanks a lot.
The libraries reserve space at the top of the UserBlock using the macro ZWORLD_RESERVED_SIZE. You should place your data at offset 0 (the start of the UserBlock).

How often are you writing data? How long is it taking? You should be sure to write all of the bytes in a single call to the function. Because of how the library maintains mirrored UserBlocks (to always ensure a valid UserBlock) it can take awhile to update even a small portion of the data. I would recommend only writing when necessary, such as when you're saving configuration information.

If you need frequent updates, maybe you should use a variable in nvram, created by using the bbram keyword (see Samples/RestartVars/BatteryRAM).

writeUserBlockArray() is useful if you need to write a sequence of data from multiple sources at one time.

-Tom
On Dec 7, 2016, at 12:06 PM, y...@omniverter.com [rabbit-semi] wrote:
> I am using BL4S200. I want to use some of bytes to hold some critical parameters using user block. However, I don't know how to find address offset free for me because I don't want to use adc calibration, and some other reserved space. anybody know how to do it.
>
> Basically I only have 100 bytes for my parameters, but when I use writeuserblock, it takes the time longer than I expect and also it looks like to reduce my program speed because my serial communication takes longer time. I found another function writeuserblockarray, which one I can use and which one is better?