Skip to main content
Associate III
April 26, 2024
Solved

Issue with Custom firmware and displaying different sensors on Unicleo-GUI

  • April 26, 2024
  • 17 replies
  • 6150 views

Hi everyone.

I'm trying to use a NUCLEO-F401RE, a X-NUCLEO-IKS02A1, and a STEVAL-MKI197v1 and the following software: v3.2.0.4544 AlgoBuilder, v1.25.1.11665 Unicleo-GUI, v1.15.0 STM32CubeIDE, v6.11.0 STM32CubeMX and the X-CUBE-ALGOBUILD and x-CUBE-MEMS1 software packages (everything running on windows 11).

 

First I didnt use AlgoBuider

I selected every sensor each board has on the x-cube-mems1 (package) and build it using CubeIDE (no error or warnings), but the Unicleo-GUI shows only the X-NUCLEO sensors, being unable to switch between (for example) the different Gyr/Acc sensors.

aesteban_0-1714118947233.png

If i dont select the board extension IKS02A1 CubeIDE gives no trouble (0 error and warnings) but the Unicleo-GUI doesnt recognice my board and i get stuck here:

aesteban_1-1714119311042.png

(note: If i select to list all coms it appears, but shows nothing and cannot start)

 

When I try to create a custom firmware for AlgoBuilder, if I select the Algo custom aplication option without the MEMS IKS board extension. I copy the project into the path /STMicroelectronics/AlgoBuilder/FirmwareTemplate but it doesnt show up on the AlgoBuilders Target display. and I cannot even choose the option of just the IKS02A1 alone as a template.

(Note: I downloaded an already made custom firmware for a different board as a test and it appears, so its the correct path)

 

Any help on both this problems would be so greatly appreciated,

thanks in advance

Best answer by Petr S

First problem was that your timers should be switched, TIMER2 have to support Capture Compare functionality and you have the timer with this functionality (TIM1) in TIMER1 (I understand that it was logical choice to use TIM1 as TIMER1 but...).

Second problem was that you need to implement the BSP_SENSOR_XXX_GetOrientation functions in custom_mems_control_ex.c file. Here is the example of implementation for LSM6DSO which is onboard on IKS01A3:


#if ((defined CUSTOM_ALGOBUILDER_FW_TEMPLATE) || (defined CUSTOM_DATALOGFUSION_DEMO) || (defined CUSTOM_TILTSENSING_DEMO) || (defined CUSTOM_GESTURERECOGNITION_DEMO) || (defined CUSTOM_CARRYPOSITION_DEMO) || (defined CUSTOM_ECOMPASS_DEMO) || (defined CUSTOM_DYNAMICINCLINOMETER_DEMO) || (defined CUSTOM_ACTIVITYRECOGNITION_DEMO) || (defined CUSTOM_ACTIVITYRECOGNITIONWRIST_DEMO) || (defined CUSTOM_FITNESSACTIVITIES_DEMO) || (defined CUSTOM_PEDOMETERWRIST_DEMO) || (defined CUSTOM_POSEESTIMATION_DEMO) || (defined CUSTOM_STANDINGSITTINGDESK_DEMO))
/**
  * @brief  Get accelerometer sensor orientation
  * @PAram  Orientation Pointer to sensor orientation
  * @retval None
  */
void BSP_SENSOR_ACC_GetOrientation(char *Orientation)
{
#if (defined BSP_MOTION_SENSORS || defined BSP_HYBRID_SENSORS)
#ifdef CUSTOM_ACC_INSTANCE_0
  Orientation[0] = 's';
  Orientation[1] = 'e';
  Orientation[2] = 'u';
#endif
#endif
}
#endif

#if ((defined CUSTOM_ALGOBUILDER_FW_TEMPLATE) || (defined CUSTOM_DATALOGFUSION_DEMO) || (defined CUSTOM_DYNAMICINCLINOMETER_DEMO) || (defined CUSTOM_FITNESSACTIVITIES_DEMO))
/**
  * @brief  Get gyroscope sensor orientation
  * @PAram  Orientation Pointer to sensor orientation
  * @retval None
  */
