<?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>nRF5340 1-wire EEPROM</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/121245/nrf5340-1-wire-eeprom</link><description>Hello, I have nrf5340dk and AT21CS01-STUM10-T module. This is EEPROM module. I want to communicate with it by 1-wire. The problem is that I don&amp;#39;t know how to do it. I looked through examples in SDK and DevZone but didn&amp;#39;t find anything helpful for me.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 28 May 2025 16:22:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/121245/nrf5340-1-wire-eeprom" /><item><title>RE: nRF5340 1-wire EEPROM</title><link>https://devzone.nordicsemi.com/thread/537413?ContentTypeID=1</link><pubDate>Wed, 28 May 2025 16:22:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d8eaf2c-5d29-462e-b832-4c85ef79f114</guid><dc:creator>.....</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;But problem is that&amp;nbsp;&lt;span&gt;w1-scanner&amp;nbsp;doesn&amp;#39;t work with my module.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;With the configuration you wrote above I have this output (when my module is connected):&lt;br /&gt;&lt;em&gt;[00:00:00.251,220] &amp;lt;inf&amp;gt; main: Number of devices found on bus: 0&lt;/em&gt;&lt;br /&gt;and this when nothng is connected to port P1.08:&lt;br /&gt;&lt;em&gt;[00:00:00.254,791] &amp;lt;err&amp;gt; w1_serial: tx_rx_error reset_present&lt;/em&gt;&lt;br /&gt;&lt;em&gt;[00:00:00.254,791] &amp;lt;inf&amp;gt; main: Number of devices found on bus: -5&lt;br /&gt;&lt;br /&gt;&lt;/em&gt;Second thing is that I want to read and write data, &lt;span&gt;and this functionality is not presented in this sample.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;I have the above code which I tested with ESP and it works with my EEPROM module, so I would like to implement this code on nrf but I have problem that nrf is not reading data from EEPROM.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Can you help me with it ?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Best Regards&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 1-wire EEPROM</title><link>https://devzone.nordicsemi.com/thread/537337?ContentTypeID=1</link><pubDate>Wed, 28 May 2025 10:03:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d67cf19f-676e-4488-a524-e05397f482e7</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Reading a pin is either &amp;#39;0&amp;#39; or &amp;#39;1&amp;#39;. You will not get a serialized data output without fully bit-banging your chosen protocol. I would recommend that you look into the former w1-scanner and try to get that running instead of just&amp;nbsp;reading a gpio input.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 1-wire EEPROM</title><link>https://devzone.nordicsemi.com/thread/537334?ContentTypeID=1</link><pubDate>Wed, 28 May 2025 09:54:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d653ee29-d934-4740-a3ed-101c9b70bb75</guid><dc:creator>.....</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Thanks for your reply.&lt;br /&gt;&lt;br /&gt;I tried to use 1w library with my module, but it didn&amp;#39;t work.&lt;br /&gt;&lt;br /&gt;Then i found this site&lt;br /&gt;&lt;a href="https://www.microchip.com/en-us/product/at21cs01"&gt;AT21CS01 | Microchip Technology&lt;/a&gt;&lt;br /&gt;and I downloaded this code:&lt;br /&gt;&lt;a id="" href="https://ww1.microchip.com/downloads/aemDocuments/documents/MPD/ApplicationNotes/AppnoteSourceCode/AN3304_Source_Code_V1.0.0.X.zip"&gt;https://ww1.microchip.com/downloads/aemDocuments/documents/MPD/ApplicationNotes/AppnoteSourceCode/AN3304_Source_Code_V1.0.0.X.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I ported this code (only &lt;em&gt;low-level.h&lt;/em&gt;, &lt;em&gt;low-level.c&lt;/em&gt;, &lt;em&gt;operations.h&lt;/em&gt;, &lt;em&gt;operations.c&lt;/em&gt; files) to ESP32 and it works.&lt;br /&gt;Then I ported this code to nordic (for now nRF52840dk). But I have problem - my code read only &amp;quot;0xFF&amp;quot; value when EEPROM is connected (or 0x00 when pin is connected to GND). I was checking with Logic Analyzer how single wire signal looks and it is similar to the one generated by ESP (times are also similar).&lt;br /&gt;I think this problem is caused by pin configuration.&lt;br /&gt;&lt;br /&gt;This is my .overlay file&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;/ {
	m_pin {
		compatible = &amp;quot;gpio-leds&amp;quot;;
		m_pin0: m_pin_0 {
			gpios = &amp;lt;&amp;amp;gpio0 29 (GPIO_OPEN_DRAIN | GPIO_PULL_UP)&amp;gt;;
			label = &amp;quot;M_PIN&amp;quot;;
		};
	};

	aliases {
		mpin = &amp;amp;m_pin0;
	};
};&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;and I have this lines in my code:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int ret;

