Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

External real-time clock

Hi all,

It appears that support for external RTC timekeeping in deep sleep mode is finally supported in the esp-idf; it can be set up using menuconfig.
So: a., is the version of the esp-idf in the latest build of mongoose recent enough to support this feature and b., how do I access the relevant build variables to enable it?

Any help, or even just guidance to what would need to be done to get this up and running, would be much appreciated. Happy to share my findings with others that may be interested.

Comments

  • SergeySergey Dublin, Ireland

    SDK config could be altered via the build_vars section in mos.yml file

    https://mongoose-os.com/docs/overview/apps.html#build_vars

  • JeanLouisJeanLouis Canada
    edited October 6

    build_vars seem to be ignored in mos.yml file. I have tried adding ESP_IDF_SDKCONFIG_OPTS: "${build_vars.ESP_IDF_SDKCONFIG_OPTS} CONFIG_BROWNOUT_DET=" but it does not get implemented in the generated SDKCONFIG file. Is there another setting somewhere that needs to be changed for ESP_IDF_SDKCONFIG_OPTS to be implemented when the firmware is built?

  • GregRGregR USA
    edited October 6

    Working here. This is a snippet of build/gen/sdkconfig before adding build_vars:

    CONFIG_TASK_WDT_PANIC=y
    CONFIG_TASK_WDT_TIMEOUT_S=5
    CONFIG_TASK_WDT_CHECK_IDLE_TASK=y
    CONFIG_BROWNOUT_DET=y
    CONFIG_BROWNOUT_DET_LVL_SEL_0=y
    CONFIG_BROWNOUT_DET_LVL_SEL_1=
    CONFIG_BROWNOUT_DET_LVL_SEL_2=
    CONFIG_BROWNOUT_DET_LVL_SEL_3=
    CONFIG_BROWNOUT_DET_LVL_SEL_4=
    CONFIG_BROWNOUT_DET_LVL_SEL_5=
    CONFIG_BROWNOUT_DET_LVL_SEL_6=
    CONFIG_BROWNOUT_DET_LVL_SEL_7=
    CONFIG_BROWNOUT_DET_LVL=0
    CONFIG_ESP32_TIME_SYSCALL_USE_RTC=
    

    Then add to mos.yml like this:

    platform: esp32
    author: mongoose-os
    description: A Mongoose OS app skeleton
    version: 1.0
    
    libs_version: ${mos.version}
    modules_version: ${mos.version}
    mongoose_os_version: ${mos.version}
    
    # Optional. List of tags for online search.
    tags:
      - c
    
    # List of files / directories with C sources. No slashes at the end of dir names.
    sources:
      - src
    
    # List of dirs. Files from these dirs will be copied to the device filesystem
    filesystem:
      - fs
    
    build_vars:
      ESP_IDF_SDKCONFIG_OPTS: "${build_vars.ESP_IDF_SDKCONFIG_OPTS} CONFIG_BROWNOUT_DET="
    

    Rebuild. Now same section of sdkconfig:

    CONFIG_TASK_WDT_PANIC=y
    CONFIG_TASK_WDT_TIMEOUT_S=5
    CONFIG_TASK_WDT_CHECK_IDLE_TASK=y
    CONFIG_BROWNOUT_DET=
    CONFIG_ESP32_TIME_SYSCALL_USE_RTC=

    I am building in mongoose.cloud using Ubuntu 16.04 and my version of mos is:

    The Mongoose OS command line tool
    Version: 1.18
    Build ID: 1.18+f1e3dd6~xenial0
    Update channel: release
    

    Regards,
    Greg

    Thanked by 1Sergey
  • JeanLouisJeanLouis Canada
    edited October 6

    What you described is very different behaviour from what I am observing. My SDKCONFIG has CONFIG_BROWNOUT_DET=y, then after I add build_vars:
    ESP_IDF_SDKCONFIG_OPTS: "${build_vars.ESP_IDF_SDKCONFIG_OPTS} CONFIG_BROWNOUT_DET=" to my mos.yml file and rebuild the firmware, my SDKCONFIG still has CONFIG_BROWNOUT_DET=y.

    I am building using MacOS 10.13 with version Mongoose OS command line tool, v. 20171001-163638/1.18@4bbec4b4+.
    Update channel: "release". Checking updates... Up to date.

    Is there a setting or configuration somewhere that needs to be adjusted to enable the behaviour you are seeing? What you are seeing on your system is exactly what I am trying to achieve on mine: to be able to change SDKCONFIG settings using build_vars in my mos.yml file.

  • I've got a laptop with Ubuntu which I use on the go, and I easily reproduced what I reported above using a "bare app".
    What I suggest is to create a "bare app" and see if you can reproduce:

    mos init --arch=esp32

    mos build

    and then look at build/gen/sdkconfig

    Then update mos.yml:

    build_vars:
    ESP_IDF_SDKCONFIG_OPTS: "${build_vars.ESP_IDF_SDKCONFIG_OPTS} CONFIG_BROWNOUT_DET="

    mos build

    Then again examine build/gen/sdkconfig

    I did not change anything else besides mos.yml.

  • JeanLouisJeanLouis Canada
    edited October 6

    SOLVED: For the benefit of anyone else that this may help, it came down to a syntax detail (an extra blank space).

    This does NOT work (no blank spaces before "ESP_IDF_SDKCONFIG...):
    build_vars:
    ESP_IDF_SDKCONFIG_OPTS: "${build_vars.ESP_IDF_SDKCONFIG_OPTS} CONFIG_BROWNOUT_DET="

    This does NOT work (two blank spaces before "ESP_IDF_SDKCONFIG...):
    build_vars:
    ESP_IDF_SDKCONFIG_OPTS: "${build_vars.ESP_IDF_SDKCONFIG_OPTS} CONFIG_BROWNOUT_DET="

    This DOES work (one blank space before "ESP_IDF_SDKCONFIG...):
    build_vars:
    ESP_IDF_SDKCONFIG_OPTS: "${build_vars.ESP_IDF_SDKCONFIG_OPTS} CONFIG_BROWNOUT_DET="

    So, the solution is to follow the syntax above EXACTLY with one, and ONLY ONE, blank space at the beginning, one blank space after ":" and one blank space after "}". No other spaces.

    I hope this helps anyone else that was getting as frustrated as I was with this issue.

  • GregRGregR USA
    edited October 6

    Hi JeanLouis-

    At least from Chromium, your examples all look the same. I think the whitespace is being removed.
    I think what you need to do is to surround the code using the toolbar above.
    Paste the code, and then highlight the code, and then select code from the menu pick above.
    It looks like the usual symbol for paragraph. This will cause the code to be posted verbatim.

    Regards,
    Greg

  • Thanks Greg. Let's see if this formats correctly...

    SOLVED: For the benefit of anyone else that this may help, it came down to a syntax detail (an extra blank space).

    This does NOT work (no blank spaces before "ESP_IDF_SDKCONFIG...):

    build_vars:
    ESP_IDF_SDKCONFIG_OPTS: "${build_vars.ESP_IDF_SDKCONFIG_OPTS} CONFIG_BROWNOUT_DET="

    This does NOT work (two blank spaces before "ESP_IDF_SDKCONFIG...):

    build_vars:
      ESP_IDF_SDKCONFIG_OPTS: "${build_vars.ESP_IDF_SDKCONFIG_OPTS} CONFIG_BROWNOUT_DET="

    This DOES work (one blank space before "ESP_IDF_SDKCONFIG...):

    build_vars:
     ESP_IDF_SDKCONFIG_OPTS: "${build_vars.ESP_IDF_SDKCONFIG_OPTS} CONFIG_BROWNOUT_DET="

    So, the solution is to follow the syntax above EXACTLY with one, and ONLY ONE, blank space at the beginning, one blank space after ":" and one blank space after "}". No other spaces.

    I hope this helps anyone else that was getting as frustrated as I was with this issue.

    Thanked by 1sh4nnongoh
Sign In or Register to comment.