void BSP_SENSOR_GYR_GetOrientation(char *Orientation)
{
#if (defined BSP_MOTION_SENSORS)
#ifdef CUSTOM_GYR_INSTANCE_0
  Orientation[0] = 's';
  Orientation[1] = 'e';
  Orientation[2] = 'u';
#endif
#endif
}
#endif

#if ((defined CUSTOM_ALGOBUILDER_FW_TEMPLATE) || (defined CUSTOM_DATALOGFUSION_DEMO) || (defined CUSTOM_ECOMPASS_DEMO))
/**
  * @brief  Get magnetometer sensor orientation
  * @PAram  Orientation Pointer to sensor orientation
  * @retval None
  */
void BSP_SENSOR_MAG_GetOrientation(char *Orientation)
{
#if (defined BSP_MOTION_SENSORS)
#ifdef CUSTOM_MAG_INSTANCE_0
  Orientation[0] = 'n';
  Orientation[1] = 'e';
  Orientation[2] = 'u';
#endif
#endif
}
#endif

Attached is the functional ioc for CubeMX v6.11.0 and json for MEMS Studio v1.2.0

17 replies

aestebanAuthor
Associate III
May 17, 2024

Sorry for the late reply, the code compile and the custom firmware now shows up on the algobuilder, mems studio and unicleo (if uploaded to the board from STM32IDE), but there is a new issue.

 

I added the LSM6DSO sensor to the project to get the data from it, setting it to VDD and the LSM6DSOX to GND.

When I try to compile an AlgoBuilder project with the following configuration:

aesteban_0-1715944330583.png

it gives me this errors: 

aesteban_1-1715944365232.png

aesteban_2-1715944436401.png

I tried to use MEMS Studio and with the same input gives the error:

aesteban_3-1715944529946.png

 

I also tried switching the sensors (setting the ISK gyr to GND and de DIL to VDD) but keeps with the same issue.

Petr S
ST Employee
May 17, 2024

Have you updated capabilities.json/xml files to reflect your HW? Get the inspiration in example Projects in X-CUBE-ALGOBUILD package. Then you could try to migrate X-CUBE-ALGOBUILD to v1.4.0 in CubeMX before project generation (if not done already).

Petr S
ST Employee
May 17, 2024

 

PetrS_1-1715947821886.png

 

aestebanAuthor
Associate III
May 20, 2024

On Algobuilder if I use the "firmware_template" path the target does not appear, using "FirmwareTemplate" appears giving the previous error, if i add wrongly on purpose the capabilities it gives me the MEMS Studio error of not supported, and if i add it right gives the same error than before, so the capabilities on algobuilder are correct.

On the other side, using MEMS Studio with the custom firmware on the "firmware_template" path, if I manually add the custom capabilities, I can generate the C code but when building gives the same error shown on the last post.

aestebanAuthor
Associate III
May 20, 2024

I'm also trying an easier code, instead of "Sensor hub / Rotation Vector 6x / Graph" I tried "Sensor hub / Acceleration / Graph" and the code compiles, but when i execute it, it just takes one measurement equal to zero and nothing else.

Petr S
ST Employee
May 24, 2024

@aesteban it's hard to say without having it. Please share both your generated firmware template which you copied into the firmware_template MEMS Studio directory (including ioc) and also your complete AlgoBuilder project. 

aestebanAuthor
Associate III
May 24, 2024

Okay, I send you the debug project I used to isolate the issue and a .7z with the generated template.

I'm finally using Algobuilder instead of MEMS Studio due to the extra troubles MEMS Studio its giving me on things that AlgoBuilder has no issue.

Thanks

Petr S
Petr SBest answer
ST Employee
June 5, 2024

First problem was that your timers should be switched, TIMER2 have to support Capture Compare functionality and you have the timer with this functionality (TIM1) in TIMER1 (I understand that it was logical choice to use TIM1 as TIMER1 but...).

