zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.71k stars 6.54k forks source link

FCB takes a long time to retrieve an entry #76491

Closed javankl closed 6 days ago

javankl commented 2 months ago

Describe the bug

I am using a Nordic nrf52832 and storing sensor readings in a FCB in external spi nor flash. When the device reports a reading, it uses fcb_getnext() to step through the readings to find the requested reading based on a reading index saved with the reading in the FCB. Each time I try to retrieve a reading, the FCB needs to step through the flash area from the beginning. When I do this, it takes about 1ms to take a step in the FCB and read the entry from flash. After I've collected over a hundred readings, the FCB takes about 100ms to find the requested sample and about 6 seconds near 10k readings. This is far too long of a wait for my application. I've looked into if the flash chip is getting put into low power mode, but setting CONFIG_SPI_NOR_IDLE_IN_DPD to 'n' doesn't change anything, nor does it seem it would as I don't have any power management set up at the moment. My project won't always have to return the latest reading and any reading in the FCB could be requested, otherwise I would use fcb_offset_last_n().

To Reproduce

Expected behavior

I expect my fcb_getnext() and flash_area_read() to take on the level of microseconds, not milliseconds.

Impact

This is a showstopper as far as using FCB for my application.

github-actions[bot] commented 2 months ago

Hi @javankl! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

github-actions[bot] commented 3 weeks ago

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

ShahinHaque97-CT commented 6 days ago

This issue has been resolved, Not a power related issue, User now is seeking to the record they wish to read, rather than starting reading from the first record