Adding LIS3DH Sensor to nRF5340DK Machine Learning

So to quickly summarize my issue, I am trying to implement the LIS3DH accelerometer. Even though it builds and flashes I am not able to send data like I can with the simulated sensor. I'm hoping someone can tell me if I am setting up the configuration wrong or if the method I use to implement it can be improved.

This is the documentation I have been reading and trying to follow so far. I have modified the 3 things. The Kconfig file named "prj.conf", the device tree overall named "app.overlay", and a sensor config file named "sensor_manager_def.h". Here are pictures of the changes I made:
Kconfig:

Device Tree

Sensor Config:

After I build and flash this code I see that the LED 1(application state) blinks showing it's not sending data. For the code with the simulated sensor, I would press and hold button 1 to switch modes, but I find that the inputs are not received. This causes the device to eventually go into sleep mode like it is designed. The rest of the code I don't have screenshots for should be the same as the base example code built for the "nrf5340dk_nrf5340_cpuapp", but please let me know if you'd like screenshots of anything to help me better.

Parents
  • Hello,

    I went through the files you shared. In the overlay, the compatible string for your overlay was set to "st,lis2dh" for the LIS3DH sensor. However, I think it should be compatible = "st,lis3dh";. I verified this by checking the Zephyr repository. See this link.




    Have you initialized the sensor properly in your code? I couldn't find that in the shared code. Please refer to this guide for reference.

    I recommend adding some logs to confirm whether the I2C communication is happening or not. This will help troubleshoot the issue more easily. Verify that the I2C pin configuration is correct and matches your hardware setup. The pinctrl settings seem fine, but ensure that the pins used in i2c1_default are indeed the correct ones for your interface.

    Kind Regards,

    Abhijith

Reply
  • Hello,

    I went through the files you shared. In the overlay, the compatible string for your overlay was set to "st,lis2dh" for the LIS3DH sensor. However, I think it should be compatible = "st,lis3dh";. I verified this by checking the Zephyr repository. See this link.




    Have you initialized the sensor properly in your code? I couldn't find that in the shared code. Please refer to this guide for reference.

    I recommend adding some logs to confirm whether the I2C communication is happening or not. This will help troubleshoot the issue more easily. Verify that the I2C pin configuration is correct and matches your hardware setup. The pinctrl settings seem fine, but ensure that the pins used in i2c1_default are indeed the correct ones for your interface.

    Kind Regards,

    Abhijith

Children
No Data
Related