if (!gpio_is_ready_dt(&amp;amp;mypin)) {
	return -1;
}

ret = gpio_pin_configure_dt(&amp;amp;mypin, GPIO_INPUT | GPIO_OUTPUT | GPIO_OPEN_DRAIN | GPIO_PULL_UP);
if (ret &amp;lt; 0) {
	return -1;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;I also tried to switching &lt;em&gt;pin_configure_d&lt;/em&gt;t depending on writing and reading from module but it didn&amp;#39;t help.&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// before writing to module
//ret = gpio_pin_configure_dt(&amp;amp;mypin, GPIO_INPUT | GPIO_OPEN_DRAIN | GPIO_PULL_UP); // I had an error with this line
ret = gpio_pin_configure_dt(&amp;amp;mypin, GPIO_OUTPUT | GPIO_INPUT | GPIO_OPEN_DRAIN | GPIO_PULL_UP);
//ret = gpio_pin_configure_dt(&amp;amp;mypin, GPIO_INPUT); // I also tried this - but then in .overlay file was this line: &amp;#39;gpios = &amp;lt;&amp;amp;gpio0 29 (GPIO_PULL_UP)&amp;gt;;&amp;#39;
if (ret &amp;lt; 0) {
    printk(&amp;quot;\n\tERROR: configure INPUT\n&amp;quot;);
}



// before reading from module
ret = gpio_pin_configure_dt(&amp;amp;mypin, GPIO_OUTPUT | GPIO_OPEN_DRAIN | GPIO_PULL_UP);
if (ret &amp;lt; 0) {
    printk(&amp;quot;\n\tERROR: configure OUTPUT\n&amp;quot;);
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Can you help me with it ?&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Best Regards&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 1-wire EEPROM</title><link>https://devzone.nordicsemi.com/thread/534288?ContentTypeID=1</link><pubDate>Wed, 07 May 2025 13:03:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a33c962d-41e6-47c4-887b-384d5e1f9a07</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Zephyr has a 1-wire scanner sample available here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.zephyrproject.org/latest/samples/drivers/w1/scanner/README.html#w1-scanner"&gt;https://docs.zephyrproject.org/latest/samples/drivers/w1/scanner/README.html#w1-scanner&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can setup a overlay for your board similar to this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;uart1 {
	status = &amp;quot;okay&amp;quot;;
	current-speed = &amp;lt;115200&amp;gt;;
	pinctrl-0 = &amp;lt;&amp;amp;uart1_default&amp;gt;;
	pinctrl-1 = &amp;lt;&amp;amp;uart1_sleep&amp;gt;;
	pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;
	w1: w1 {
		compatible = &amp;quot;zephyr,w1-serial&amp;quot;;
	};    
};

&amp;amp;pinctrl {
	uart1_default: uart1_default {
		group1 {
			psels = &amp;lt;NRF_PSEL(UART_TX, 1, 9)&amp;gt;;
		};
		group2 {
			psels = &amp;lt;NRF_PSEL(UART_RX, 1, 8)&amp;gt;;
			bias-pull-up;
		};
	};
	uart1_sleep: uart1_sleep {
		group1 {
			psels = &amp;lt;NRF_PSEL(UART_TX, 1, 9)&amp;gt;,
				&amp;lt;NRF_PSEL(UART_RX, 1, 8)&amp;gt;;
			low-power-enable;
		};
	};    
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Feel free to change the pinout to your liking.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>