Hi,
I am trying to learn the I2c with nrf5340 PDK. I need to interface Sht20 and Mlx90614 with nrf5340PDK. I need to know the procedures regards this on NRF Connect SDK
Thanks & Regards
Navin
Hi,
I am trying to learn the I2c with nrf5340 PDK. I need to interface Sht20 and Mlx90614 with nrf5340PDK. I need to know the procedures regards this on NRF Connect SDK
Thanks & Regards
Navin
Hello Navin,
To start with, I would recommend you have a look at the sensor samples in Zephyr.
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.5.0/zephyr/samples/sensor/sensor.html
The BME280 sample uses the I2C interface, for instance. You can find it in ../ncs/zephyr/samples/sensor/bme280.
It might be necessary for you to add the drivers of those sensors to your Zephyr repository.
I hope this will help you! Let me know if you have any more questions.
Regards,
Markus
Hi Markus,
I have analyzed the BME280 sample for I2C. I didn't get clear understandings. I can't able to see sensor drivers every sensor has a separate register address for different processes right? In this case, How can I implement my sensor's driver with the project and How can I overwrite this sample to work on my Sht20?
Is there is any material is available? Kindly suggest for me.
Thanks & Regards
Navin
Since the Sht20 is not part of the Zephyr repository, you have to add its drivers first before you can use them with your application.
I would recommend you check out this case. Since it is based on version 1.3.0 of the NCS you might have to adjust some things, but the principals should be the same.
I hope this will help you!
Regards,
Markus
Hi Markus,
Thank you very much your post is very helpful. Now I need to know what is the below error says
Thanks & Regards
Navin
Hi Markus,
I have cleared all those errors. And my device can found. But I can't able to read values from my device
/* * Copyright (c) 2012-2014 Wind River Systems, Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr.h> #include <device.h> #include <drivers/i2c.h> #include <stdio.h> #include "sht20.h" const struct device *i2c_dev; void main(void) { float hum,temp; i2c_dev = device_get_binding("I2C_1"); if (i2c_dev == NULL) { printk("No device found; did initialization fail?\n"); return; } else { printk("Found device \n"); } while (1) { hum = GetHumidity(); temp = GetTemperature(); printf("Temperature is %.2f\n",temp); printf("Humidity is %.2f\n", hum); k_sleep(K_MSEC(1000)); } }
I have attached here, My main.c file, Can you please check and give me a suggestions
Thanks & Regards
Navin