cancel
Showing results for 
Search instead for 
Did you mean: 

IMU sensors with DatalogTerminal not working properly

aesteban
Associate III

Hi, im using the nucleo F401RE with the X-NUCLEO IKS01A3 and the Steval MKI197v1, i used CubeMX to insert the x-mems1 library, the aplication DataLogTerminal and only selected the LSM6DSOX sensor (steval).

I set the LSM6DSOX's SA0 pin to GND to prevent address conflicts, the I2C to Fast Speed Mode and ran the code generated on STM32CubeIDE.

When first launched it worked nice, but as i unplug the board and plug it back again it wont work anymore. Not even after compiling it again.

The only way i found to make it work again is to upload a different code on the nucleo and after that, upload the troublesome code.

 

Any advice on this? I attack the .ioc below.

 

Thanks in advance.

8 REPLIES 8
Andrew Neil
Evangelist III

@aesteban wrote:

as i unplug the board and plug it back again it wont work anymore. .


You've mentioned three boards:

  1. Nucleo F401RE
  2. X-NUCLEO IKS01A3
  3. Steval MKI197v1

So which one(s) are you plugging & unplugging?

 

Im conecting the MKI through the IKS's DIL24 and the IKS on the nucleo's Arduino pins, and im unpluging the nucleo-pc cable

So you're unplugging the USB cable from the built-in ST-Link on the Nucleo board ?

AndrewNeil_0-1720022535806.png

 

So long as you don't do that during programming, that shouldn't be a problem.

Probably not a good idea to do it during a debug session.

 

Yes, I unplug that one. 

I do not unplug it during the actual debugging, The issue I found is that, if I compile and run the program first time there is no problem, but if I finish, unplug the nucleo, and return to it later on, it won't work anymore.

That's the way I found out that the code I made works only the first time I compile it onto the board, unless I compile a different one and compile this one back

Sorry for the late reply, after some debugging I can explain myself better.

If I turn on the board with the code already in, the code debug will go through the initial code: from main.c to app_mems.c through "MX_MEMS_Init();", it gets inside "MX_DataLogTerminal_Init();" prints on the terminal this section.

 

  snprintf(dataOut, MAX_BUF_SIZE, "\r\n__________________________________________________________________________\r\n");
  printf("%s", dataOut);

 

But when it gets into the line.

 

CUSTOM_MOTION_SENSOR_GetCapabilities(i, &MotionCapabilities[i]);

 

the code gets inside this section

 

else if (MotionDrv[Instance]->GetCapabilities(MotionCompObj[Instance], Capabilities) != BSP_ERROR_NONE)
  {
    ret = BSP_ERROR_UNKNOWN_COMPONENT;
  }

 

then, it leaves and goes into the infinite loop.

 

void HardFault_Handler(void)
{
  /* USER CODE BEGIN HardFault_IRQn 0 */

  /* USER CODE END HardFault_IRQn 0 */
  while (1)
  {
    /* USER CODE BEGIN W1_HardFault_IRQn 0 */
    /* USER CODE END W1_HardFault_IRQn 0 */
  }
}

 

 So, when fresh compiled, the code works giving this output:

Working.png

But after that, it will only display this:

NotWorking.png

aesteban
Associate III

Ironically enough, the fault analisis display no faults... While i'm on the HardFault_Handler

aesteban_0-1720422126115.png

I don't really know what to do about this issue as I ran the same program but with other sensors and they doesn't show this problem, I have another Steval MKI197v1 just to check that it wasn't a sensor related issue.

If (for example) i use the IKS sensors only, they work without an issue so i think it might be a library issue?