1 year, 5 months ago.

How to save parameters and power cycles?


I'm new to the programming side of thing and got thrown in the deep end of a project.

At the moment I'm building on an ST Nucleo-F401RE Board.

I am hooking up a MAX17055 Fuel Guage and using the example code: https://os.mbed.com/teams/MaximIntegrated/code/MAX17055_EZconfig_Sample/

I was able to connect it up successfully and it outputs to Arduino Serial Monitor, to view the reading of my battery. But I came to a realisation that I will need to store some data parameters which would change.

What I'm talking about is this section located in MAX17055.h


     * @brief      Saved Fuel Gauge Parameters
     * @details    It is recommended to save the learned capacity parameters
     *             every time bit 2 of the Cycles register toggles (so that it
     *             is saved every 64% change in the battery) so that if power is
     *             lost the values can easily be restored.
    struct saved_FG_params_t {
        int rcomp0;              /**< The RComp0 is the characterization information critical to computing the open-circuit voltage of a cell under loaded conditions. */
        int temp_co;             /**< The TempCo value is the temperature compensation information based on the RComp0 value*/
        int full_cap_rep;        /**< The full capacity in relation with RepCap for reporting to the GUI. A new full-capacity value is calculated at the end of every charge cycle in the application. */
        int cycles;              /**< The Cycles value maintains a total count of the number of charge/discharge cycles of the cell that have occurred */
        int full_cap_nom;        /**< This is the calculated full capacity of the cell, not including temperature and empty compensation. A new full-capacity nominal value
                                    is calculated each time a cell relaxation event is detected. This values is used to generate other outputs of the ModelGauge m5 algorithm. */

My question is does these parameters get saved already on the Nucleo without me needing to do anything, if not what should I do to save them?

And my other question is what's a good practice to save them to, the Nucleo's internal EEPROM or should I get a separate i2c EEPROM to save it to?

I hope to hear from you soon.


Be the first to answer this question.