<?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 advertising and timer conflict</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/60701/ble-advertising-and-timer-conflict</link><description>Hi I would like to ask you for advice on how to solve my problem with Ble and the timer I have nRf52840 and I am trying to add a timer to examples\ble_peripheral\ble_app_uart timer works properly unless advertising_start(); and then the timer conflict</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 27 Apr 2020 14:21:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/60701/ble-advertising-and-timer-conflict" /><item><title>RE: Ble advertising and timer conflict</title><link>https://devzone.nordicsemi.com/thread/246905?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 14:21:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:047efc86-3546-43eb-9da8-c2fda6dd088f</guid><dc:creator>Folny</dc:creator><description>&lt;p&gt;Yes I want to send data to the phone I wanted to use a quality ADC so I decided to use AD7691 but with that is not a problem my project is already done and the PCB designed and installed when I designed the PCB I had no idea there would be problems with the timer.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/IMG_2D00_20200425_2D00_WA0009.jpeg" /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/IMG_2D00_20200425_2D00_WA0011.jpeg" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ble advertising and timer conflict</title><link>https://devzone.nordicsemi.com/thread/246890?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 13:51:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c33bb536-0f8e-4792-8101-d8411b6606b7</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Do you intend to stream the adc data to the phone?&lt;br /&gt;&lt;br /&gt;Also, you need a driver-amplifier for the&amp;nbsp;&lt;span&gt;AD7691&amp;nbsp;anyways, so why don&amp;#39;t you just use a regular instrumental amplifier and the internal SAADC of the nRF52?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;There&amp;#39;s little chance that you will be able to have a continuous sampling of the external ADC with concurrent BLE operation, it will require significant development time.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ble advertising and timer conflict</title><link>https://devzone.nordicsemi.com/thread/246866?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 13:12:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f67060fb-79f6-44e9-b3d0-2922b026f0b4</guid><dc:creator>Folny</dc:creator><description>&lt;p&gt;Ble I want to use as a classic uart and send data to the phone&amp;#39;s external ADC is because I need to measure very small differences in values. I am also attaching the file I want to edit for my project, timer 2 has been added there and it is created in nRF5_SDK_16.0.0 please try to look at it and edit it to make the timer stable I will be very grateful to you.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/4572.ble_5F00_app_5F00_uart.zip"&gt;devzone.nordicsemi.com/.../4572.ble_5F00_app_5F00_uart.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ble advertising and timer conflict</title><link>https://devzone.nordicsemi.com/thread/246828?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 12:27:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b30f15ca-3f9d-41e7-b858-b518605760ea</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Well, what are your goals here?&lt;br /&gt; What information are you sending over BLE?&lt;br /&gt;Why do you need the external adc? What signals are you sampling?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ble advertising and timer conflict</title><link>https://devzone.nordicsemi.com/thread/246806?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 12:07:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2a0639c-6892-45bc-a7ab-767ef53d02a4</guid><dc:creator>Folny</dc:creator><description>&lt;p&gt;I was considering using an esb library so it would work well but I want the device to work via bluetooth with a mobile phone so the only option is to send ads manually. So my question is, what command should I use in the code to send the ad ?.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ble advertising and timer conflict</title><link>https://devzone.nordicsemi.com/thread/246794?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 11:48:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e2d161b-74f4-4bd6-a5e3-5690ea3bf3f1</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Then you have three options:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Not use the SoftDevice.&lt;br /&gt;If all you&amp;#39;re going to do with BLE is to send periodic advertisements then you don&amp;#39;t really need the SoftDevice, you can control the RADIO directly and send advertisements when you have available CPU time.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;Use the PPI peripheral to create a state-machine that runs independently from the CPU, with the purpose of controlling the ADC.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;Use the SAADC peripheral instead. It has Direct Memory Access through EasyDMA, this means that you can run the SAADC independently from the CPU.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ble advertising and timer conflict</title><link>https://devzone.nordicsemi.com/thread/246737?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 09:39:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc1501cf-6240-4c48-98bd-77b57fa239a9</guid><dc:creator>Folny</dc:creator><description>&lt;p&gt;The code will be based on this principle but an external 18bit ADC AD7691 will be used.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/dc42/arduino/blob/master/MetalDetector/MetalDetector.ino"&gt;https://github.com/dc42/arduino/blob/master/MetalDetector/MetalDetector.ino&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ble advertising and timer conflict</title><link>https://devzone.nordicsemi.com/thread/246733?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 09:36:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:071873a4-b708-4ae6-8cfb-dca520e79bd3</guid><dc:creator>Folny</dc:creator><description>&lt;p&gt;The frequency will be about 40-80 kHz and must run continuously.&lt;/p&gt;
&lt;p&gt;Here is part of the code&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;int32_t AD7982_Read_GPIO(void){

  int16_t  AD_Data = 0;
  char BitCounts = 0;

  NRF_GPIO-&amp;gt;OUTSET = (1UL &amp;lt;&amp;lt; ADC_CNV_PIN);
  Delay_ADC(40);
  NRF_GPIO-&amp;gt;OUTCLR = (1UL &amp;lt;&amp;lt; ADC_CNV_PIN);
  Delay_ADC(10);
	
for(BitCounts = 0; BitCounts &amp;lt; 18; BitCounts++)
{
  AD_Data = AD_Data &amp;lt;&amp;lt; 1;
	NRF_GPIO-&amp;gt;OUTSET = (1UL &amp;lt;&amp;lt; ADC_CLK_PIN);
  AD_Data |= nrf_gpio_pin_read(ADC_MISO_PIN);
  NRF_GPIO-&amp;gt;OUTCLR = (1UL &amp;lt;&amp;lt; ADC_CLK_PIN);
}
  return AD_Data;
}

