<?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>CST816S input driver i2c failed to read</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/120747/cst816s-input-driver-i2c-failed-to-read</link><description>I have problem with i2c that can&amp;#39;t read the cst816s, its always return log message `&amp;lt;err&amp;gt; cst816s: failed reading chip id` and `&amp;lt;err&amp;gt; cst816s: Could not read x data` when touched. i&amp;#39;m using the nRF52832. is there any configuration i need to do? 
 the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 27 May 2025 03:53:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/120747/cst816s-input-driver-i2c-failed-to-read" /><item><title>RE: CST816S input driver i2c failed to read</title><link>https://devzone.nordicsemi.com/thread/537029?ContentTypeID=1</link><pubDate>Tue, 27 May 2025 03:53:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c0b895f-7473-46b5-8228-a605af5964cb</guid><dc:creator>nanangcreacoll</dc:creator><description>&lt;p&gt;That config is deprecated, set this in device tree:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;uicr {
	nfct-pins-as-gpios;
};&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CST816S input driver i2c failed to read</title><link>https://devzone.nordicsemi.com/thread/536215?ContentTypeID=1</link><pubDate>Tue, 20 May 2025 12:52:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77dc8338-41f0-4629-9545-3ab2d00345fb</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Try to set CONFIG_NFCT_PINS_AS_GPIOS=y.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CST816S input driver i2c failed to read</title><link>https://devzone.nordicsemi.com/thread/535433?ContentTypeID=1</link><pubDate>Thu, 15 May 2025 02:19:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0336eee0-014a-46cf-9ce3-64a43d6a23a5</guid><dc:creator>nanangcreacoll</dc:creator><description>&lt;p&gt;Still nothing on the I2C output, just a low signal on reset in I2C.&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/reset-nrf-i2c.png" /&gt;&lt;/p&gt;
&lt;p&gt;There may be something with the PCF8574 firmware (with other platforms) that triggers I2C on the nRF, I don&amp;#39;t know about that yet.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CST816S input driver i2c failed to read</title><link>https://devzone.nordicsemi.com/thread/533853?ContentTypeID=1</link><pubDate>Mon, 05 May 2025 07:17:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:674892c4-270d-4cc3-bd6b-ec4e649202e0</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hm, if the pins works but I2C does not do anything, I am getting out of ideas here.&lt;/p&gt;
&lt;p&gt;From your trace below, you get nothing on I2C. That is odd, as the nRF should send something.&lt;br /&gt;Perhaps it is just going to fast, and the oscilloscope does not pick up the signal if it is not repeated?&lt;/p&gt;
&lt;p&gt;Can you try to look at the I2C lines again, and then make them log for a longer time. Then reset the device multople times, and see if you can see some initial I2C communication. Do you still see nothing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CST816S input driver i2c failed to read</title><link>https://devzone.nordicsemi.com/thread/533852?ContentTypeID=1</link><pubDate>Mon, 05 May 2025 07:09:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e53329a8-c19c-4dee-8217-79d3bb1f4ceb</guid><dc:creator>nanangcreacoll</dc:creator><description>&lt;p&gt;I have tried the blinky sample for the SCL and SDA pins (GPIO 9 and 10) and it works. As for other pins for LCD display such as SPI, backlight, and Interrupt, all work fine. It can run the display and provide log message output for interrupts.&lt;/p&gt;
&lt;p&gt;blinky sample code:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/*
 * Copyright (c) 2016 Intel Corporation
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/drivers/gpio.h&amp;gt;

/* 1000 msec = 1 sec */
#define SLEEP_TIME_MS   1000

/* The devicetree node identifier for the &amp;quot;led0&amp;quot; alias. */
#define LED0_NODE DT_ALIAS(led0)
#define LED1_NODE DT_ALIAS(led1)

/*
 * A build error on this line means your board is unsupported.
 * See the sample documentation for information on how to fix this.
 */
static const struct gpio_dt_spec led0 = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
static const struct gpio_dt_spec led1 = GPIO_DT_SPEC_GET(LED1_NODE, gpios);

