<?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>Possible bug in nrf52832 LFCLK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/11590/possible-bug-in-nrf52832-lfclk</link><description>[Bug Report] Possible bug in nRF52832 engineering release B.
When LF XTAL oscillator is started, no event is generated. 
 NRF_CLOCK-&amp;gt;LFCLKSRC = CLOCK_LFCLKSRC_SRC_Xtal;
NRF_CLOCK-&amp;gt;TASKS_LFCLKSTART = 1;
while (NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED == 0) </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 29 Jan 2016 09:36:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/11590/possible-bug-in-nrf52832-lfclk" /><item><title>RE: Possible bug in nrf52832 LFCLK</title><link>https://devzone.nordicsemi.com/thread/43791?ContentTypeID=1</link><pubDate>Fri, 29 Jan 2016 09:36:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:548a588d-69d1-409a-9f30-c8a79414cd81</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Then RK got it right, it was for sure a write buffer issue. Good that it worked. I have created an internal ticket to update the functional changes document to use memory barriers. Hopefully infocenter will be updated soon.&lt;/p&gt;
&lt;p&gt;If there is nothing else to do in this thread then can you please accept my updated answer by clicking ✓ on the left side of it so other see this thread as Green.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Possible bug in nrf52832 LFCLK</title><link>https://devzone.nordicsemi.com/thread/43790?ContentTypeID=1</link><pubDate>Fri, 29 Jan 2016 09:25:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b92bdda9-b4fb-4b86-bf4b-b05e694884bc</guid><dc:creator>KLWP0101</dc:creator><description>&lt;p&gt;Thanks for valuable comments. I got it working by using the following code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK-&amp;gt;LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal &amp;lt;&amp;lt; CLOCK_LFCLKSRC_SRC_Pos);
__DSB();
NRF_CLOCK-&amp;gt;TASKS_LFCLKSTART = 1;
while (NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED == 0)
{
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Weird thing is that now I can&amp;#39;t get it to non-functional any more. At the moment I only have one specimen to test. I will use the code above because don&amp;#39;t want to get burned with this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Possible bug in nrf52832 LFCLK</title><link>https://devzone.nordicsemi.com/thread/43789?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 17:29:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:351fcd1c-c9d3-46d4-9845-9ff1033f9c4e</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Should have linked to it, it&amp;#39;s &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52.v1.0.0%2Fmigration%2Ffunctional.html&amp;amp;cp=1_4_0"&gt;this one&lt;/a&gt;. It&amp;#39;s a great redux of the major differences between the nRF51 and nRF52 processors.&lt;/p&gt;
&lt;p&gt;Hopefully now the original poster can test out a few of these solutions and see if it points to the issue, which is quite odd.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Possible bug in nrf52832 LFCLK</title><link>https://devzone.nordicsemi.com/thread/43788?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 16:03:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89ba301a-a0d1-416f-89c2-5dd893999ae9</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I agree that EVENT_LFCLKSTARTED = 0 should be moved to up to test if this a buffer issue.
I have not seen the funtional change document for nRF52, should be in the infocenter, i will read it and see if it needs any improvements. Thanks for pointing that out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Possible bug in nrf52832 LFCLK</title><link>https://devzone.nordicsemi.com/thread/43787?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 14:20:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8da15e85-d34b-41ba-b7f4-8cea567564e8</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;I had to look that up and check that DSB (and DMB) explicitly wait for the Cortex M4 internal write buffer to clear before returning and yes they do, so that should be equivalent, yes. It might be good to put that into the &amp;#39;functional changes&amp;#39; document for the nRF52, I think that&amp;#39;s a better, more generic way of ensuring write synchronisation than the write-then-read method listed there and is better to learn in general.&lt;/p&gt;
&lt;p&gt;If you &lt;em&gt;really&lt;/em&gt; want to test if it is due to the write buffer causing the issue, and whether DMB() fixes it, it would be better to move the EVENTS_LFCLKSTARTED = 0 before the LFCLKSRC set as that one extra write may hide the issue all on its own.&lt;/p&gt;
&lt;p&gt;I still don&amp;#39;t know if it is the write buffer or not, it&amp;#39;s just a suspicion.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Possible bug in nrf52832 LFCLK</title><link>https://devzone.nordicsemi.com/thread/43786?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 13:41:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47e848dd-5202-4c2c-bc9e-92a7bd2d7d84</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Yes, It is possible. In that case inserting &lt;code&gt;_DSB()&lt;/code&gt; in between setting the clock source and starting the clock should handle that. Do you think the below code fits?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_CLOCK-&amp;gt;LFCLKSRC            = (CLOCK_LFCLKSRC_SRC_Xtal &amp;lt;&amp;lt; CLOCK_LFCLKSRC_SRC_Pos);
NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED = 0; 
__DSB();
NRF_CLOCK-&amp;gt;TASKS_LFCLKSTART    = 1;

while (NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED == 0)
{
    // Do nothing.
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Possible bug in nrf52832 LFCLK</title><link>https://devzone.nordicsemi.com/thread/43785?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 13:04:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6983d41b-d4f0-4abf-be7f-ab1246bf9371</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;agreed - however I wondered if the two writes, the one to the LFCLKSRC and LFCLKSTART end up getting committed at the same time because they get buffered and flushed together. I don&amp;#39;t know what the LF clock would do if it gets both registers written at exactly the same time, possibly something a bit indeterminate.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m just guessing at possibilities, I know the write buffer exists but I still don&amp;#39;t quite have a good handle on exactly when it may or may not need a flush.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Possible bug in nrf52832 LFCLK</title><link>https://devzone.nordicsemi.com/thread/43784?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 12:42:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ecc6eb9-8609-4660-b389-64dbc70a2b2d</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;RK, but he said that it is stuck in the while loop for ever, that is the part that confused me.
If it is the write buffer then it should have exited the while loop in few cycles.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Possible bug in nrf52832 LFCLK</title><link>https://devzone.nordicsemi.com/thread/43783?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 11:50:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6caad14e-c70f-4c73-9a05-4a5dab1662a6</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;This sounds a little bit like the write buffer scenario mentioned in the porting notes. I wonder if the write to LFCLKSRC isn&amp;#39;t completing before the write to LFCLKSTART, or basically they end up completing together and so the source isn&amp;#39;t really set and the clock event doesn&amp;#39;t get sent.&lt;/p&gt;
&lt;p&gt;You could try reading NRF_CLOCK-&amp;gt;LFCLKSRC after writing it to force the write buffer to clear.&lt;/p&gt;
&lt;p&gt;I think we&amp;#39;re going to see this write-may-need-read scenario catching people out, it caught me out last week!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Possible bug in nrf52832 LFCLK</title><link>https://devzone.nordicsemi.com/thread/43782?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 11:03:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd37779c-de9a-4f34-b8b6-7f8f9ffda74e</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;updated with code that worked (29.01.2016)&lt;/p&gt;
&lt;p&gt;Maybe it needs one clk cycle or two between selection of the clock source and starting the lfclk, try this below&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK-&amp;gt;LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal &amp;lt;&amp;lt; CLOCK_LFCLKSRC_SRC_Pos);
__DSB();     //&amp;lt;-- This will wait until write buffers are emptied.
NRF_CLOCK-&amp;gt;TASKS_LFCLKSTART = 1;
while (NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED == 0)
{
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;i do not have engineering sample B to test it with. If the above code works, then i should ask someone here to test out why the event missed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>