How to configure Settings?

Hello,

I have the task to persistently store some (2) configuration values in a Zephyr application (Nordic Version). The final version contains some external flash memory, will make use of MCUBoot, and Bluetooth (LE). The configuration values should be stored within the internal flash memory.

The application makes directly use of the QSPI peripheral and installs an interrupt handler (IRQ_CONNECT). According to the partition report (west build -t partition_manager_report), the `

settings_storage` partition is within the internal flash memory:

...
  flash_primary (0x100000 - 1024kB): 
+------------------------------------------+
| 0x0: app (0xfc000 - 1008kB)              |
| 0xfc000: settings_storage (0x2000 - 8kB) |
| 0xfe000: EMPTY_0 (0x2000 - 8kB)          |
+------------------------------------------+
...

The relevant part of the `prj.conf` file looks like this:

# Storing configuration values
CONFIG_FLASH=y
CONFIG_NVS=y
CONFIG_FLASH_MAP=y
CONFIG_SETTINGS=y
CONFIG_SETTINGS_NVS=y

Without the `CONFIG_FLASH_MAP` configuration, the `CONFIG_SETTINGS_NVS` will be reset and the Settings backend will be some pointless default. But, when enabling `CONFIG_FLASH_MAP`, that module also defines an irq handler for the QSPI interrupt.

What do I have to do, to configure the Settings module to store configurations in the internal flash memory?

best regards

Torsten

Parents
  • Hi Torsten,

    The settings related configs you have here look sensible. You should include CONFIG_FLASH_MAP, ans you can see that the same essential set of configs is used in the Bluetooth samples that support bonding.

    Is there a problem when you include this? If so, what is it (that the parition is placed on the external flash where you do not want it, or somehting else?). In addition to understanding what the problem is, it would be usefull to see your partition layout (both the generated as well as any static partitions you have configured.

    Br,

    Einar

  • Hi Einar,

    thanks for taking a look into my issue. The problem is, that the flash_map sources define a `IRQ_CONNECT` handler with the very same IRQ number, as my flash driver. While my flash driver actually uses the QSPI peripheral, the flash_map should not use the QSPI peripheral, as the Settings should be written to the internal flash memory of the nrf53.

    The concrete error message is: 

    gen_isr_tables.py: error: multiple registrations at table_index 43 for irq 43 (0x2b)
    Existing handler 0x4715, new handler 0x38897
    Has IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?
    

    With 43 from nrf5340_application.h:

      QSPI_IRQn                 =  43,              /*!< 43 QSPI                                                                   */
    

     

Reply
  • Hi Einar,

    thanks for taking a look into my issue. The problem is, that the flash_map sources define a `IRQ_CONNECT` handler with the very same IRQ number, as my flash driver. While my flash driver actually uses the QSPI peripheral, the flash_map should not use the QSPI peripheral, as the Settings should be written to the internal flash memory of the nrf53.

    The concrete error message is: 

    gen_isr_tables.py: error: multiple registrations at table_index 43 for irq 43 (0x2b)
    Existing handler 0x4715, new handler 0x38897
    Has IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?
    

    With 43 from nrf5340_application.h:

      QSPI_IRQn                 =  43,              /*!< 43 QSPI                                                                   */
    

     

Children
No Data
Related