<?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>SPI transfers cause BLE connection timeout, but only on some units and especially when cold?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/106208/spi-transfers-cause-ble-connection-timeout-but-only-on-some-units-and-especially-when-cold</link><description>I&amp;#39;m running into a wall trying to find the root cause of a problem that we only started noticing after a small production run of a custom device built around the nRF52840 (specifically the Rigado/u-blox BMD-340 module). 
 In short, we have an IMU on the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 01 Dec 2023 15:00:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/106208/spi-transfers-cause-ble-connection-timeout-but-only-on-some-units-and-especially-when-cold" /><item><title>RE: SPI transfers cause BLE connection timeout, but only on some units and especially when cold?</title><link>https://devzone.nordicsemi.com/thread/458563?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2023 15:00:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0dba92b-123e-4940-94e0-dac55714e626</guid><dc:creator>jrowberg</dc:creator><description>&lt;p&gt;I had not tried the RC option, because early on (in desperate random troubleshooting) I encountered errors when switching to it, and then tried HFCLK instead with apparent success. However, I&amp;#39;ve just changed to RC, and it&amp;nbsp;&lt;em&gt;appears&lt;/em&gt; to be reliable as well. I&amp;#39;ve held a connection for 10 minutes with no data transmission problems so far, and I&amp;#39;ll keep letting it run for an extended test. Thanks for the tip! This will be much better than HFCLK if it keeps working.&lt;/p&gt;
&lt;p&gt;For what it&amp;#39;s worth, here&amp;#39;s a data point for you concerning the synthesized-from-HFCLK source: I left our &amp;quot;bad&amp;quot; device connected and transmitting data overnight with the SYNTH config, and it stayed 100% solid, delivering over 140 MB of dummy data over BLE in about 12 hours. This is the same unit that couldn&amp;#39;t stay connected for 1 second with the XTAL input, otherwise the same config (including running 2MHz SPI over officially unrecommended pins near the radio).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI transfers cause BLE connection timeout, but only on some units and especially when cold?</title><link>https://devzone.nordicsemi.com/thread/458481?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2023 10:59:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f4ee293-62cd-4587-ae00-040e1692dd83</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>[quote user="jrowberg"]A design change isn&amp;#39;t in the cards for the immediate future, so it looks like I need to figure out the least painful way to rely on the HFCLK during connections at this point.[/quote]
&lt;p&gt;Have you checked if the &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/clock.html#concept_acb_q5y_2q"&gt;LFRC clock source&lt;/a&gt; eliminates the problem similar to LFSYNT? This is the clock source that is normally used in designs that does not include a crystal. The &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/14214/how-much-current-consumption-when-we-use-internal-32k-rc/54292"&gt;current consumption of LFRC is slightly higher than LFXO&lt;/a&gt; due to calibration towards HFCLK and window widening in connections from worse tolerance, but it is far from the current used by LFSYNT. LFSYNT is also not well tested and is not recommended for use with the SoftDevice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI transfers cause BLE connection timeout, but only on some units and especially when cold?</title><link>https://devzone.nordicsemi.com/thread/458425?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2023 02:56:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b59b84f-aaba-4a19-8089-6a730947a616</guid><dc:creator>jrowberg</dc:creator><description>&lt;p&gt;Wow, that&amp;#39;s...really important to know, and I totally missed it during the design phase. Particularly the P1.15 clock speed limitation. Clearly, some revisions are in order if we want to follow the design guidelines more closely.&lt;/p&gt;
&lt;p&gt;I tried shorting the 1k series resistor, and it didn&amp;#39;t result in any improvement. Nuts.&lt;/p&gt;
&lt;p&gt;Oddly though, despite this note in the datasheet, that pin seems to have no problem driving the IMU&amp;#39;s SPI interface at 2MHz.We&amp;#39;ve got nearly a year of testing with about a hundred of these all over the place, and nobody&amp;#39;s complained about bad data (ever) or this connection issue&amp;nbsp;(until very recently).&lt;/p&gt;
&lt;p&gt;However, I&amp;#39;m still confused about why simply changing the temperature would have such a dramatic effect on whether it happens. Similarly, why does switching the LFCLK source to be synthesized from the HFCLK eliminate the issue as well? If the problem is interference between a misallocated I/O pin and the radio, shouldn&amp;#39;t that still cause the issue to occur while the IMU is busily passing data along? Maybe the at-risk signals only concern a non-synthesized clock.&lt;/p&gt;
&lt;p&gt;A design change isn&amp;#39;t in the cards for the immediate future, so it looks like I need to figure out the least painful way to rely on the HFCLK during connections at this point.&lt;/p&gt;
&lt;p&gt;Thanks for your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI transfers cause BLE connection timeout, but only on some units and especially when cold?</title><link>https://devzone.nordicsemi.com/thread/458420?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2023 02:05:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f8306a9-1006-4e87-a6d4-7c66f8f8c5c1</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;&lt;span&gt;I looked at the BMD340 and the SCK and Osc pins are pretty close together, plus the P1.15 SCK is unsuitable for any kind of SPI clock; it is close to the radio and will affect as well as be affected by transmissions. So .. the fix - if shorting the 1k doesn&amp;#39;t work - may well be to use an unrestricted P0.nn i/o pin for SCK (and probably MOSI and MISO as well). (Duplicated to avoid losing text)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI transfers cause BLE connection timeout, but only on some units and especially when cold?</title><link>https://devzone.nordicsemi.com/thread/458402?ContentTypeID=1</link><pubDate>Thu, 30 Nov 2023 20:03:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ceaa6e7-08f1-40aa-9b64-af731ca20aa2</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Looks correct; however I would try shorting out the 1k0 series resistor and see if there is any change. A periodic check in the firmware for the contents of&amp;nbsp;&lt;em&gt;LFCLKSRCCOPY&lt;/em&gt; and &lt;em&gt;LFCLKSRC&lt;/em&gt;&amp;nbsp;and &lt;em&gt;LFCLKRUN&lt;/em&gt; would also be a good idea ..&lt;/p&gt;
&lt;p&gt;.. I should add that with a 1k0 resistor the high-impedance nRF52840 clock input pin will experience more interference from a high-speed clock source such as SPI ..&lt;/p&gt;
&lt;p&gt;Edit: I looked at the BMD340 and the SCK and Osc pins are pretty close together, plus the P1.15 SCK is unsuitable for any kind of SPI clock; it is close to the radio and will affect as well as be affected by transmissions. So .. the fix - if shorting the 1k doesn&amp;#39;t work - may well be to use an unrestricted P0.nn i/o pin for SCK (and probably MOSI and MISO as well).&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;WLCSP Port  BMD340 Function
===== ===== ====== =======================================================================================
B9    P0.00 Pin 13 XL1 Digital I/O Analog input General purpose I/O Connection for 32.768 kHz crystal
B10   P0.01 Pin 14 XL2 Digital I/O Analog input General purpose I/O Connection for 32.768 kHz crystal
C6    P1.15 Pin 64 Digital I/O General purpose I/O Standard drive, low frequency I/O only. Close to radio&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI transfers cause BLE connection timeout, but only on some units and especially when cold?</title><link>https://devzone.nordicsemi.com/thread/458395?ContentTypeID=1</link><pubDate>Thu, 30 Nov 2023 19:17:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3043f569-dfec-4472-8790-872e7b645059</guid><dc:creator>jrowberg</dc:creator><description>[quote userid="14926" url="~/f/nordic-q-a/106208/spi-transfers-cause-ble-connection-timeout-but-only-on-some-units-and-especially-when-cold/458247"]How exactly is the LFCLK source configured in your application? The SoftDevice does not have any option for configuring external clock source, but if clock is configured and started by the application before the SoftDevice is enabled, the EXTRENAL/BYPASS configuration should not be overridden.[/quote][quote userid="65515" url="~/f/nordic-q-a/106208/spi-transfers-cause-ble-connection-timeout-but-only-on-some-units-and-especially-when-cold/458223"]Can you provide details of the TCXO and an accurate scope (not logic analyser)&amp;nbsp;trace of the TCXO waveform at the nRF52?[/quote]
&lt;p&gt;Thanks for your replies, and my apologies--I&amp;#39;ve updated the original post with more detail about the part. It&amp;#39;s &lt;a href="https://octopart.com/sit1552ai-je-dcc-32.768e-sitime-58051032"&gt;SIT1552AI-JE-DCC-32.768E&lt;/a&gt;, specifically chosen for the rail-to-rail full swing and extra high accuracy. We have not requested or configured a non-standard VOH/VOL value, so my understanding (and intent, and measurement) is that it&amp;#39;s simply GND to VCC. &lt;strong&gt;Note, VCC in this circuit is 3.1V&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The TCXO clock output is connected to P0.00 (&lt;strong&gt;XL1&lt;/strong&gt;) through a 1K series resistor. (The signal&amp;nbsp;&lt;em&gt;appears&lt;/em&gt; to be the same on both sides of this resistor).&amp;nbsp;P0.01 (&lt;strong&gt;XL2&lt;/strong&gt;) is left floating. The &lt;code&gt;LFCLKSRC&lt;/code&gt; register is configured at the top of the bootloader&amp;#39;s &lt;code&gt;main()&lt;/code&gt; function to full-swing mode (&lt;code&gt;EXTERNAL&lt;/code&gt; + &lt;code&gt;BYPASS&lt;/code&gt; bits as defined in &lt;code&gt;nrf_clock.h&lt;/code&gt;):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// configure LFCLK if necessary
if (!nrf_clock_lf_is_running())
{
    // set LFCLK source to external full-swing clock
    NRF_CLOCK-&amp;gt;LFCLKSRC = NRF_CLOCK_LFCLK_Xtal_Full_Swing;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It checks to make sure the clock isn&amp;#39;t running first because sometimes the app jumps back to the bootloader for DFU. The same conditional configuration block of code is in the application&amp;#39;s &lt;code&gt;main()&lt;/code&gt; function as well, as I&amp;#39;ve currently been using an app-only firmware image for simpler/faster testing and debugging in Segger Embedded Studio + J-Link.&lt;/p&gt;
&lt;p&gt;The bench tools I currently have available are a Saleae Logic Pro 16 (digital + analog) and a Tektronix TBS 1052B digital oscilloscope, neither of which is the world&amp;#39;s best clock measurement tool, but here&amp;#39;s what I get:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:250px;max-width:500px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/1000x500/__key/communityserver-discussions-components-files/4/clock_2D00_signal_2D00_digital_2D00_analog.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:400px;max-width:500px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/1000x800/__key/communityserver-discussions-components-files/4/IMG_5F00_8991.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;Both devices show basically what I expect to see, though the rails aren&amp;#39;t quite touched according to the Tektronix scope--just close. There is also a fairly large variance in what the Saleae shows for the actual clock period. The screenshot highlights a detected frequency that is exactly correct, but the analyzer reports a range of 32688 up to 32860 Hz. I suspect a measurement issue rather than a signal issue because (1) the Tektronix unit is much more stable and (2) one of our devices that works fine with a stable connection yields the same varied measurement on the Saleae device.&lt;/p&gt;
&lt;p&gt;If there is a specific tool I need to capture this better, let me know; I might be able to get one.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m intrigued by the possibility of measuring the TCXO against the 32 MHz clock, and may dig into this. Another question is whether it could be possible to switch clock sources at runtime for power-saving purposes. The increased consumption of the HFCLK is dwarfed by the power draw of active components like the BLE radio and IMU during normal active use of our device, so it would be acceptable to use the HFCLK for BLE connection timing and drop back to the LFCLK for extended sleep (minutes/hours) in between usage events.&lt;/p&gt;
&lt;p&gt;Speaking of&amp;nbsp;&lt;strong&gt;temperature dependence&lt;/strong&gt; (which clearly impacts the behavior in my case), here are three more data points:&lt;/p&gt;
&lt;p&gt;1. I tried the most aggressive clock setting (20ppm accuracy) and then used a hot air gun to slowly raise the temperature of the whole board up to about 70 deg. C. This allowed a solid connection with full IMU use and data transmission for five minutes, which is when I stopped the test&lt;/p&gt;
&lt;p&gt;2. I then tried putting a small plastic bag with some crushed ice directly on the&amp;nbsp;test device to force it to misbehave. Starting from the warm state, it retained the connection for another four minutes&amp;nbsp;before it timed out. Reconnecting immediately allowed another semi-stable connection, lasting 50 seconds that time. Reconnecting again only lasted about 10 seconds, clearly getting progressively worse as the temperature dropped.&lt;/p&gt;
&lt;p&gt;3. I let the ice sit on it for another 30 minutes until it was&amp;nbsp;&lt;em&gt;much&lt;/em&gt;&amp;nbsp;colder than usual, at which point not only would it immediately disconnect after connecting + starting the IMU, but the small double-beep disconnection tone was sluggish and drawn out. This is an audible signal we&amp;nbsp;generate via PWM into a piezo element (low-side transistor switch, not direct), implemented using the &amp;quot;app_pwm&amp;quot; driver. By &amp;quot;sluggish,&amp;quot; I mean that the tone&amp;#39;s pitch was correct but it&amp;#39;s supposed to be two 100ms beeps with a 100ms gap between, and all three of those durations were more like 1500ms. So, the app timer ticks got way slower somehow, presumably because they&amp;#39;re driven by the LFCLK as well. But the LFCLK definitely hadn&amp;#39;t dropped down to 10kHz or 3kHz or something, or the whole system would have fallen apart.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m still confused.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI transfers cause BLE connection timeout, but only on some units and especially when cold?</title><link>https://devzone.nordicsemi.com/thread/458318?ContentTypeID=1</link><pubDate>Thu, 30 Nov 2023 13:52:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb1401f5-d9c4-432e-a18b-91263c708357</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Following up on my reply yesterday, often issues regarding suspected loss of timing for the BLE transactions can be determined by adding a self-test of the external 32kHz clock to alert when that clock input behaves unexpectedly. This can be done by deriving a time interval from one of the RTC CC conditions, either dedicated or simply leveraged off an existing CC, and deriving a comparable interval from a known-good timing reference. For testing,&amp;nbsp;the&amp;nbsp;&lt;span&gt;known-good timing reference&lt;/span&gt; can use the nRF52840 32MHz crystal, although that has to be kept running during the tests which increases power consumption. Another comparison source is to derive a known interval from the external EMU, which although using the same TCXO is likely to behave differently than the nRF52840. The EMU keeps internal time, though reading that out might require some creative thinking although datasheet does state &amp;quot;&lt;em&gt;Timestamps attached to sensor reports&lt;/em&gt;&amp;quot;. If using a fixed update rate triggered by the EMU, simply using the Packet Sequence Number from the EMU would give an interpreted accurate timing source which would be compared with the nRF52840 RTC providing continuous monitoring. As an aside, make sure the &amp;#39;scope probes are set to 10x and are calibrated before providing the waveform as mentioned in my other reply.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI transfers cause BLE connection timeout, but only on some units and especially when cold?</title><link>https://devzone.nordicsemi.com/thread/458247?ContentTypeID=1</link><pubDate>Thu, 30 Nov 2023 09:47:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c68094a-ec18-4522-a54d-a400226cdd3c</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;How exactly is the LFCLK source configured in your application? The SoftDevice does not have any option for configuring external clock source, but if clock is configured and started by the application before the SoftDevice is enabled, the EXTRENAL/BYPASS configuration should not be overridden.&lt;/p&gt;
&lt;p&gt;Also, make sure you use the correct mode (Low swing/Rail-to-rail configuration) for your external clock source.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI transfers cause BLE connection timeout, but only on some units and especially when cold?</title><link>https://devzone.nordicsemi.com/thread/458223?ContentTypeID=1</link><pubDate>Thu, 30 Nov 2023 07:12:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81452aa3-47c7-41d4-974a-f01e8321ae82</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Can you provide details of the TCXO and an accurate scope (not logic analyser)&amp;nbsp;trace of the TCXO waveform at the nRF52? The LFCLK external input is very piccy, and the timing may well be affected by the input voltage levels which in turn may be affected by the SPI transfer disturbance coupling to Vdd on either the TCXO or the nRF52840. What has the customer-specific TCXO output voltage been set to, and does it match the nRF52840? If not then coupled noise becomes more critical.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;nRF52840&lt;/strong&gt;: &amp;quot;&lt;em&gt;VAMP,IN,XO,LOW Peak to peak amplitude for external low swing clock. Input&amp;nbsp;signal must not swing outside supply rails. min 200 max 1000 mV&lt;/em&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SiT1552&lt;/strong&gt;&lt;em&gt;&lt;span&gt;: &lt;/span&gt;&lt;/em&gt;&lt;em&gt;The SiT1552 has two output voltage options. One option is a standard LVCMOS output swing. The second option is the NanoDrive reduced swing output. Output swing is customer specific and programmed between 200 mV and 800 mV. For DC-coupled applications, output VOH and VOL are individually factory programmed to the customers&amp;rsquo; requirement&lt;/em&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;Also which nRF52840 external clock input option is being used:&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;em&gt;The following external clock sources are supported:&lt;/em&gt;&lt;br /&gt;&lt;em&gt; - Low swing clock signal applied to the XL1 pin. The XL2 pin shall then be grounded.&amp;nbsp; set&amp;nbsp;&lt;/em&gt;&lt;strong&gt;BYPASS=0&lt;/strong&gt;&lt;br /&gt;&lt;em&gt; - Rail-to-rail clock signal applied to the XL1 pin. The XL2 pin shall then be grounded or left unconnected&lt;/em&gt;&amp;quot;&amp;nbsp; set&amp;nbsp;&lt;strong&gt;BYPASS=1&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>