int main(void)
{
	int ret;
	bool led_state = true;

	if (!gpio_is_ready_dt(&amp;amp;led0)) {
		return 0;
	}
	if (!gpio_is_ready_dt(&amp;amp;led1)) {
		return 0;
	}

	ret = gpio_pin_configure_dt(&amp;amp;led0, GPIO_OUTPUT_ACTIVE);
	if (ret &amp;lt; 0) {
		return 0;
	}
	ret = gpio_pin_configure_dt(&amp;amp;led1, GPIO_OUTPUT_ACTIVE);
	if (ret &amp;lt; 0) {
		return 0;
	}

	while (1) {
		ret = gpio_pin_toggle_dt(&amp;amp;led0);
		if (ret &amp;lt; 0) {
			return 0;
		}
		ret = gpio_pin_toggle_dt(&amp;amp;led1);
		if (ret &amp;lt; 0) {
			return 0;
		}

		led_state = !led_state;
		printf(&amp;quot;LED state: %s\n&amp;quot;, led_state ? &amp;quot;ON&amp;quot; : &amp;quot;OFF&amp;quot;);
		k_msleep(SLEEP_TIME_MS);
	}
	return 0;
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;overlay file:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;/ {
    aliases {
        led0 = &amp;amp;led0;
        led1 = &amp;amp;led1;
    };

    leds {
        compatible = &amp;quot;gpio-leds&amp;quot;;
        led0: led0 {
            label = &amp;quot;LED0&amp;quot;;
            gpios = &amp;lt;&amp;amp;gpio0 9 GPIO_ACTIVE_LOW&amp;gt;;
        };
        led1: led1 {
            label = &amp;quot;LED1&amp;quot;;
            gpios = &amp;lt;&amp;amp;gpio0 10 GPIO_ACTIVE_LOW&amp;gt;;
        };
    };
};&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CST816S input driver i2c failed to read</title><link>https://devzone.nordicsemi.com/thread/533844?ContentTypeID=1</link><pubDate>Mon, 05 May 2025 06:05:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0365c46-1b98-4e66-9425-2557c3c93343</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Thanks for the clarifications, I edited them into the summary.&lt;/p&gt;
&lt;p&gt;Let us focus on Test 1 for now. Can you try to use the blinky sample to &amp;quot;blink&amp;quot; on the pins that you use for the LCD display? This is a good way to see if you can control those pins at all from the MCU.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CST816S input driver i2c failed to read</title><link>https://devzone.nordicsemi.com/thread/533836?ContentTypeID=1</link><pubDate>Mon, 05 May 2025 02:50:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afae3a98-2fba-4a25-8d4d-dea9fbae97e4</guid><dc:creator>nanangcreacoll</dc:creator><description>&lt;p&gt;In test 1 and test 2, the sensor location is on&amp;nbsp;LCD display which is connected by wire via a socket to nRF custom board. In test 3, it uses the nRF custom board, but the software was in another framework. In test 4, yes, it will work if done right after test 3.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CST816S input driver i2c failed to read</title><link>https://devzone.nordicsemi.com/thread/533734?ContentTypeID=1</link><pubDate>Fri, 02 May 2025 10:29:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afef6fa4-4837-46c9-aa8d-83982c25aeda</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Let me try to summarize this ticket, to get an overview. Could you go over and then correct me anywhere I am wrong? I put a question mark after the ones I am unsure of.&lt;br /&gt;You have tested two different sensors over I2C, and here are the results:&lt;/p&gt;
&lt;p&gt;EDITED: based on later answers.&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:150%;"&gt;&lt;strong&gt;CST816S&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;SDK version: v2.7.0&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Test 1:&lt;/strong&gt;&lt;br /&gt;Board: nRF52 custom board&lt;br /&gt;Sensor location: Wired LCD connected to nRF52 custom board&lt;br /&gt;Software: Zephyr code&lt;br /&gt;Result: Nothing on I2C lines&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Test 2:&lt;/strong&gt;&lt;br /&gt;Board: nRF52 custom board?&lt;br /&gt;Sensor location: Wired LCD connected to nRF52 custom board&lt;br /&gt;Software: third party code&lt;br /&gt;Result: I2C works&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:150%;"&gt;&lt;strong&gt;PCF8574&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;SDK version: v2.7.0&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Test 3:&lt;br /&gt;&lt;/strong&gt;Board: nRF52 custom board&lt;br /&gt;Sensor location: External board&lt;br /&gt;Software: third party code&lt;br /&gt;Result: I2C works&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Test 4:&lt;/strong&gt;&lt;br /&gt;Board: nRF52 custom board&lt;br /&gt;Sensor location: External board&lt;br /&gt;Software: Zephyr code&lt;br /&gt;Result: Nothing on I2C lines&lt;br /&gt;Comment: Will work if done right after Test 3&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CST816S input driver i2c failed to read</title><link>https://devzone.nordicsemi.com/thread/532973?ContentTypeID=1</link><pubDate>Fri, 25 Apr 2025 08:30:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3978c63-d35c-4827-989a-fc524bcb7e9e</guid><dc:creator>nanangcreacoll</dc:creator><description>&lt;p&gt;When I tried with PCF8574, I actually tried it first with another platform to read and write to PCF8574 (it can read and write), then back to zephyr and it works. If I try directly with zephyr, it can&amp;#39;t read and write to PCF8574.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CST816S input driver i2c failed to read</title><link>https://devzone.nordicsemi.com/thread/532961?ContentTypeID=1</link><pubDate>Fri, 25 Apr 2025 07:07:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19a1c802-3595-4afd-87c2-605b8476d3b6</guid><dc:creator>nanangcreacoll</dc:creator><description>&lt;p&gt;I use this board, connect the touch screen with the socket on the board.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/68747470733a2f2f64726976652e676f6f676c652e636f6d2f7468756d626e61696c3f69643d314a50425f5464674b4547674930346e4e3969624d6b35324a665149476533765826737a3d77333531.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have a PCF8574 GPIO Expander that I am using to try out I2C, it can read and write to the PCF8574.&lt;br /&gt;&lt;br /&gt;Main code with PCF8574:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/device.h&amp;gt;
#include &amp;lt;zephyr/devicetree.h&amp;gt;
#include &amp;lt;zephyr/drivers/i2c.h&amp;gt;

#define LOG_LEVEL LOG_LEVEL_DBG
#include &amp;lt;zephyr/logging/log.h&amp;gt;
LOG_MODULE_REGISTER(app, LOG_LEVEL);

#define PCF8574_NODE DT_NODELABEL(pcf8574)

int main(void)
{
        const struct i2c_dt_spec pcf8574 = I2C_DT_SPEC_GET(PCF8574_NODE);
        if (!i2c_is_ready_dt(&amp;amp;pcf8574))
        {
                LOG_ERR(&amp;quot;I2C device not ready&amp;quot;);
                return -ENODEV;
        }

        int ret;
        uint8_t data = 0;
        
        ret = i2c_read_dt(&amp;amp;pcf8574, &amp;amp;data, sizeof(data));
        if (ret &amp;lt; 0)
        {
                LOG_ERR(&amp;quot;Failed to read data: %d&amp;quot;, ret);
                return ret;
        }
        LOG_DBG(&amp;quot;Initial data read: 0x%02X&amp;quot;, data);

        while(1)
        {
                uint8_t read_data;
                
                ret = i2c_write_read_dt(&amp;amp;pcf8574, &amp;amp;data, sizeof(data), &amp;amp;read_data, sizeof(read_data));
                if (ret &amp;lt; 0)
                {
                        LOG_ERR(&amp;quot;Failed to write/read data: %d&amp;quot;, ret);
                }
                LOG_DBG(&amp;quot;Wrote data: 0x%02X, Read data: 0x%02X&amp;quot;, data, read_data);

                if (data == 0)
                {
                        data = 1;
                }
                else if (data &amp;amp; 0x80)
                {
                        data = 0;
                }
                else
                {
                        data &amp;lt;&amp;lt;= 1;
                }
                
                k_msleep(1000);
        }
        return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Output log:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;** Booting nRF Connect SDK v2.7.0-5cb85570ca43 ***
*** Using Zephyr OS v3.6.99-100befc70c74 ***
[00:00:00.391,174] &amp;lt;dbg&amp;gt; app: main: Initial data read: 0xFF
[00:00:00.391,387] &amp;lt;dbg&amp;gt; app: main: Wrote data: 0xFF, Read data: 0xFF
[00:00:01.391,632] &amp;lt;dbg&amp;gt; app: main: Wrote data: 0x00, Read data: 0x00
[00:00:02.391,967] &amp;lt;dbg&amp;gt; app: main: Wrote data: 0x01, Read data: 0x01
[00:00:03.392,303] &amp;lt;dbg&amp;gt; app: main: Wrote data: 0x02, Read data: 0x02
[00:00:04.392,639] &amp;lt;dbg&amp;gt; app: main: Wrote data: 0x04, Read data: 0x04
[00:00:05.392,974] &amp;lt;dbg&amp;gt; app: main: Wrote data: 0x08, Read data: 0x08
[00:00:06.393,310] &amp;lt;dbg&amp;gt; app: main: Wrote data: 0x10, Read data: 0x10
[00:00:07.393,646] &amp;lt;dbg&amp;gt; app: main: Wrote data: 0x20, Read data: 0x20
[00:00:08.393,981] &amp;lt;dbg&amp;gt; app: main: Wrote data: 0x40, Read data: 0x40
[00:00:09.394,317] &amp;lt;dbg&amp;gt; app: main: Wrote data: 0x80, Read data: 0x80&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Is there a possible problem with the board? I&amp;#39;ve used it with other platforms and it works fine.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CST816S input driver i2c failed to read</title><link>https://devzone.nordicsemi.com/thread/532893?ContentTypeID=1</link><pubDate>Thu, 24 Apr 2025 16:44:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f2460d0-da06-437e-b414-70c7db6f7dca</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>[quote user="nanangcreacoll"] I try directly using I2C to initialize CST816S. I try to make my own device tree binding for CST816S. I still don&amp;#39;t know which part I should fix, I2C still can&amp;#39;t read the chip. RST and IRQ gpio work fine.[/quote]
&lt;p&gt;Alright, then we have tried two different ways to read the CST816S over I2C.&lt;/p&gt;
&lt;p&gt;At this point, I think it would be a good idea to look at the hardware.&lt;/p&gt;
&lt;p&gt;How do you connect the CST to the nRF?&lt;br /&gt;Do you have another I2C device that you can try to read with the nRF, to verify that the I2C code work?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CST816S input driver i2c failed to read</title><link>https://devzone.nordicsemi.com/thread/532520?ContentTypeID=1</link><pubDate>Wed, 23 Apr 2025 07:49:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e31945d-b87a-4db6-95c2-166023c966df</guid><dc:creator>nanangcreacoll</dc:creator><description>&lt;p&gt;Here I try directly using I2C to initialize CST816S. I try to make my own device tree binding for CST816S. I still don&amp;#39;t know which part I should fix, I2C still can&amp;#39;t read the chip. RST and IRQ gpio work fine.&lt;/p&gt;
&lt;p&gt;overlay file:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;i2c1 {
	cst816s: cst816s@15 {
		compatible = &amp;quot;cst816s&amp;quot;;
		status = &amp;quot;okay&amp;quot;;
		reg = &amp;lt;0x15&amp;gt;;
		irq-gpios = &amp;lt;&amp;amp;gpio0 26 GPIO_ACTIVE_LOW&amp;gt;;
		rst-gpios = &amp;lt;&amp;amp;gpio0 21 GPIO_ACTIVE_LOW&amp;gt;;
	};
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;main code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/device.h&amp;gt;
#include &amp;lt;zephyr/devicetree.h&amp;gt;
#include &amp;lt;zephyr/drivers/gpio.h&amp;gt;
#include &amp;lt;zephyr/drivers/i2c.h&amp;gt;

#define LOG_LEVEL LOG_LEVEL_DBG
#include &amp;lt;zephyr/logging/log.h&amp;gt;
LOG_MODULE_REGISTER(app, LOG_LEVEL);

#define CST816S_NODE DT_NODELABEL(cst816s)

#define CST816S_I2C_ADDR 0x15
#define CST816S_I2C_CHIP_ID_REG 0xA7

struct cst816s_data
{
        const struct i2c_dt_spec *i2c;
        struct k_work work;
        struct gpio_callback irq_gpio_cb;
};

static int cst816s_reset(const struct gpio_dt_spec *rst_gpio)
{
        LOG_DBG(&amp;quot;CST816S Reset&amp;quot;);

        int ret;

        if (!gpio_is_ready_dt(rst_gpio))
        {
                LOG_ERR(&amp;quot;RST GPIO not ready&amp;quot;);
                return -ENODEV;
        }

        ret = gpio_pin_configure_dt(rst_gpio, GPIO_OUTPUT);
        if (ret &amp;lt; 0)
        {
                LOG_ERR(&amp;quot;Failed to configure RST GPIO: %d&amp;quot;, ret);
                return ret;
        }
        
        ret = gpio_pin_set_dt(rst_gpio, 1);
        if (ret &amp;lt; 0)
        {
                LOG_ERR(&amp;quot;Failed to set RST GPIO: %d&amp;quot;, ret);
                return ret;
        }
        k_msleep(5);
        ret = gpio_pin_set_dt(rst_gpio, 0);
        if (ret &amp;lt; 0)
        {
                LOG_ERR(&amp;quot;Failed to set RST GPIO: %d&amp;quot;, ret);
                return ret;
        }
        k_msleep(50);

        return 0;
}

static void cst816s_irq_handler(const struct device *dev, struct gpio_callback *cb, uint32_t pins)
{
        struct cst816s_data *data = CONTAINER_OF(cb, struct cst816s_data, irq_gpio_cb);

        k_work_submit(&amp;amp;data-&amp;gt;work);
}

static int cst816s_irq_init(const struct gpio_dt_spec *irq_gpio, struct gpio_callback *irq_gpio_cb)
{
        LOG_DBG(&amp;quot;CST816S IRQ Initialization&amp;quot;);

        int ret;

        if (!gpio_is_ready_dt(irq_gpio))
        {
                LOG_ERR(&amp;quot;IRQ GPIO not ready&amp;quot;);
                return -ENODEV;
        }

        ret = gpio_pin_configure_dt(irq_gpio, GPIO_INPUT);
        if (ret &amp;lt; 0)
        {
                LOG_ERR(&amp;quot;Failed to configure IRQ GPIO: %d&amp;quot;, ret);
                return ret;
        }

        ret = gpio_pin_interrupt_configure_dt(irq_gpio, GPIO_INT_EDGE_TO_ACTIVE);
        if (ret &amp;lt; 0)
        {
                LOG_ERR(&amp;quot;Failed to configure IRQ GPIO interrupt: %d&amp;quot;, ret);
                return ret;
        }

        gpio_init_callback(irq_gpio_cb, cst816s_irq_handler, BIT(irq_gpio-&amp;gt;pin));
        ret = gpio_add_callback(irq_gpio-&amp;gt;port, irq_gpio_cb);
        if (ret &amp;lt; 0)
        {
                LOG_ERR(&amp;quot;Failed to add IRQ GPIO callback: %d&amp;quot;, ret);
                return ret;
        }

        return 0;
}

static int cst816s_process(const struct i2c_dt_spec *cst816s)
{
        LOG_DBG(&amp;quot;CST816S Process&amp;quot;);

        if (!i2c_is_ready_dt(cst816s))
        {
                LOG_ERR(&amp;quot;CST816S I2C device not ready&amp;quot;);
                return -ENODEV;
        }

        return 0;
}

static void cst816s_work_handler(struct k_work *work)
{
        struct cst816s_data *data = CONTAINER_OF(work, struct cst816s_data, work);
        
        cst816s_process(data-&amp;gt;i2c);
}

static int cst816s_init (const struct i2c_dt_spec *cst816s, const struct gpio_dt_spec *rst_gpio, const struct gpio_dt_spec *irq_gpio, struct cst816s_data *data)
{
        LOG_DBG(&amp;quot;CST816S Initialization&amp;quot;);

        int ret;
        uint8_t chip_id = 0;

        ret = cst816s_reset(rst_gpio);
        if (ret &amp;lt; 0)
        {
                LOG_ERR(&amp;quot;Failed to reset CST816S chip: %d&amp;quot;, ret);
                return ret;
        }
        LOG_DBG(&amp;quot;CST816S Chip Reset complete&amp;quot;);

        ret = cst816s_irq_init(irq_gpio, &amp;amp;data-&amp;gt;irq_gpio_cb);
        if (ret &amp;lt; 0)
        {
                LOG_ERR(&amp;quot;Failed to initialize CST816S IRQ: %d&amp;quot;, ret);
                return ret;
        }
        LOG_DBG(&amp;quot;CST816S IRQ initialized successfully&amp;quot;);

        ret = i2c_reg_read_byte_dt(cst816s, CST816S_I2C_CHIP_ID_REG, &amp;amp;chip_id);
        if (ret &amp;lt; 0)
        {
                LOG_ERR(&amp;quot;Failed to read chip ID: %d&amp;quot;, ret);
                return ret;
        }
        LOG_DBG(&amp;quot;CST816S Chip ID: 0x%02X&amp;quot;, chip_id);

        return 0;
}

int main()
{
        LOG_DBG(&amp;quot;CST816S Touchscreen I2C Test&amp;quot;);

        const struct i2c_dt_spec cst816s_i2c = I2C_DT_SPEC_GET(CST816S_NODE);
        if (!i2c_is_ready_dt(&amp;amp;cst816s_i2c))
        {
                LOG_ERR(&amp;quot;CST816S I2C device not ready&amp;quot;);
                return -ENODEV;
        }
        LOG_DBG(&amp;quot;CST816S I2C device (bus %d, addr 0x%02X)&amp;quot;, cst816s_i2c.bus-&amp;gt;name, cst816s_i2c.addr);

        const struct gpio_dt_spec cst816s_rst_gpio = GPIO_DT_SPEC_GET(CST816S_NODE, rst_gpios);
        if (!gpio_is_ready_dt(&amp;amp;cst816s_rst_gpio))
        {
                LOG_ERR(&amp;quot;RST GPIO not ready&amp;quot;);
                return -ENODEV;
        }
        LOG_DBG(&amp;quot;RST GPIO (port %d, pin %d)&amp;quot;, cst816s_rst_gpio.port-&amp;gt;name, cst816s_rst_gpio.pin);
        const struct gpio_dt_spec cst816s_irq_gpio = GPIO_DT_SPEC_GET(CST816S_NODE, irq_gpios);
        if (!gpio_is_ready_dt(&amp;amp;cst816s_irq_gpio))
        {
                LOG_ERR(&amp;quot;IRQ GPIO not ready&amp;quot;);
                return -ENODEV;
        }
        LOG_DBG(&amp;quot;IRQ GPIO (port %d, pin %d)&amp;quot;, cst816s_irq_gpio.port-&amp;gt;name, cst816s_irq_gpio.pin);

        struct cst816s_data data;
        data.i2c = &amp;amp;cst816s_i2c;

        k_work_init(&amp;amp;data.work, cst816s_work_handler);

        int ret;

        ret = cst816s_init(&amp;amp;cst816s_i2c, &amp;amp;cst816s_rst_gpio, &amp;amp;cst816s_irq_gpio, &amp;amp;data);
        if (ret &amp;lt; 0)
        {
                LOG_ERR(&amp;quot;Failed to initialize CST816S: %d&amp;quot;, ret);
                return ret;
        }
        LOG_DBG(&amp;quot;CST816S initialized successfully&amp;quot;);

        while(1)
        {
                k_msleep(1);
        }

        return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;log output:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting nRF Connect SDK v2.7.0-5cb85570ca43 ***
*** Using Zephyr OS v3.6.99-100befc70c74 ***
[00:00:00.431,335] &amp;lt;dbg&amp;gt; app: main: CST816S Touchscreen I2C Test
[00:00:00.431,365] &amp;lt;dbg&amp;gt; app: main: CST816S I2C device (bus i2c@40004000, addr 0x15)
[00:00:00.431,396] &amp;lt;dbg&amp;gt; app: main: RST GPIO (port gpio@50000000, pin 21)
[00:00:00.431,427] &amp;lt;dbg&amp;gt; app: main: IRQ GPIO (port gpio@50000000, pin 26)
[00:00:00.431,457] &amp;lt;dbg&amp;gt; app: cst816s_init: CST816S Initialization
[00:00:00.431,457] &amp;lt;dbg&amp;gt; app: cst816s_reset: CST816S Reset
[00:00:00.486,633] &amp;lt;dbg&amp;gt; app: cst816s_init: CST816S Chip Reset complete
[00:00:00.486,663] &amp;lt;dbg&amp;gt; app: cst816s_irq_init: CST816S IRQ Initialization
[00:00:00.486,694] &amp;lt;dbg&amp;gt; app: cst816s_init: CST816S IRQ initialized successfully
[00:00:00.486,785] &amp;lt;err&amp;gt; app: Failed to read chip ID: -5
[00:00:00.486,816] &amp;lt;err&amp;gt; app: Failed to initialize CST816S: -5
[00:16:50.213,226] &amp;lt;dbg&amp;gt; app: cst816s_process: CST816S Process&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CST816S input driver i2c failed to read</title><link>https://devzone.nordicsemi.com/thread/532309?ContentTypeID=1</link><pubDate>Tue, 22 Apr 2025 10:17:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aec28f29-b518-4dfa-a40f-9b8c457fb13c</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Looks like you are using the cst816s drivers directly.&lt;br /&gt;I found a Zephyr issue where another user has exactly the same issue:&lt;br /&gt;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/discussions/74678"&gt;https://github.com/zephyrproject-rtos/zephyr/discussions/74678&lt;/a&gt;. Im not sure if it is related or not, but worth knowing about.&lt;/p&gt;
[quote user="nanangcreacoll"]I2c readings with other framework:[/quote]
&lt;p&gt;This is good to know. It shows that the hardware works correctly, and that this is a software issue.&lt;/p&gt;
&lt;p&gt;I suggest that you start by trying to use I2C directly to read the device ID.&lt;br /&gt;You can do this by following the&amp;nbsp;&lt;a href="https://academy.nordicsemi.com/courses/nrf-connect-sdk-fundamentals/lessons/lesson-6-serial-com-i2c/"&gt;DevAcademy Fundamentals: I2C lesson&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This way, you get some firmware to compare with. Then we can compare the working I2C with the cst816s driver.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CST816S input driver i2c failed to read</title><link>https://devzone.nordicsemi.com/thread/532111?ContentTypeID=1</link><pubDate>Thu, 17 Apr 2025 08:21:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23c1af96-1b7c-4458-950f-1c4f3f628a3a</guid><dc:creator>nanangcreacoll</dc:creator><description>&lt;p&gt;Hi, thanks for your response. As you can see, there is nothing on the i2c reading with zephyr. I have tried it with other frameworks and it still works fine.&amp;nbsp;I&amp;#39;m still curious what makes i2c (with gpio sda 9 and gpio scl 10) not output any data, maybe I missed something when setting up the board devicetree or overlay.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I2c readings with other framework:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/cst816s-i2c-data-analyzer-arduino.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I2c readings with zephyr:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/cst816s-i2c-data-analyzer-zephyr.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CST816S input driver i2c failed to read</title><link>https://devzone.nordicsemi.com/thread/531986?ContentTypeID=1</link><pubDate>Wed, 16 Apr 2025 10:39:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59f7fd22-96ae-4d0d-a3db-e38a0e240050</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Are you able to get logic analyzer or oscilloscope readings from the I2C?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>