10-17-2023 11:31 AM
Hello,
I ported the bme-680 and bsec library and using the bsec_integration.c on a erf32xg22 board with cortex m33. I managed it to get it working but I m having some issues with the local buffers in the function bsec_iot_init my code stops executing it goes into the default handler(infinte loop) when this buffers are local.
uint8_t bsec_state[BSEC_MAX_STATE_BLOB_SIZE] = {0};
uint8_t bsec_config[BSEC_MAX_PROPERTY_BLOB_SIZE] = {0};
uint8_t work_buffer[BSEC_MAX_WORKBUFFER_SIZE] = {0};
But If I dynamicaly alocate them or move them as global static variables it works.
I want also to implement the state_load and state_save functions writing to internal flash. And yet again I m having issues with the buffers when it needs to call the function state_save it just stops working. If I increase the bsec_state buffer size it goes through, but then I can not load the state.
What could cause this issues?
What are the sizes for BSEC_MAX_STATE_BLOB_SIZE,BSEC_MAX_PROPERTY_BLOB_SIZE,BSEC_MAX_WORKBUFFER_SIZE?
Regards, suad
10-17-2023 11:58 AM
Hi suads,
If you don't want to modify variables to global variables, you can increase the stack size of the system in your compiler. In my MDK-ARM Keil project, I can modify the stack size in *. s.
; Amount of memory (in bytes) allocated for Stack
; Tailor this value to your application needs
; <h> Stack Configuration
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
Stack_Size EQU 0x8000
BSEC_MAX_STATE_BLOB_SIZE,BSEC_MAX_PROPERTY_BLOB_SIZE,BSEC_MAX_WORKBUFFER_SIZE were defined in the file bsec_datatypes.h.
What version of BSEC do you use? What output values do you need from BSEC for your application?
10-17-2023 02:30 PM
Hi, @BSTRobin
I'm using the latest version 2.4.0.0 and using the normal_version/bin/gcc/Cortex_M33 static library libalgobsec.a and using the Simplicity studio version 5 from Silicon labs.
10-17-2023 04:23 PM
10-19-2023 07:01 PM
Hi, @BSTRobin
It was an issue on my side. I increased the stack size also there was a Bug when writing to the flash, the size of the buffer needs to be aligned by 4, so when writing to the internal flash bsec_state with len =221 it just froze even the debugger was not working, and I was not sure what was hapenning.
And I was so sure that my flash read and write was working, because the way I tested I used a buffer of the size 4096(aligned by 4) wrote on an address and read it and it was always good.
Thanks, regards Suad