cancel
Showing results for 
Search instead for 
Did you mean: 

using the Motion DI Library and getting hard fault at No source available for "quatErr2EulerErr() at 0x800671c"

MSing.3
Associate

Hi, have successfully used the library before on an L476, needed more processing power so porting the project to an F746, however, there is a hard fault when using the motion_DI library. breaking the fault don the error message is No source available for "quatErr2EulerErr() at 0x800671c" 

the library is initialising, but not running in the main loop,

I have increased the stack sizes as well as changed processors. I have also started a new project from scratch and it is still not working. I am using Library version 1.1.0 on x-cube MEMS 1

2 REPLIES 2
Eleon BORLINI
ST Employee

Hi @MSing.3​ ,

Right, the example in the X-CUBE-MEMS1 package refer to L0, L1, L4 and F4,, but I have just checked internally and the Motion DI Library operation on Cortex M7 platform looks working smoothly.

Could you please share your source code, so that we can control it step by step?

If it is sensitive / confidential, you can share it in the Message section of the Community (top right of this page).

-Eleon

MSing.3
Associate

HI, @Eleon BORLINI​ 

Have just messaged you, The code is not complete, as I want the motion_DI working first,

another question, what is the recommended stack and heap size for the library. and what is the max frequency I can run the algorithm at, I need the rotation angles in the quickest amount of time.

I have also gone back to previous versions with no luck.

#include "main.h"
#include <stdio.h>
#include <string.h>
 
#include "imu_Data.h"
#include "iim_Protective.h"
 
#include "motion_di.h"
#include "motion_di_manager.h"
 
#include "stm32f7xx_hal.h"
#include "stm32f7xx_hal_conf.h"
#include "stm32f7xx_hal_gpio.h"
 
/* Private define ------------------------------------------------------------*/
extern TIM_HandleTypeDef htim2;
#define BSP_IP_TIM_Handle htim2
#define BSP_IP_TIM_Init MX_TIM2_Init
 
#define DWT_LAR_KEY  0xC5ACCE55 /* DWT register unlock key */
#define ALGO_FREQ  500U /* Algorithm frequency 100Hz */
#define ACC_ODR  ((float)ALGO_FREQ)
#define ACC_FS  2 /* FS = <-2g, 2g> */
#define ALGO_PERIOD  (1000000U / ALGO_FREQ) /* Algorithm period [us] */
#define FROM_MG_TO_G  0.001f
#define FROM_G_TO_MG  1000.0f
#define FROM_MDPS_TO_DPS  0.001f
#define FROM_DPS_TO_MDPS  1000.0f
#define FROM_MGAUSS_TO_UT50  (0.1f/50.0f)
#define FROM_UT50_TO_MGAUSS  500.0f
/* Public variables ----------------------------------------------------------*/
volatile uint8_t DataLoggerActive = 0;
volatile uint32_t SensorsEnabled = 0;
char LibVersion[35];
int LibVersionLen;
volatile uint8_t SensorReadRequest = 0;
 
uint32_t AlgoFreq = ALGO_FREQ;
MDI_cal_type_t AccCalMode = MDI_CAL_CONTINUOUS;
MDI_cal_type_t GyrCalMode = MDI_CAL_CONTINUOUS;
 
static accel_data_t AccValue;
static gyro_data_t GyrValue;
 
/* Private variables ---------------------------------------------------------*/
 
//static int64_t Timestamp = 0;
static void TIM_Config(uint32_t Freq);
 
void imuInit(void) {
 
	/* Initialize Timer */
	//BSP_IP_TIM_Init();
	/* Configure Timer to run with desired algorithm frequency */
	//TIM_Config(ALGO_FREQ);
	iim42652_init(gy_fs_250dps, odr_1000_hz, ac_fs_4g, odr_1000_hz);
 
	whoami_iim42652();
 
	MotionDI_manager_init((int) ALGO_FREQ);
 
	MotionDI_manager_get_version(LibVersion, &LibVersionLen); // library is initialised correctly as the lib-version string is correct.
 
	DWT_Init();
 
}
 
uint32_t dataReadTime = 0;
uint16_t DATA_READ_DELAY = 500;
 
void imuData(void) {
 
	//if (HAL_GetTick() - dataReadTime > DATA_READ_DELAY) {
	//	dataReadTime = HAL_GetTick();
 
		uint32_t elapsed_time_us = 0U;
		MDI_input_t data_in;
		MDI_output_t data_out;
		MDI_cal_type_t acc_cal_mode;
		MDI_cal_type_t gyro_cal_mode;
		MDI_cal_output_t acc_cal;
		MDI_cal_output_t gyro_cal;
 
		/* read Gyro and import into FX */
		read_gyro(&GyrValue, unit_dps);
		data_in.Gyro[0] = (float) GyrValue.x;
		data_in.Gyro[1] = (float) GyrValue.y;
		data_in.Gyro[2] = (float) GyrValue.z;
 
		/* read Acc and import into FX  */
		read_accel(&AccValue, unit_g);
		data_in.Acc[0] = (float) AccValue.x;
		data_in.Acc[1] = (float) AccValue.y;
		data_in.Acc[2] = (float) AccValue.z;
 
		MotionDI_manager_run(&data_in, &data_out); // fine until here fails on first go.
	//}
 
//    //Check_Cal();
//
 
//
//    // gyro calibration
//
//    //Acc Calibration
//
//    // dynamic inclanometer
//
//    // data ot gor debugging (comment out)
 
}