void TIMER2_IRQHandler(void){

  if (NRF_TIMER2-&amp;gt;EVENTS_COMPARE[0]){
			
  ctr++;
  ticks++;
	
  int32_t AD_Read = AD7982_Read_GPIO();
  bins[ctr] = AD_Read;
	
  if (ctr == SAMPLES -1)
  {
    ++numSamples;
    if (numSamples == numSamplesToAverage)
    {
      numSamples = 0;
      if (!sampleReady)     
      {
        memcpy((void*)averages, bins, sizeof(averages));
        sampleReady = true;
      }
      memset(bins, 0, sizeof(bins));
    }
		ctr = -1;
   } 
    NRF_TIMER2-&amp;gt;EVENTS_COMPARE[0] = 0;
  }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ble advertising and timer conflict</title><link>https://devzone.nordicsemi.com/thread/246710?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 08:41:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6de73ecd-5b22-44ad-85c5-8248337e04c0</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;At what sample rate?&lt;br /&gt;And for how long, continuously?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ble advertising and timer conflict</title><link>https://devzone.nordicsemi.com/thread/246705?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 08:30:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb9476d7-2176-42c3-9e7a-8d648a43b12f</guid><dc:creator>Folny</dc:creator><description>&lt;p&gt;Thank you for your answer but I don&amp;#39;t want to switch only GPIO I need it to read and sample data with AD7691.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ble advertising and timer conflict</title><link>https://devzone.nordicsemi.com/thread/246701?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 08:22:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c96a229-bd08-48c8-ad06-dc645e758ac3</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;The SoftDevice has execution priority during timing-critical radio events. That means that your TIMER&amp;#39;s ISR is blocked from executing during advertisements.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;If you need to toggle a GPIO based on a TIMER, you should use the PPI and GPIOTE peripherals. That way do not even need the TIMER interrupt at all.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Ble advertising and timer conflict</title><link>https://devzone.nordicsemi.com/thread/246654?ContentTypeID=1</link><pubDate>Sun, 26 Apr 2020 22:56:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec1c77cb-df3e-474c-89cd-18eca5d3e00c</guid><dc:creator>Folny</dc:creator><description>&lt;p&gt;Nobody knows how to solve this problem ? &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f61f.svg" title="Worried"&gt;&amp;#x1f61f;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>