<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://test-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>Program to interface Grove Four Digit Display(TM1637) with nRF chips</title><link>https://test-devzone.nordicsemi.com/f/nordic-q-a/88948/program-to-interface-grove-four-digit-display-tm1637-with-nrf-chips</link><description>I am trying to interface the Grove 4 Digit Display(TM1637) with the nRF52840 DK.I have successfully interfaced it with ESP32 and get clear output after researching for the CODE in the Internet.I have included that code , below: 
 main.c 
 
 tm1637.h </description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><lastBuildDate>Wed, 15 Jun 2022 05:06:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://test-devzone.nordicsemi.com/f/nordic-q-a/88948/program-to-interface-grove-four-digit-display-tm1637-with-nrf-chips" /><item><title>RE: Program to interface Grove Four Digit Display(TM1637) with nRF chips</title><link>https://test-devzone.nordicsemi.com/thread/372466?ContentTypeID=1</link><pubDate>Wed, 15 Jun 2022 05:06:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a195bcb4-e36e-4d90-8ea3-aa022a893752</guid><dc:creator>user115760</dc:creator><description>&lt;p&gt;After searching different Questions and Answers in Devzone, I came to the point , that I have to change the Device Tree by including Overlay file in the root folder of the main function. I have made a simple program to blink an LED connected to the GPIO pin 22 which is declared as CLK.&lt;/p&gt;
&lt;p&gt;Refernce&lt;/p&gt;
&lt;p&gt;&lt;a href="https://test-devzone.nordicsemi.com/f/nordic-q-a/72618/extra-gpios-in-board-overlay-for-nrf9160dk"&gt;Device Tree Overlay Program Reference&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I have included the main.c function and the overlay file below:&lt;/p&gt;
&lt;p&gt;main.c&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;device.h&amp;gt;
#include &amp;lt;devicetree.h&amp;gt;
#include &amp;lt;drivers/gpio.h&amp;gt;

/* Increase the main thread sleep time from 100ms to 1 second  */
#define SLEEP_TIME_MS 1000


//Defining GPIO pins
#define CLK_NODE DT_ALIAS(gpiocus0)
#if DT_NODE_HAS_STATUS(CLK_NODE, okay)
#define CLK DT_GPIO_LABEL(CLK_NODE, gpios)
#define CLK_PIN DT_GPIO_PIN(CLK_NODE, gpios)
#define CLK_FLAGS DT_GPIO_FLAGS(CLK_NODE, gpios)
#else
#error &amp;quot;Unsupported board: gpio22 devicetree alias is not defined&amp;quot;
#endif

#define DIO_NODE DT_ALIAS(gpiocus1)
#if DT_NODE_HAS_STATUS(DIO_NODE, okay)
#define DIO DT_GPIO_LABEL(DIO_NODE, gpios)
#define DIO_PIN DT_GPIO_PIN(DIO_NODE, gpios)
#define DIO_FLAGS DT_GPIO_FLAGS(DIO_NODE, gpios)
#else
#error &amp;quot;Unsupported board: gpio24 devicetree alias is not defined&amp;quot;
#endif


void main(void)
{
    const struct device *dev;
    bool led_is_on = true;
    int ret;
    
    dev = device_get_binding(CLK);
    if (dev == NULL) 
    {
        return;
    }
    
    ret = gpio_pin_configure(dev, CLK_PIN, GPIO_OUTPUT_ACTIVE | CLK_FLAGS);
    if (ret &amp;lt; 0) 
    {
        return;
    }

    while (1) 
    {
        gpio_pin_set(dev, CLK_PIN, (int)led_is_on);
        led_is_on = !led_is_on;
        k_msleep(SLEEP_TIME_MS);
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Device tree overlay file:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/ {
    gpiocustom {
        compatible = &amp;quot;gpio-keys&amp;quot;;
        gpiocus0: gpiocus_0 {
            gpios = &amp;lt;&amp;amp;gpio0 22 GPIO_ACTIVE_LOW&amp;gt;;
            label = &amp;quot;Custom gpio 22&amp;quot;;
        };
        gpiocus1: gpiocus_1 {
            gpios = &amp;lt;&amp;amp;gpio0 23 GPIO_ACTIVE_LOW&amp;gt;;
            label = &amp;quot;Custom gpio 24&amp;quot;;
        };
    };
    aliases {
        gpiocus0 = &amp;amp;gpiocus0;
        gpiocus1 = &amp;amp;gpiocus1;
    };
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The screenshot of my VS Code workspace:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://test-devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1655273748322v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Hardware setup and wiring diagram :&lt;/p&gt;
&lt;p&gt;This is my hardware setup to blink an LED connected to GPIO pin no : 22.&lt;/p&gt;
&lt;p&gt;If you notice any error in my wiring circuit , Please notify that.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://test-devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1655273725619v2.jpeg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;I have Pristine build the above code without any errors.But , when I flash it in thw nRF52840 DK board, I won&amp;#39;t get any output. I connected an LED at GPIO pin 22 with required resistor. I don&amp;#39;t know what am I missing?Can you tell me how can I solve this problem?&lt;/p&gt;
&lt;p&gt;Ultimately I have to control the 4 Digit Display using these two GPIO pins. If you have idea to do that, Please tell me how can I achieve that.&lt;/p&gt;
&lt;p&gt;Thankyou.&lt;/p&gt;
&lt;p&gt;-Vicky&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>