Writing to flash causes erratic behavior GIGA R1

Basically I have this code where I need to be writing a bunch of variables to flash so I can store them for persistent access using KVStore (keeping a dashboard updated). However, when I implemented the "flashSet0()" function, and I retrieve the data afterwards the boards crashes (gives me the red blinking LED) and I stop being able to access the external QSPI flash at all, forcing me to perform a full flash reset to be able to use it again. Any tips?

Keep in mind I also tried kv_reset("/kv/") but it yielded the same results.

void flashStore()
{//Inicio Storage
  int result = kv_set("dinTotal", &ingresosTotales, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error saving to flash");
    while(true){}
  }
  
  result = kv_set("prod1Total", &volumenSaliente1, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error saving to flash");
    while(true){}
  }
  
  result = kv_set("prod2Total", &volumenSaliente2, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error saving to flash");
    while(true){}
  }
  
  result = kv_set("prod3Total", &volumenSaliente3, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error saving to flash");
    while(true){}
  }
  
  result = kv_set("prod4Total", &volumenSaliente4, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error saving to flash");
    while(true){}
  }
  
  result = kv_set("prod5Total", &volumenSaliente5, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error saving to flash");
    while(true){}
  }
  
  result = kv_set("prod6Total", &volumenSaliente6, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error saving to flash");
    while(true){}
  }
}//Final Storage


void flashRetrieve()
{//Inicio Retrieve
  int result = kv_get("dinTotal", &ingresosTotales, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error retrieving from flash");
  
  }
  
  result = kv_get("prod1Total", &volumenSaliente1, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error retrieving from flash");
  
  }
  
  result = kv_get("prod2Total", &volumenSaliente2, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error retrieving from flash");
  
  }
  
  result = kv_get("prod3Total", &volumenSaliente3, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error retrieving from flash");
  
  }
  
  result = kv_get("prod4Total", &volumenSaliente4, sizeof(float), 0);
  if (result !=MBED_SUCCESS)
  {
    Serial.println("There was an error retrieving from flash");
  
  }
  result = kv_get("prod5Total", &volumenSaliente4, sizeof(float), 0);
  if (result !=MBED_SUCCESS)
  {
    Serial.println("There was an error retrieving from flash");
    
  }
  result = kv_get("prod6Total", &volumenSaliente4, sizeof(float), 0);
  if (result !=MBED_SUCCESS)
  {
    Serial.println("There was an error retrieving from flash");
    
  }
}//END OF RETRIEVE

void flashSet0()
{
  float zero = 0.0;
  
  int result = kv_set("dinTotal", &zero, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error saving to flash");
    while(true){}
  }
  
  result = kv_set("prod1Total", &zero, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error saving to flash");
    while(true){}
  }
  
  result = kv_set("prod2Total", &zero, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error saving to flash");
    while(true){}
  }
  
  result = kv_set("prod3Total", &zero, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error saving to flash");
    while(true){}
  }
  
  result = kv_set("prod4Total", &zero, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error saving to flash");
    while(true){}
  }
  
  result = kv_set("prod5Total", &zero, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error saving to flash");
    while(true){}
  }
  
  result = kv_set("prod6Total", &zero, sizeof(float), 0);
  if (result != MBED_SUCCESS)
  {
    Serial.println("There was an error saving to flash");
    while(true){}
  } 
}
void loop()
{//Rest of code...
 if(digitalRead(resupplyPin)==LOW)
  {
    flashSet0();
    Serial.println("Reset!");
    flashRetrieve();
  }
//Rest of code...
unsigned long timer = millis();
  if (millis() - timer < 25000)
  {
    bool dataSave = true;
    flashStore();
    
  }
//Rest of code

I happen to have a similar problem. After using kv_set a few times any sketch with any kv_ command will crash the OS. Even kv_reset("/kv/").

How did you do the full flash reset?

Try Giga reset following the steps below:

and make sure that you upload sketch(es) that won't mess up your board's bootloader or memory afterwards.

Before doing the steps above, run QSPIFormat following File > Examples list. Under the Examples for Arduino Giga R1 group, select STM32H747_System > QSPIFormat .

Have the same problem - after weeks of using kv without a problem suddenly it crashes when doing any kind of interaction with it - I tried the all the above mentioned steps. First formating and then new bootlader and another format - when I check the partition it looks good - see out below.
Any other steps that I can take to get my board back into working order ???
Other code works just fine.

==== Output from Examples->STM32H747->QSPIReadPartions ======
Looking for Partitions on the Flash Memory... MBR Found
Boot Signature: 0x55AA

Printing Partitions Table and Info...

Partition: 1
Bootable: No
Type: 0x0B
Size [KBytes]: 1020
Start [C/H/S]: 0/2/0
Stop [C/H/S]: 4/0/0

================================
Partition: 2
Bootable: No
Type: 0x0B
Size [KBytes]: 13312
Start [C/H/S]: 4/1/0
Stop [C/H/S]: 56/0/0

================================
Partition: 3
Bootable: No
Type: 0x0B
Size [KBytes]: 0
Start [C/H/S]: 56/1/0
Stop [C/H/S]: 56/0/0

================================
Partition: 4
Bootable: No
Type: 0x00

No more partitions are present.

Total Space [KBytes]: 16384
Allocated Space [KBytes]: 14332
Unallocated Space [KBytes]: 2052
[Disconnected]

In order to make all relevant information available to any who are interested in this subject, I'll share a link to the dedicated topic @guidoseibt created for discussion of the problem they are having: