<?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>BLE GATT CONN TIMEOUT 32kHz xtal</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/52084/ble-gatt-conn-timeout-32khz-xtal</link><description>Hardware: nRF52832 
 SDK 14.2 
 Segger Studio 
 
 
 Hello Sir or Madam, 
 We&amp;#39;ve made a new hardware variant of a previous design with an nRF52832 on much smaller form factor PCB. The customer for who it was designed however used an non-standard assembler</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 16 Sep 2019 14:18:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/52084/ble-gatt-conn-timeout-32khz-xtal" /><item><title>RE: BLE GATT CONN TIMEOUT 32kHz xtal</title><link>https://devzone.nordicsemi.com/thread/209871?ContentTypeID=1</link><pubDate>Mon, 16 Sep 2019 14:18:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd193999-39c3-4ee3-bde6-33ae12a21659</guid><dc:creator>Andreas</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;OK, both 9 kHz and 24 kHz is satiable offsets for the 32 MHz clock, and way more accurate than the synthesized 32kHz. Now that I think about it, you actually do not start the HFCLK in your test code, I do not know if the 32MHz crystal starts automatically and I am not able to test it now. Try issuing&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART    = 1;

    // Wait for the external oscillator to start up.
    while (NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED == 0)
    {
        // Do nothing.
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;before&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;	NRF_CLOCK-&amp;gt;TASKS_LFCLKSTART = 1;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Anyway as the link seems to survive with 50ppm accuracy setting this might not be relevant anymore. It&amp;#39;s hard to say why the accuracy is so different in the boards that are differently populated from your assembler, but swapping an E12 value further away (or similarly changing CL of the crystal) tends to change the frequency offset 10-20 ppm. NP0 caps shall not vary over temperature, but if the primary tolerance is too large, say &amp;gt; 10%, you might see 10-20ppm variation solely from these.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE GATT CONN TIMEOUT 32kHz xtal</title><link>https://devzone.nordicsemi.com/thread/209822?ContentTypeID=1</link><pubDate>Mon, 16 Sep 2019 12:14:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b20dc76-21cb-4976-b4af-a70bdef4afaa</guid><dc:creator>Radiohead</dc:creator><description>&lt;p&gt;Hello Andreas,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve measured both an nRF52832 devkit as an PCB variant 2&amp;#39;s HF CLK frequency with the DTM example in the SDK. I&amp;#39;ve hardcoded the nRF mcu to output an onmodulated carrier on the antenna with the following piece of modified example main code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;int main(void)
{
    uint32_t    current_time;
    uint32_t    dtm_error_code;
    uint32_t    msb_time          = 0;     // Time when MSB of the DTM command was read. Used to catch stray bytes from &amp;quot;misbehaving&amp;quot; testers.
    bool        is_msb_read       = false; // True when MSB of the DTM command has been read and the application is waiting for LSB.
    uint16_t    dtm_cmd_from_uart = 0;     // Packed command containing command_code:freqency:length:payload in 2:6:6:2 bits.
    uint8_t     rx_byte;                   // Last byte read from UART.
    dtm_event_t result;                    // Result of a DTM operation.

  //  io_init();

    bsp_board_leds_init();
    
    //uart_init();

    dtm_error_code = dtm_init();
    if (dtm_error_code != DTM_SUCCESS)
    {
        // If DTM cannot be correctly initialized, then we just return.
        return -1;
    }

    dtm_cmd_put(0xC000); // STOP
    dtm_cmd_put(0x800B); // TXpwr 0dBm
    dtm_cmd_put(0x8003); // TX carrier test

    for (;;)
    {
  
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Both devices measured an accurate carrier frequency when set on 2.402 GHz.&lt;/p&gt;
&lt;p&gt;PCB variant 2: +24,3 kHz&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/20190916_5F00_114458.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;nRF52832 devkit: -9.2kHz&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/20190916_5F00_114809.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;/em&gt;So I must conclude that both frequencies look fine.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;The synth being off indicates that the 32 MHz crystal is also inaccurate. Have you measured the accuracy of this (frequency accuracy of unmodulated TX carrier using a spectrum analyzer)? If my calculations are correct, the deviation you are seeing is 10k ppm (!) with such an offset there will not be any radio activity.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I think measuring the LF CLK output in order to measure the HF CLK frequency is very inaccurate. I don&amp;#39;t know why the synthesized LF clock is so off-frequency compared to normal XTAL operation. &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Not sure I understand what you mean about the correlation between the clocks, but no there should not be any other similar settings or anything which you need to set.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;What I meant to ask was: if there was some some sort of timing calibration being done with the 32MHz to calibrate or manage the timeslots with the 32kHz crystal. If the 32MHz oscillator was off-frequency, this would influence the timing based on the 32kHz crystal and might explain the missed timeslots.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;I&amp;#39;ve tried 50ppm, but then the softdevice doesn&amp;#39;t start.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I tested on a different device with the PPM settings of the LF CLK and it seems that this unit works with higher PPM settings. With 50 ppm the connection no longer disconnects.&lt;/p&gt;
&lt;p&gt;It seems that the LF CLK is the cause of the problem. Might the manual rework have influenced the crystals performance so serverly that it went from 20ppm to ~50ppm? Or might this be an issue of the load capacitors of the crystal? We always use NP0/C0G, but since we don&amp;#39;t have any information what the assembler has used, could the capacitor tolerance be the cause of this issue?&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll order some parts and rework the components of the 32kHz crystal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE GATT CONN TIMEOUT 32kHz xtal</title><link>https://devzone.nordicsemi.com/thread/209656?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2019 13:41:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2bae7ab8-2c1f-46c4-8554-0afc55b43334</guid><dc:creator>Andreas</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I see no reason why the softdevice should not start with higher accuracy configuration. This just instructs how to widen the RX windows. Does either of the even higher allow it to start?&lt;/p&gt;
&lt;p&gt;The synth being off indicates that the 32 MHz crystal is also inaccurate. Have you measured the accuracy of this (frequency accuracy of unmodulated TX carrier using a spectrum analyzer)? If my calculations are correct, the deviation you are seeing is 10k ppm (!) with such an offset there will not be any radio activity.&lt;/p&gt;
&lt;p&gt;I tested your code with a logic analyzer on a DK, although probably as accurate as your counter it seems accurate enough to distinguish a difference between RC and crystal/synth.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Not sure I understand what you mean about the correlation between the clocks, but no there should not be any other similar settings or anything which you need to set.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;32 MHz crystal should be measured by looking at a TX carrier, as mentioned above.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE GATT CONN TIMEOUT 32kHz xtal</title><link>https://devzone.nordicsemi.com/thread/209609?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2019 12:09:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff4450c3-c2dc-4fd7-8651-e435e933cb4a</guid><dc:creator>Radiohead</dc:creator><description>&lt;p&gt;Hello Andreas,&lt;/p&gt;
&lt;p&gt;1.The crystal is 20 PPM, so I&amp;#39;ve configured the SDK with:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;// &amp;lt;0=&amp;gt; NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM 
// &amp;lt;1=&amp;gt; NRF_CLOCK_LF_XTAL_ACCURACY_500_PPM 
// &amp;lt;2=&amp;gt; NRF_CLOCK_LF_XTAL_ACCURACY_150_PPM 
// &amp;lt;3=&amp;gt; NRF_CLOCK_LF_XTAL_ACCURACY_100_PPM 
// &amp;lt;4=&amp;gt; NRF_CLOCK_LF_XTAL_ACCURACY_75_PPM 
// &amp;lt;5=&amp;gt; NRF_CLOCK_LF_XTAL_ACCURACY_50_PPM 
// &amp;lt;6=&amp;gt; NRF_CLOCK_LF_XTAL_ACCURACY_30_PPM 
// &amp;lt;7=&amp;gt; NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM 


#define NRF_SDH_CLOCK_LF_XTAL_ACCURACY 7&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve tried 50ppm, but then the softdevice doesn&amp;#39;t start.&lt;/p&gt;
&lt;p&gt;2 &amp;amp; 3. Okay, thats what I expected. It however doesn&amp;#39;t explain why the synth frequency on both boards is way off the expected frequency of 32768Hz, but BLE still works while with the new crystal which is only a few hertz off-frequency BLE works only for a short period.&lt;/p&gt;
&lt;p&gt;I think I&amp;#39;ll measure the nRF52832 devkit with the code I posted and measure the frequency for both the XTAL and SYNTH modes, so I can compare the results with the previous measurements.&lt;/p&gt;
&lt;p&gt;Might there be some connection/correlation between the 32MHz and the 32kHz clocks which might not work well with the combination of components? I have the softdevice RC calibration timer set to 0 since I do not use the RC timer, but is there something else like this which uses both clock sources?&lt;/p&gt;
&lt;p&gt;What&amp;#39;s the best method to measure the 32MHz clock? This might reveal something.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE GATT CONN TIMEOUT 32kHz xtal</title><link>https://devzone.nordicsemi.com/thread/209596?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2019 11:19:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:337f22bb-a256-4042-805f-4ded569f9c21</guid><dc:creator>Andreas</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1. Hard to say. What ppm do you configure when you enable the Softdevice? Even though the crystal should be more than accurate enough you might want to keep some headroom.&lt;/p&gt;
&lt;p&gt;2.&amp;nbsp;The antenna tuning determines how much energy is transferred between to and from the PCB, from a propagating wave on air. Poorly tuned means less energy is transferred, but provided the units are not moving and there is not a whole lot of change in the environment, should stay more or less constant.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;3. The values of the caps determine the frequency at which the crystal oscillates, so you need to measure and see which values brings you the closest (least error), and configure the Softdevice with the according accuracy, preferably with some margin.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>