<?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>Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/34112/best-approach-to-interface-hx711-with-nordic-nrf52832</link><description>I am working with HX711 and I am trying to interface with nrf52832. Should I proceed with SAADC example or UART or Twi Sensor</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 19 Jun 2024 23:20:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/34112/best-approach-to-interface-hx711-with-nordic-nrf52832" /><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/489603?ContentTypeID=1</link><pubDate>Wed, 19 Jun 2024 23:20:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c85bf395-ab33-464a-81b2-dc79bf3dd2be</guid><dc:creator>nrf_user</dc:creator><description>&lt;p&gt;I have a separate solution to this problem that&amp;#39;s preferable in a few ways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Only one timer instance is needed, instead of 2&lt;/li&gt;
&lt;li&gt;The processing is done in interrupts, so you don&amp;#39;t need to wait while polling&lt;/li&gt;
&lt;li&gt;There are no more corrupt samples&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The main realization behind it is that the hx711 will shut down if the clock line is held high for too long. When a high priority interrupt (from soft device, for example) arrives it can cause a delay which leaves the clock high and causes the hx711 to shut down. What my solution does is to use a timer / PPI to turn the clock on, then off, then calls an interrupt which can read the data and resume the timer. If an interrupt arrives and adds latency, this extra time occurs with the clock low, which is allowed for arbitrary lengths of time.&lt;/p&gt;
&lt;p&gt;You can find the code: &lt;a href="https://gist.github.com/BananaHemic/db6e20a3f655d4381366ef462f628425"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Suggestions for improvements are always welcome!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/268273?ContentTypeID=1</link><pubDate>Mon, 07 Sep 2020 11:39:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee63406e-2d41-4d5b-8b4b-beb47a54361d</guid><dc:creator>Sandy.ashva</dc:creator><description>&lt;p&gt;What optimizations have to be turned on?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/172622?ContentTypeID=1</link><pubDate>Sat, 23 Feb 2019 18:37:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f05c712-73e3-4ce2-afea-25775d3b734c</guid><dc:creator>Germ&amp;#224;n</dc:creator><description>&lt;pre class="well" id="textOut"&gt;Good afternoon. I am totally new to programming with controllers ARM Cortex M-4 and I need to do to operate the ADC HX711 in a Nrf52DK without the use of Ble. I have searched to the best of examples for the forums and I have not solved my needs. I can only find examples of Main c. for use with Ble. Someone could help me to build the file Main c. to be able to read the HX711 through NRF_LOG_INFO? I appreciate deeply the help.&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/162876?ContentTypeID=1</link><pubDate>Fri, 21 Dec 2018 14:50:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3cde9f05-c0b8-4599-9405-392c7f564ed8</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Again:&amp;nbsp;use the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;debugger&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;to step through your code and see where, exactly, it is getting stuck!&lt;/p&gt;
&lt;div class="content full threaded-reply-content user-defined-markup"&gt;
&lt;div class="content"&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="edit-form"&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/162834?ContentTypeID=1</link><pubDate>Fri, 21 Dec 2018 12:13:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62efe5b6-009b-4f47-b5f3-6df3604a0dac</guid><dc:creator>faizi_968</dc:creator><description>&lt;p&gt;Any help? &lt;a href="https://devzone.nordicsemi.com/members/awneil"&gt;awneil&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/162827?ContentTypeID=1</link><pubDate>Fri, 21 Dec 2018 11:34:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61a15b19-03c5-467e-95ac-2468a2f66342</guid><dc:creator>faizi_968</dc:creator><description>&lt;p&gt;I can&amp;#39;t seem to understand where it&amp;#39;s getting stuck.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/162825?ContentTypeID=1</link><pubDate>Fri, 21 Dec 2018 11:18:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61585742-8996-43fb-898f-400c70ae9e04</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;So use the &lt;strong&gt;debugger&lt;/strong&gt; to see where, exactly, it is getting stuck!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/162812?ContentTypeID=1</link><pubDate>Fri, 21 Dec 2018 10:01:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c218f34c-bfc1-4f89-addb-d4a971f8ff69</guid><dc:creator>faizi_968</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/awneil"&gt;awneil&lt;/a&gt;, I can&amp;#39;t seem to understand what the problem is. I have copied and pasted everything. It didn&amp;#39;t work. It&amp;#39;s not crashing, it&amp;#39;s just getting stuck inside that function and I cant detect the problem either.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/162739?ContentTypeID=1</link><pubDate>Thu, 20 Dec 2018 18:28:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:636c42ec-2a6f-4f61-b327-f64fc9ccfe02</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;So what &lt;strong&gt;debugging&lt;/strong&gt; have you done?&lt;/p&gt;
[quote userid="71471" url="~/f/nordic-q-a/34112/best-approach-to-interface-hx711-with-nordic-nrf52832/162722"]When I comment out the function &amp;quot;hx711_init(INPUT_CH_A_128, hx711_callback)&amp;quot; , code starts running smoothly[/quote]
&lt;p&gt;So that&amp;#39;s clearly an area to focus your debugging:&amp;nbsp; is it getting stuck, or crashing in that function ... ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/162722?ContentTypeID=1</link><pubDate>Thu, 20 Dec 2018 16:49:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0ad5f86-781a-41fa-ac92-3846929a97fb</guid><dc:creator>faizi_968</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/vibe"&gt;Vidar Berg&lt;/a&gt;, This example is amazing. However, I am having issues using this example. I modified the &amp;quot;ble_app_uart&amp;quot; example from Nordic SDK, and included your portion of the code (As you have done), upon compiling, the nRF52832 DK does not advertise nor does it perform any other function. When I comment out the function &amp;quot;hx711_init(INPUT_CH_A_128, hx711_callback)&amp;quot; , code starts running smoothly, advertising is ok too. So what do you think seems to be the issue. Please help me. I am using Keil MDK-ARM 5, SDKv15.0.0, nRF52832 DK. Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/159922?ContentTypeID=1</link><pubDate>Mon, 03 Dec 2018 10:13:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a23ba7d-7990-4dff-9e72-73568859e11c</guid><dc:creator>Droidik</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/vibe"&gt;Vidar Berg&lt;/a&gt;, once again thank you for your amazing work and support.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/159884?ContentTypeID=1</link><pubDate>Mon, 03 Dec 2018 08:28:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9845337f-8bba-4a6a-afc4-5a502c6655e2</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/droidik"&gt;Droidik&lt;/a&gt;,&amp;nbsp; the hx711_sample() function needs to be compiled with optimization to work&amp;nbsp;when PD_SCK frequency is 1MHz. I suspect it would not have been necessary if I had rewritten this line &amp;quot;m_sample.value |= (nrf_gpio_pin_read(DOUT) &amp;lt;&amp;lt; (23 - i));&amp;quot; to something more efficient.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/159793?ContentTypeID=1</link><pubDate>Sat, 01 Dec 2018 12:16:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28f3449e-245e-43a5-89d5-d671446c2032</guid><dc:creator>Droidik</dc:creator><description>&lt;p&gt;Solved by turning on the optimizations. Interesting.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/159780?ContentTypeID=1</link><pubDate>Fri, 30 Nov 2018 22:40:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:369d55ab-2730-4635-aadb-343dafcc2c76</guid><dc:creator>Droidik</dc:creator><description>&lt;p&gt;&lt;em&gt;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/vibe"&gt;Vidar Berg&lt;br /&gt;&lt;/a&gt;I just wanted to thank you for the provided sample code.&lt;br /&gt;&amp;quot;Just keep in mind that the implementation should account for higher priority interrupts such as radio events that may occur during ADC readout.&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;I&amp;#39;m receiving&amp;nbsp;DATA_ERROR in the callback every time. I think it&amp;#39;s because of the BLE interrupts.&amp;nbsp;What&amp;#39;s the best solution to this problem in general?&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/155694?ContentTypeID=1</link><pubDate>Fri, 02 Nov 2018 09:02:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d7cc10b-23e1-48fc-8dd8-56f5c76be4ef</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Unfortunately, the code was written for the nRF52 series. The same approach will not work on the nRF51 series as it doesn&amp;#39;t have the PPI &amp;quot;fork&amp;quot; feature. Have you decided on using the nRF51? nRF52810 is a low cost alternative.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/155624?ContentTypeID=1</link><pubDate>Thu, 01 Nov 2018 16:15:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa762ea0-2244-46c8-9eb3-e49e8728c3ad</guid><dc:creator>Pim</dc:creator><description>&lt;p&gt;Hello &lt;a href="https://devzone.nordicsemi.com/members/vibe"&gt;Vidar Berg&lt;/a&gt;, thank you for this code! I&amp;#39;m trying to get it to work within KEIL5, however it does not compile.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you tell me which SDK version you wrote this for? It seems like NRF_GPIOTE is no longer available in the S130 soft device if I interpret the compilation errors correctly. Do you have any suggestions as to how to adjust this to a newer version? Please see the screenshot attached.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;With kind regards!&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/image-_2800_2_2900_.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/131182?ContentTypeID=1</link><pubDate>Mon, 07 May 2018 11:34:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:219b70ac-6489-407d-bbad-55c9ca507770</guid><dc:creator>anuragshukla</dc:creator><description>&lt;p&gt;Thanks a ton Sir , I will definitely go through the datasheet and would try to create own code with reference to your code .&amp;nbsp;&lt;br /&gt;I would comment down below if I face any hurdle to implement the same.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best approach to interface HX711 with Nordic nrf52832?</title><link>https://devzone.nordicsemi.com/thread/131147?ContentTypeID=1</link><pubDate>Mon, 07 May 2018 08:55:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87e203f3-1cbd-4630-8512-5377029bca8b</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please refer to the datasheet for the hx711, it does not use a standardized serial interface such as UART or TWI,&amp;nbsp;which means that it has to&amp;nbsp;be implemented in software (i.e., bit banging).&lt;/p&gt;
&lt;p&gt;We don&amp;#39;t have an official reference example for this ADC, but I have played with it in my spare time, see attached code.&amp;nbsp; Documentation for this code is lacking, and I haven&amp;#39;t done any thorough testing of it, but hopefully it can serve as a starting point. You can find other examples as well if you do a google search for hx711 and nrf52/51. Just keep in mind that the implementation should account for higher priority interrupts such as radio events that may occur during ADC readout.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-e9160e96867647c19b0b370d615228b8/hx711.c"&gt;devzone.nordicsemi.com/.../hx711.c&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-e9160e96867647c19b0b370d615228b8/hx711.h"&gt;devzone.nordicsemi.com/.../hx711.h&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 9/11-18:&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve included an example in this&amp;nbsp;thread:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/40271/timer-issue-with-hx711---stopped-by-vector-catch-error"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/40271/timer-issue-with-hx711---stopped-by-vector-catch-error&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>