Second problem was that you need to implement the BSP_SENSOR_XXX_GetOrientation functions in custom_mems_control_ex.c file. Here is the example of implementation for LSM6DSO which is onboard on IKS01A3:


#if ((defined CUSTOM_ALGOBUILDER_FW_TEMPLATE) || (defined CUSTOM_DATALOGFUSION_DEMO) || (defined CUSTOM_TILTSENSING_DEMO) || (defined CUSTOM_GESTURERECOGNITION_DEMO) || (defined CUSTOM_CARRYPOSITION_DEMO) || (defined CUSTOM_ECOMPASS_DEMO) || (defined CUSTOM_DYNAMICINCLINOMETER_DEMO) || (defined CUSTOM_ACTIVITYRECOGNITION_DEMO) || (defined CUSTOM_ACTIVITYRECOGNITIONWRIST_DEMO) || (defined CUSTOM_FITNESSACTIVITIES_DEMO) || (defined CUSTOM_PEDOMETERWRIST_DEMO) || (defined CUSTOM_POSEESTIMATION_DEMO) || (defined CUSTOM_STANDINGSITTINGDESK_DEMO))
/**
  * @brief  Get accelerometer sensor orientation
  * @PAram  Orientation Pointer to sensor orientation
  * @retval None
  */
void BSP_SENSOR_ACC_GetOrientation(char *Orientation)
{
#if (defined BSP_MOTION_SENSORS || defined BSP_HYBRID_SENSORS)
#ifdef CUSTOM_ACC_INSTANCE_0
  Orientation[0] = 's';
  Orientation[1] = 'e';
  Orientation[2] = 'u';
#endif
#endif
}
#endif

#if ((defined CUSTOM_ALGOBUILDER_FW_TEMPLATE) || (defined CUSTOM_DATALOGFUSION_DEMO) || (defined CUSTOM_DYNAMICINCLINOMETER_DEMO) || (defined CUSTOM_FITNESSACTIVITIES_DEMO))
/**
  * @brief  Get gyroscope sensor orientation
  * @PAram  Orientation Pointer to sensor orientation
  * @retval None
  */
void BSP_SENSOR_GYR_GetOrientation(char *Orientation)
{
#if (defined BSP_MOTION_SENSORS)
#ifdef CUSTOM_GYR_INSTANCE_0
  Orientation[0] = 's';
  Orientation[1] = 'e';
  Orientation[2] = 'u';
#endif
#endif
}
#endif

#if ((defined CUSTOM_ALGOBUILDER_FW_TEMPLATE) || (defined CUSTOM_DATALOGFUSION_DEMO) || (defined CUSTOM_ECOMPASS_DEMO))
/**
  * @brief  Get magnetometer sensor orientation
  * @PAram  Orientation Pointer to sensor orientation
  * @retval None
  */
void BSP_SENSOR_MAG_GetOrientation(char *Orientation)
{
#if (defined BSP_MOTION_SENSORS)
#ifdef CUSTOM_MAG_INSTANCE_0
  Orientation[0] = 'n';
  Orientation[1] = 'e';
  Orientation[2] = 'u';
#endif
#endif
}
#endif

Attached is the functional ioc for CubeMX v6.11.0 and json for MEMS Studio v1.2.0
aestebanAuthor
Associate III
June 14, 2024

Switching the TIMs was the keypoint, the accelerometer, gyro and magnetometer give now the RAW data correctly, but the rotation block in MEMS Studio gives NaN measurements, what may be happening?

Petr S
ST Employee
June 14, 2024

If you didn't implement those GetOrientation functions correctly as stated above you're getting data from other than expected orientation and that's why the result is NAN - NotANumber. The code example I wrote you above is valid for IKS01A3 but if your sensor in your HW setup is oriented differently than LSM6DSO in IKS01A3/L476, your orientation "strings" have to be different.

aestebanAuthor
Associate III
June 18, 2024

Thanks, since I had two parallel project directories I didn't realized I updated the code only in one of them, it is now working