AnsweredAssumed Answered

ARHS algorithm problem

Question asked by engine_ on Jul 25, 2014
Latest reply on May 20, 2015 by bystedt.kjell
Hello everyone,

I am using iNEMO with AHRS algorithm provided by ST. I have noticed that there is a problem about function pointers initialization. These function pointers are used to point the  AHRS algorithm (whose code is not provided by ST). In particular, three instructions are used to execute this algorithm: 

1) // Init the all AHRS parameters
     iNEMO_AHRS_Init(&xSensorData, &xEulerAngles, &xQuat);

2) //update
    iNEMO_AHRS_Update(&xSensorData, &xEulerAngles, &xQuat);

3) // Deallocate memory
    iNEMO_AHRS_DeInit(&xSensorData, &xEulerAngles, &xQuat);

These function pointers are pointing to a part of FLASH memory, but RAM reservation is also required to allocate something used by the algorithm. In fact one has to use the following instructions: 

volatile uint8_t  pcDummyAHRSReserved[AHRS_RESERVED_RAM_SIZE] @AHRS_RESERVED_RAM_START_ADDR;

pcDummyAHRSReserved[0] = 0;

as specified in an ST sample program. But this doesn't work, and I suppose this is beacuse there are problems with memory allocation. Could anyone help me? What should I specify to execute my program correctly? Thank you in advance!

Outcomes