2020-10-14 01:49 AM
Hi,
I'm working on lsm6dsox imu for machine learning application. MCL configs worked well on the Unico GUI. Then i passed CubeMx, made requried configurations, took the updated libraries from github(https://github.com/STMicroelectronics/STMems_Standard_C_drivers/tree/master/lsm6dsox_STdC/driver), took the example application from https://github.com/STMicroelectronics/STMems_Standard_C_drivers/blob/master/lsm6dsox_STdC/example/lsm6dsox_mlc.c but mlc feature didn't work. All the other features worked well( read_data_poling, free_fall exc.)
What was that case, where is the problem?
Thanks.
2020-10-14 08:46 AM
Hi @TKCK.1 ,
the MLC configuration on the LSM6DSOX requires some more steps compared to the other digital feature.
For this reason, I suggest you to check the already available examples in the firmware function packs, for example the FP-SNS-STBOX1.
You can refer to the BLEMLC application in the folder: \Projects\STM32L4R9ZI-SensorTile.box\Applications\BLEMLC
Here, the Example application initializes all the Components, Loading the program on MLC and outputting the LSM6DSOX MLC results for Activity Recognition (Default) or Vibration Monitoring, and moreover initializes the Library creating some Custom Bluetooth services (since the target application is the SensorTile.box tool driven by smartphone BLE app)
Please take care of the inc files lsm6dsox_activity_recognition_for_mobile.h and lsm6dsox_vibration_monitoring.h, where the MLC configuration is reported, and where they are invoked in the code.
-Eleon
2020-10-16 02:42 AM
Hi @Eleon BORLINI
Thanks for attention. I tried the examples that you suggest but it doesn't work. I have a steval-mki109v3 main board and a steval-mki197v1 module. I opened \Projects\STM32L4R9ZI-SensorTile.box\Applications\BLEMLC example and encountered that sceenelsm6dsox_all_sources_t struct doesn't include mlc_status variable. How is it possible? On the other hand all the other code configuration and invoking is the same with https://github.com/STMicroelectronics/STMems_Standard_C_drivers/blob/master/lsm6dsox_STdC/example/lsm6dsox_mlc.c .I'm stucked.
2020-10-16 03:33 AM
Hi @TKCK.1 ,
I may have misunderstood the point, sorry... you wrote that the "MCL configs worked well on the Unico GUI. Then i passed CubeMx". The steval-mki109v3 main board works with Unico GUI but it is not (well) configurable with the CubeMX tool, more suitable for the X-Nucleo board family. The fact is that the ProfiMEMS is not designed for general purpose projects, but only for evaluation.
Did you configured the steval-mki109v3 with CubeMX? If so, could you please share the source code of your app?
Thanks,
-Eleon
2020-10-16 04:03 AM
Hi @Eleon BORLINI (ST Employee)
I configured the steval-mki109v3 with CubeMX and ı can read the acc and gyro values well (with https://github.com/STMicroelectronics/STMems_Standard_C_drivers/blob/master/lsm6dsox_STdC/example/lsm6dsox_read_data_polling.c ). But mlc application doesn't work. The main.c file is in below.
2020-10-16 05:07 AM
Hi @TKCK.1 ,
I see you are using functions like this one:
static int32_t lsm6ds3_i2c_transmit(void *handle, uint8_t reg_to_read, uint8_t* buff, uint16_t len)
Just for my better understanding, is it a reused function or the "lsm6ds3" is a typo and should be "lsm6dsox"?
-Eleon
2020-10-16 05:48 AM
Hi @Eleon BORLINI
Yes, "lsm6dsox" can be fine but it doesn't affect working of function, it is just a private name.
We can think like that https://github.com/STMicroelectronics/STMems_Standard_C_drivers/blob/master/lsm6dsox_STdC/example/lsm6dsox_read_data_polling.c example. I just converted.
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
uint16_t len)
{
if (handle == &hi2c1)
{
HAL_I2C_Mem_Read(handle, LSM6DSOX_I2C_ADD_L, reg,
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
}
#ifdef STEVAL_MKI109V3
else if (handle == &hspi2)
{
/* Read command */
reg |= 0x80;
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
HAL_SPI_Transmit(handle, ®, 1, 1000);
HAL_SPI_Receive(handle, bufp, len, 1000);
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
}
#endif
return 0;
}
2020-10-16 08:30 AM
Hi @TKCK.1 ,
to get in more detail, which MLC example are you running? The one configured by the lsm6dsox_vibration_monitoring.h?
Could you please add this inc file too (or share if you have customized it), where the instruction for the MLC are reported?
The configuration is the code snippet below:
/* Start Machine Learning Core configuration */
for ( i = 0; i < (sizeof(lsm6dsox_vibration_monitoring) /
sizeof(ucf_line_t) ); i++ ){
lsm6dsox_write_reg(&dev_ctx, lsm6dsox_vibration_monitoring[i].address,
(uint8_t*)&lsm6dsox_vibration_monitoring[i].data, 1);
}
/* End Machine Learning Core configuration */
And you are not getting the MLC output from this function, right?
lsm6dsox_mlc_out_get(&dev_ctx, mlc_out);
sprintf((char*)tx_buffer, "Detect MLC interrupt code: %02X\r\n",
mlc_out[0]);
-Eleon
2020-10-16 09:25 AM
Hi @Eleon BORLINI
First time i made lots of datasets from Unico Gui for our industrial product and converted to the .h file. And i followed the steps but it didn't get outputs. Then i thought first i should be understand how to works this MLC progress. So i tried https://github.com/STMicroelectronics/STMems_Standard_C_drivers/blob/master/lsm6dsox_STdC/example/lsm6dsox_mlc.c and i realized that the problem was different.
Now at this mention i'm using
https://github.com/STMicroelectronics/STMems_Machine_Learning_Core/blob/master/application_examples/lsm6dsox/Vibration%20monitoring/lsm6dsox_vibration_monitoring.h for lsm6dsox_vibration_monitoring.h, no customization. I coppied the lsm6dsox_vibration_monitoring.h file to the
C:\....\Core\Inc.
Yes, I can't getting output from that function.
2020-10-19 02:08 AM
Hi @TKCK.1 ,
So you setup two projects, and I have some questions for you on both of them:
-Eleon