Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BSEC2 v1.5.2400 RAM overflowed

    BSEC2 v1.5.2400 RAM overflowed

    vvs42
    Member

    The example "bme68x_demo_sample" does not compile.

    Out of RAM: "dram0_0_seg" overflowed by 9256 bytes.

    Each instance is allocated in memory: BSEC_INSTANCE_SIZE 3272

    There are two conflicting defines:

    NUM_OF_SENS 4

    NUM_BME68X_UNITS 8

    Where to specify the number of sensors, and where is multi instance? How to run this version at least on a standard board with 8 sensors? The new version is very demanding on memory and cannot be applied to a large number of sensors > 8.

    9 REPLIES 9

    After uploading the demo from the 1.4 BSEC2 library, the (latest) Android app now complains about missing bsec config, but it's on the sd card. 

    This thread suggests matching the right version of AI studio. I'm currently on the latest, but not sure how to get older versions from Bosch. 

    Do you happen to have the matching versions and wouldn't mind uploading here? 

    When exporting the config, you can select the version of the BSEC library:

    version.png

    I will attach demo configs for version 2200.

    BSTRobin
    Community Moderator
    Community Moderator

    Hi all,

    bme68x_demo_sample is the code implement of bme68x_demo_sample.ino.bin under folder "BME688_x8Board_v1.5.0\BME688_x8Board_v1.5.0".
    If you would like to run BSEC and get IAQ, CO2, estimate output, you should run the example code generic_examples https://github.com/boschsensortec/Bosch-BSEC2-Library/tree/master/examples/generic_examples

    Lorise
    Occasional Visitor

    It sounds like you're encountering a memory allocation issue with the bme68x_demo_sample due to conflicts in the number of sensor definitions and the physical memory limits of your board. Given the error message "dram0_0_seg overflowed by 9256 bytes" and the specifics you've mentioned, it looks like the application is trying to allocate more memory than is available on your ESP32 board.

    Here's how you can resolve this issue:

    1. Reduce the Number of Sensors: Since each sensor instance (BSEC_INSTANCE_SIZE) consumes 3272 bytes and your current settings are for 8 sensors, this significantly exceeds the default memory capacity of standard ESP32 boards like the ESP32-WROOM-32E(https://www.xecor.com/product/esp32-wroom-32e-n16). Adjust the NUM_BME68X_UNITS to a lower number that fits within the memory limits of your board. Start with the same number as NUM_OF_SENS (i.e., 4) to see if this resolves the memory overflow issue.

    2. Configuration and Compilation Settings: Ensure that the configuration in your development environment matches the physical setup and memory capabilities of your ESP32 board. Double-check that the settings in the SDK configuration (sdkconfig) file align with these requirements.

    3. Optimize Memory Usage: Look for opportunities to optimize the memory usage in your code. This might involve modifying how data is stored and managed or reducing the footprint of other parts of your application.

    4. Multi-instance Management: If you need to manage multiple sensor instances, make sure that your code correctly handles these instances within the memory constraints. This can be managed by dynamically allocating and deallocating memory as needed, rather than having all instances reside in memory simultaneously.

    5. Test on a Compatible Board: If reducing the number of sensors and optimizing the code does not resolve the issue, consider testing the application on a board with higher memory capacity or one that supports external memory.

    By carefully managing the memory and adjusting the number of sensor instances, you should be able to run your application successfully on standard ESP32 boards. If the application's memory demands continue to exceed what's available, you might need to consider either upgrading the hardware or further optimizing the software.

    To resolve the RAM overflow issue and run the BSEC2 library with multiple BME68x sensors on a standard board, you need to make a few adjustments to the configuration and code. Here's how you can proceed:

    1. Specify the number of sensors:
    - In the BSEC2 library, the number of sensors is defined by the `NUM_BME68X_UNITS` macro.
    - Ensure that `NUM_BME68X_UNITS` is set to the actual number of sensors you are using, which in your case is 8.
    - Remove or comment out the conflicting `NUM_OF_SENS` definition to avoid confusion.

    2. Adjust memory allocation:
    - The BSEC2 library allocates memory for each sensor instance using the `BSEC_INSTANCE_SIZE` macro.
    - With 8 sensors, the total memory required is `8 * BSEC_INSTANCE_SIZE`, which is causing the RAM overflow.
    - To accommodate more sensors, you may need to optimize memory usage in other parts of your code or consider using a board with more RAM.

    3. Enable multi-instance support:
    The BSEC2 library supports multi-instance functionality, allowing you to use multiple sensors simultaneously. Ensure that the multi-instance feature is properly enabled and configured in your code. You may need to modify the example code to handle multiple sensor instances correctly.

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist