<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How to fully configure i2c sensor working with NCS bluetooth?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69514/how-to-fully-configure-i2c-sensor-working-with-ncs-bluetooth</link><description>We are in the process to add spectral sensor to zephyr based BLE sample, but following the tutorial to add overlay or copying other sensor configurations not helped much. Either it causes device tree error or some configuration error or label not registered</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 16 Feb 2021 16:14:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69514/how-to-fully-configure-i2c-sensor-working-with-ncs-bluetooth" /><item><title>RE: How to fully configure i2c sensor working with NCS bluetooth?</title><link>https://devzone.nordicsemi.com/thread/294687?ContentTypeID=1</link><pubDate>Tue, 16 Feb 2021 16:14:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7468b10d-1609-43df-b390-5b7529edaeaf</guid><dc:creator>Hakon</dc:creator><description>[quote user="new"]Arduino reads the same address with length 6 and gets different value from register and it is changing but nrf52840 gets different value and unchanging. (I have used i2c1 in board overlay)[/quote]
&lt;p&gt;&amp;nbsp;Can you use a logic analyzer to check the data that is being sent and received in both cases? Check the SDA and SCL pins.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to fully configure i2c sensor working with NCS bluetooth?</title><link>https://devzone.nordicsemi.com/thread/294263?ContentTypeID=1</link><pubDate>Sat, 13 Feb 2021 06:54:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c904d647-6eba-46ca-881c-84710344e371</guid><dc:creator>new</dc:creator><description>&lt;p&gt;&lt;span&gt;I modified example BME280 with bmp388 configurations and at the end even I forcefully written required pwr, odr and osr values. Attaching the .c and .h files. I am sorry for not maintaining readable script. Very much haphazard.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/bme280.c"&gt;devzone.nordicsemi.com/.../bme280.c&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/bme280.h"&gt;devzone.nordicsemi.com/.../bme280.h&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to fully configure i2c sensor working with NCS bluetooth?</title><link>https://devzone.nordicsemi.com/thread/294261?ContentTypeID=1</link><pubDate>Sat, 13 Feb 2021 06:47:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0103a081-d286-4e9e-936f-9375151405b7</guid><dc:creator>new</dc:creator><description>&lt;p&gt;&lt;span&gt;I am using NRF52840- zephyr (i2c_burst_read) and BMP388 sensor using I2C. I am successfully able to setup register enabling required feature and able to read the sensor data from I2C. However, the data read from data register doesn&amp;#39;t change. The hexadecimal value read from arduino with same sensor board is completely different from that read in nrf52840 over i2c. Please help me know if I am missing ay fundamental understanding reading data value over i2c. I am reading register 0x04 with Length 6. Arduino reads the same address with length 6 and gets different value from register and it is changing but nrf52840 gets different value and unchanging. (I have used i2c1 in board overlay)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to fully configure i2c sensor working with NCS bluetooth?</title><link>https://devzone.nordicsemi.com/thread/291266?ContentTypeID=1</link><pubDate>Tue, 26 Jan 2021 12:49:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce20d42e-5d4a-4593-963a-281c69b03610</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;For a start, you can try changing i2c0 to either i2c1 or i2c2. There are conflicting memory addresses between &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf5340%2Fchapters%2Fmemory%2Fappmem.html&amp;amp;anchor=instantiation"&gt;i2c0 and uart0&lt;/a&gt;, so you should use a different i2c peripheral instance.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to fully configure i2c sensor working with NCS bluetooth?</title><link>https://devzone.nordicsemi.com/thread/286537?ContentTypeID=1</link><pubDate>Thu, 24 Dec 2020 06:19:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0e4f9bc-05ed-40f1-a994-cdb8d1a6ed46</guid><dc:creator>new</dc:creator><description>&lt;p&gt;Also, how to configure any GPIO PIN as INPUT or OUTPUT with Zephyr.&lt;/p&gt;
&lt;p&gt;device_get_bindig(&amp;#39;GPIO_0&amp;#39;) is successful, but gpio_pin_configure(dev,20,GPIO_OUTPUT_ACTIVE/GPIO_OUTPUT_LOW/GPIO_OUTPUT) and gpio_pin_set(dev,20,1) is not working.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am trying to set pin number 20 in NRF52840. But it is not working. I am unable to find any&amp;nbsp;suitable example to fix this issue. Please help out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to fully configure i2c sensor working with NCS bluetooth?</title><link>https://devzone.nordicsemi.com/thread/286535?ContentTypeID=1</link><pubDate>Thu, 24 Dec 2020 05:04:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ec82a07-36e9-4ed7-9bf3-91e3d9d15b9f</guid><dc:creator>new</dc:creator><description>&lt;p&gt;I tried all possibilities modifying;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;DTS-&amp;gt;Bindings, Devicetree.h, drivers, overlay, board.dts, but no progress in adding adxl345 sensor to custom 52840 board nor BMI160 to NRF52840 development kit.&lt;/p&gt;
&lt;p&gt;device_get_binding(DT_LABEL(DT_INST(0,adi_adxl345) is always NULL and DT_NODE_HAS_STATUS(ADXL345,okay) is always NULL.&lt;/p&gt;
&lt;p&gt;Driver-&amp;gt;adxl345-&amp;gt;cmake&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2555.CMakeLists.txt"&gt;devzone.nordicsemi.com/.../2555.CMakeLists.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Driver -&amp;gt; adxl_345.c&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/adxl345.c"&gt;devzone.nordicsemi.com/.../adxl345.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Drivers-&amp;gt;adxl345-&amp;gt;Kconfig&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;# ADXL345, 3-Axis, +/-16g Digital Accelerometer

# Copyright (c) 2020 Antmicro &amp;lt;www.antmicro.com&amp;gt;
# SPDX-License-Identifier: Apache-2.0
config ADXL345
	bool &amp;quot;ADXL345 Three Axis I2C accelerometer&amp;quot;
	depends on I2C
	help
	  Enable driver for ADXL345 Three-Axis Digital Accelerometer.
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;2. ncs-&amp;gt;nrf-&amp;gt;samples-&amp;gt;bluetooth-&amp;gt;mesh-&amp;gt;adxl345-&amp;gt;&lt;/p&gt;
&lt;p&gt;nrf52840dk_nrf52840.overlay overlay file:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*
 * Copyright (c) 2020, Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: Apache-2.0
 */

&amp;amp;i2c0 {
	compatible = &amp;quot;nordic,nrf-twim&amp;quot;;
	status = &amp;quot;okay&amp;quot;;
	sda-pin = &amp;lt;17&amp;gt;;
	scl-pin = &amp;lt;13&amp;gt;;
	clock-frequency = &amp;lt;I2C_BITRATE_FAST&amp;gt;;
	adxl345@53 {
		compatible = &amp;quot;adi,adxl345&amp;quot;;
		label = &amp;quot;ADXL345&amp;quot;;
		reg = &amp;lt;0x53&amp;gt;;
		status = &amp;quot;okay&amp;quot;;
	};
};


&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2555.CMakeLists.txt"&gt;devzone.nordicsemi.com/.../2555.CMakeLists.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;sample.yaml&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;sample:
  name: adxl345 sample
  description: ADXL345 accelerometer sample application
tests:
  sample.sensor.adxl345:
    harness: sensor
    tags: sensors
    depends_on: i2c
    platform_allow: nrf52840dk_nrf52840
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Proj.conf&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_STDOUT_CONSOLE=y
CONFIG_I2C=y
CONFIG_SENSOR=y
CONFIG_ADXL345=y

CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_LOG_BACKEND_UART=y
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=n
CONFIG_PRINTK=y
CONFIG_CONSOLE=y


&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;main.c&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*
 * Copyright (c) 2019 Brett Witherspoon
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;device.h&amp;gt;
#include &amp;lt;drivers/sensor.h&amp;gt;
#include &amp;lt;drivers/gpio.h&amp;gt;
#include &amp;lt;drivers/i2c.h&amp;gt;
K_SEM_DEFINE(sem, 0, 1);
#define adxl_sdo 20
#define adxl_cs  15
static void trigger_handler(const struct device *dev,
			    struct sensor_trigger *trig)
{
	switch (trig-&amp;gt;type) {
	case SENSOR_TRIG_DATA_READY:
		if (sensor_sample_fetch(dev) &amp;lt; 0) {
			printf(&amp;quot;Sample fetch error\n&amp;quot;);
			return;
		}
		k_sem_give(&amp;amp;sem);
		break;
	case SENSOR_TRIG_THRESHOLD:
		printf(&amp;quot;Threshold trigger\n&amp;quot;);
		break;
	default:
		printf(&amp;quot;Unknown trigger\n&amp;quot;);
	}
}
const struct device *gpio_dev;
void i2c_init(){
  gpio_pin_configure(gpio_dev,adxl_sdo,GPIO_PULL_DOWN);
  gpio_pin_configure(gpio_dev,adxl_cs,GPIO_PULL_DOWN);
  gpio_pin_set(gpio_dev,adxl_sdo,0);
  gpio_pin_set(gpio_dev,adxl_cs,1);

}
void main(void)
{
	struct sensor_value accel[3];
        if(DT_NODE_HAS_STATUS(ADXL345,okay)){
        printf(&amp;quot;Device found\n&amp;quot;);
        }
	const struct device *dev = device_get_binding(DT_LABEL(DT_INST(0, adi_adxl345)));
	if (dev == NULL) {
		printf(&amp;quot;Device get binding device\n&amp;quot;);
		return;
	}

	while (true) {

			if (sensor_sample_fetch(dev) &amp;lt; 0) {
				printf(&amp;quot;Sample fetch error\n&amp;quot;);
				return;
			}


		if (sensor_channel_get(dev, SENSOR_CHAN_ACCEL_X, &amp;amp;accel[0]) &amp;lt; 0) {
			printf(&amp;quot;Channel get error\n&amp;quot;);
			return;
		}

		if (sensor_channel_get(dev, SENSOR_CHAN_ACCEL_Y, &amp;amp;accel[1]) &amp;lt; 0) {
			printf(&amp;quot;Channel get error\n&amp;quot;);
			return;
		}

		if (sensor_channel_get(dev, SENSOR_CHAN_ACCEL_Z, &amp;amp;accel[2]) &amp;lt; 0) {
			printf(&amp;quot;Channel get error\n&amp;quot;);
			return;
		}

		printf(&amp;quot;x: %.1f, y: %.1f, z: %.1f (m/s^2)\n&amp;quot;,
		       sensor_value_to_double(&amp;amp;accel[0]),
		       sensor_value_to_double(&amp;amp;accel[1]),
		       sensor_value_to_double(&amp;amp;accel[2]));
	}
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Above is my project configuration files.&lt;/p&gt;
&lt;p&gt;I am trying to read ADXL345 accelerometer value from NRF52840 custom board. The device is not getting detected. Similar configuration I have used for BMI160 with NRF52840 development kit but there also device binding is NULL.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Please help me find the missing modifications for getting the sensor working.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to fully configure i2c sensor working with NCS bluetooth?</title><link>https://devzone.nordicsemi.com/thread/286205?ContentTypeID=1</link><pubDate>Tue, 22 Dec 2020 06:08:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:586c83e5-cf78-4fa7-8586-9114de040a2e</guid><dc:creator>new</dc:creator><description>&lt;p&gt;I tried using BME680 to build BMI160 sensor support for NRF5340. Whatever overlay name such as NRF5340PDK/DK_NRF5340_CPUAPP/NS I try the BOSCH_BMI160 not declared error repeats.&lt;/p&gt;
&lt;p&gt;I have modified files for BMI160 said following :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1. &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/65900/change-sda-and-scl-pin-for-i2c1-on-nrf5340"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/65900/change-sda-and-scl-pin-for-i2c1-on-nrf5340&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;2.&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/66230/how-to-add-new-i2c-based-sensor-device-to-ncs-v1-3-0-zephyr-drivers-sensor"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/66230/how-to-add-new-i2c-based-sensor-device-to-ncs-v1-3-0-zephyr-drivers-sensor&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But it throws error : DT_N_INST_)_BOSCH_BMI160_P_LABEL undeclared in expansion of macro &amp;#39;UTIL_CAT&amp;#39;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;How to bypass I2C SCK with custom generated clock frequency (greater than 1 MHz) from GPIO to read sensor values?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to fully configure i2c sensor working with NCS bluetooth?</title><link>https://devzone.nordicsemi.com/thread/285810?ContentTypeID=1</link><pubDate>Fri, 18 Dec 2020 11:27:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83e22a91-9916-4dcb-a2f3-e10336851686</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;the most useful guide is probably the Zephyr &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/dts/index.html"&gt;devicetree guide&lt;/a&gt;. It would also be helpful if you could post the overlay file and tell what you are doing, to identify the issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>