cancel
Showing results for 
Search instead for 
Did you mean: 

How do you use the .ucf file generated by the UNICO GUI and why do the outputs seem to make no sense, comparing it to the register description found in the data sheet?

KWern.1
Associate II

I am working with the Sensortile.Box right now. More specifically, I want to configure the pedometer function with the MLC to work with certain configurations. The accelerometer has to be set to 16g Full Scale, because of a fall-detection functionality in our project. So we can not use examples, which are mostly configured for 2 or 4g.

I am working with the Unico GUI in offline mode, I have no motherboard to connect the box.

After getting some sample patterns and feeding them to the regression tool, a ucf was generated, which I then converted to c code and put it into my firmware using the STM32CubeIDE.

Heres the Problem: The ucf is, if I interpret it correctly, just a list of register addresses and the value to be written there. But if you look into the data sheet and try to understand, what is happening, it seems, that there are some entries, that do not make any sense.

For example, like you can see in the picture, access to the embedded functions is enabled, then page 1 is selected trough the PAGE_SEL register.

After that, adresses like C8h are given to the PAGE_ADDRESS register, which do not exist on page 1 of the advanced embedded registers.

So, do I interpret the process wrong, or why do the values make no sense?

Further, is there a simple way to load the ucf into the Box, without UNICO GUI in online mode?

I think my Problem is very similar to this one, but since there are no official answers, I am asking again myself.

I would be thankful for a quick answer,

Thanks and with kind regards,

K. Werner.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @KWern.1​ ,

Let me just add a comment to Vladimir's answer.

The meaning of this MLC registers are not explained in the available documentation; not so great to say it, but they are basically meaningless in the sense that they define branches and nodes of the configuration tree obtained -for example- with Weka tool, so at a high level they have no physical meaning, but only computational one.

-Eleon

View solution in original post

6 REPLIES 6
KWern.1
Associate II

I forgot to add the generated header, here it is: 0693W00000D1tB3QAJ.png

Vladimir JANOUSEK
ST Employee

Hello,

I think it is clear from the code you shared that from the .ucf file it is also possible to convert this sequence of values to a header file (.h) to be imported in any C project (e.g. driver, firmware, etc.): Unico allows .h file generation (from .ucf files) through the "C code generation" dedicated tool in the "Options" tab of the Unico main window. An example of using the generated .h file in a standard C driver is available in https://github.com/STMicroelectronics/STMems_Standard_C_drivers/blob/master/lsm6dsox_STdC/examples/lsm6dsox_mlc.c

As you can imagine the generated decision tree is a set of register configurations which is then written inside the right registers of DSOX following the sequence in the .h file.

Further, is there a simple way to load the ucf into the Box, without UNICO GUI in online mode?

--> yes, you can use EXPERT mode of sensortile.box with its default fmw and by creating New App and selecting MLC virtual sensor as input, you can then see realtime classification in the phone screen, attached one pdf. Further please have a look here https://github.com/STMicroelectronics/STMems_Machine_Learning_Core/tree/master/configuration_examples , there are several configuration examples done for different combinations of tools with very good description in the readme file.

I hope this can help

Rgds Vladimir

KWern.1
Associate II

Hello there,

first of all: Thanks for the reply and effort.

I will try to use the expert mode to configure my MLC soon, this hint was very helpful.

Unfortunately, the first part of my question, which is the most important part, is still unanswered.

I am aware, that you are able to generate the c header through Unico GUI, and how to implement it using a for loop, just like in the example.

My problem is, that the register addresses and values make no sense, when you try to manually understand what is happening inside the registers.

It seems, like there are values to be written in directions, which do not exist.

Maybe just try to use the data sheet and look, what happens, if you follow the above header sequence (fist step is write 80h to address 01h, which enables the cfg registers, second is, write 40h into address 17h to set the page write option and so on...).

I am not speaking of wrong settings, but completely wrong entries, mostly into the embedded advanced register and PAGE_ADDRESS register.

I commented that into the above file, everything else was generated by the software.

We need to write our own firmware in the end, so it is important, that we understand exactly, what happens there.

Thanks and best regards,

K. Werner.

Hi @KWern.1​ ,

Let me just add a comment to Vladimir's answer.

The meaning of this MLC registers are not explained in the available documentation; not so great to say it, but they are basically meaningless in the sense that they define branches and nodes of the configuration tree obtained -for example- with Weka tool, so at a high level they have no physical meaning, but only computational one.

-Eleon

Hi there,

okay, so, the ucf file is not meant for the standard LSM6DSOX registers, but describes something different?

I guess I have to look deeper in the example for the generated c header to evaluate the situation.

I will not have the time today, but I will review this tomorrow.

Thanks for the answer.

Best regards,

K. Werner.

I think I get it now. The Registers exist and make sense, but they are not listed in the documentation.

That helps a lot, thanks. I think I will flag your answer as the best, because that explained my main question.

Much thanks,

K. Werner