Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    bsec_init()初始化就进入hardfault中断

    bsec_init()初始化就进入hardfault中断

    szl
    New Poster

    运用bsec库中的bsec_iot_example.c文件中的return_values_init bsec_iot_init(float sample_rate, float temperature_offset, bme680_com_fptr_t bus_write,
    bme680_com_fptr_t bus_read, sleep_fct sleep, state_load_fct state_load, config_load_fct config_load)函数,通过加载测试函数会发现程序在bsec_init()函数会进入hardfault中断,不明白是什么原因,编译软件keil,编译器armcc,芯片stm32f103是m3的,加载通用库的m3中的.lib;后面还进行单独运用bme680_bsec_update_subscription函数,但是会返回-12状态,想问一下回事什么原因导致的

    4 REPLIES 4

    shellywang
    Occasional Contributor

    For -12 error,  when calling bme680_bsec_update_subscription, it means the sample_rate of the requested output (virtual) sensor passed to bsec_update_subscription() does not match with the sampling rate allowed for that sensor.

    As for hardfault when calling bsec_iot_init, developers shall make sure all the parameters are right, especially pay attention to the function pointers(related to the MCU platform). Our example bsec_iot_example.c is just reference, can not be directly used in different kind of MCU, developer need to modify it according to his own MCU platform.

    Below link explains hardfault:

    https://www.iar.com/support/tech-notes/debugger/debugging-a-hardfault-on-cortex-m/

     

    谢谢您的回复,关于初始化失败的问题已解决,通过调整尺寸大小就可以了,但是目前又遇到了新的问题,初始化成功后,第一次会得到第一次iaq值0x19,后面再很长冲突会一直得到0x19,时间间隔由长变短,直到数据发生变化,本以为已正常,没想到后面数值会变为0x00,并连续不再发生变化,不知道是什么原因?附件是iaq数据,最前面的3组0x00是初始化的数据,表示初始化正常

    paengpd
    Occasional Visitor

    How did you solved?

    I always get hardfault error in this fucntion.

    /* Initialize BSEC library */
    ret.bsec_status = bsec_init();

    BSTRobin
    Community Moderator
    Community Moderator

    Hi paengpd,

    Could we know some information first from you:
    1.What is about your host platform?
    2.Which program language you used?
    3.What outputs do you need to use from BSEC?

    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