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

nRF52832 got a HardFault when calling fds_gc()

Hi

I was using FDS without SoftDevice to implement the log system of our product.

But the system was stuck after hundreds of records writing/deleting. Finally I located it would happen when the fds_gc() was invoked. It went into HardFault_Handler.

I also reproduced this issue by only using the FDS example code in nRF5_SDK_15.3.0_59ac345 to do the same thing.

I searched this issue in DevZone and found some similar ones. But it seems there are no solutions for that.

Here is the test code added in examples\peripheral\flash_fds\cli.c to reproduce the issue:

static void logadd(nrf_cli_t const * p_cli, size_t argc, char ** argv)
{

    static uint8_t data[30] = {"write data into flash"};

    int num = strtol(argv[1], NULL, 10);
    int index;

    if (num > 1000)
        return;

    for (index = 0; index < num; index++)
    {
        record_write(p_cli, 0x100, 0x101, data, strlen(data));

		record_delete(p_cli, 0x100, 0x102);
		record_write(p_cli, 0x100, 0x102, data, strlen(data));

    }
}

When the test log number is 400, the issue will happen.

Is there some known bugs for GC of FDS? Or is there something wrong in my code?

Thank you.

Parents Reply
  • Hi,

    It's not obvious from the code that you posted where the garbage collection is done, is it done in the record_delete() call? There is a limited amount of how many fds operations that can be queued, this is dependent on FDS_OP_QUEUE_SIZE in the config file.

    Could you provide a minimal project in a zip that will reproduce the error and is able to run on the development kit? 

    I'm out of office until the end of next week, expect therefore some delay in the reply.

    regards

    Jared

Children
No Data
Related