Fuel Gauge Algorithm not functioning

We are using the Murata Type 2FR dev kit - https://www.murata.com/en-us/products/connectivitymodule/wi-fi-bluetooth/overview/lineup/type2fr 

Internally, this has NXP's RW612 processor which is Cortex M33 core. We are using NXP's proprietary MCUXpresso IDE for development, utilizing pure C and FreeRTOS. 

Here is a pseudocode - 

#include "nrf_fuel_gauge.h"


static const struct battery_model battery_model = {
#include "battery_model.inc"
};

struct nrf_fuel_gauge_init_parameters parameters = {
.model = &battery_model,
.opt_params = NULL,
.v0 = 3.315,
.i0 = -0.012895,
.t0 = 25.21,
};

segger_printf("Initializing Fuel Gauge....\n");
int ret = nrf_fuel_gauge_init(&parameters, NULL);
if (ret < 0) {
segger_printf("Error: Could not initialise fuel gauge\n");
return ret;
}
else if (ret == 0)
segger_printf("Fuel Gauge initialized!\n");

segger_printf("nRF Fuel Gauge version: %s\n", nrf_fuel_gauge_version);

float soc = nrf_fuel_gauge_process(3.27, -0.01256, 24.53, 1.0, NULL);
segger_printf("SoC: %.2f", (double)soc);

Note, this is the only code pertaining to fuel gauge algorithm. We do not yet have the I2C read/write driver code. We are using some dummy values to get started with. We are just trying to evaluate the process function and get a battery percentage. Then, we will add the actual fuel gauge code and charger code to get the accurate percentage value. Points to note - 

1. We found some .a binary files in the sdk folder here - C:\ncs\v3.0.2\nrfxlib\nrf_fuel_gauge\lib\cortex-m33\hard-float. We have linked both the .a binaries available here to our binaries along with some other dependencies. 

2. We are using segger_printf here which is basically just a printf command. 

3. When we run this code, we do see that the nrf_fuel_gauge_init() does return 0, meaning successful initialization. I'm able to retrieve the nrf_fuel_gauge_version as well. However, when we run the nrf_fuel_gauge_process() function with dummy values, it just stops working and crashes. Here is the output - 

00> Initializing Fuel Gauge....
00> Fuel Gauge initialized!
00> nRF Fuel Gauge version: 1.0.1

Are there any pre-requisites which are needed to successfully run the nrf_fuel_gauge_process() function? Does this function depend on charger initialization or fuel gauge structures? 

Related