cancel
Showing results for 
Search instead for 
Did you mean: 

Interface the MKI197V1 with Nucleo-L011K4. Not knowing how to proceed?

TSchi.2269
Associate III

I wanted to initialise the LSM6DSOX on the L011K4. I've generated code through CubeMX and Set the SPI pins for it. However, I don't know how to proceed further, since I don't find any ways to port code from the MKSBOX1V1 to the current project. Are there any clear examples on how to set up a connection between the two? Thanks in advance!

5 REPLIES 5
Eleon BORLINI
ST Employee

Hi @TSchi.2269​ , the first steps are OK, to go further you could take as example the X-CUBE-MEMS1 function pack, which contains examples for a couple of NUCLEO L0 boards. The MKSBOX1V1 examples run on the STM32L4 MCU family, and it is not so simple to take code samples from that firmware function pack... Which is your target application? Regards

My target application is the Nucleo32-L011K4 with the preferred functionality of interrupt detection by loading in a custom configuration (.h file) on the MLC. I found an example at https://github.com/STMicroelectronics/STMems_Standard_C_drivers/tree/master/lsm6dsox_STdC, but I'm not able to get that up and running with the given drivers. Also, CubeMX does not change the main.c file to init the MEMS, while I have added them in CubeMX as additional software AND set them SPI-mode and given them a CS GPIO Output pin.

For the initialization code of the LSM6DSOX in the main.c and in general for the integration of the related libraries you should refer to the examples in the existing function packs. BTW, are you able to read data from the LSM6DSOX in your current configuration? Regards

Now doing a step back and indeed firstly trying to just reach it over SPI, without the rest. Do you maybe have links to the fuction packs and documentation? I find it hard to search for them on the ST site. Thanks for your hard work, stay safe and stay healthy!

Allright, I've come even further now. However, I get stuck at the following parts:

While I am making the LSM6DSOX_Object_t, I have to add a LSM6DSOX_IO_t and stmdev_ctx_t. However, I do not know how to specify them. As handle, I can just pass my own SPI handle, but I do not know what/how to specify as stmdev_write_ptr and stmdev_read_ptr of the code:

typedef struct {
  /** Component mandatory fields **/
  stmdev_write_ptr  write_reg;
  stmdev_read_ptr   read_reg;
  /** Customizable optional pointer **/
  void *handle;
} stmdev_ctx_t;

Can you help me by pointing out what those read and write registers have to be? How do I make these or how do I initialise them? Thanks in advance!