<?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>sending data in BLE asynchronously</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/63210/sending-data-in-ble-asynchronously</link><description>Hi, 
 I am reading a 24-bit data from SPI by getting a data-ready interrupt from GPIOTE pin in a NRF52832 chip. I have to buffer data for the BLE interval duration then send data after minimum required interval for example every 30 ms. If SPI data-ready</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 Jul 2020 09:38:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/63210/sending-data-in-ble-asynchronously" /><item><title>RE: sending data in BLE asynchronously</title><link>https://devzone.nordicsemi.com/thread/258035?ContentTypeID=1</link><pubDate>Thu, 02 Jul 2020 09:38:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b209a335-99c5-4a85-8a88-705c524701df</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>[quote user="davidjonz2005"]I think that I may miss some data while I am sending data over BLE so I suggest sending data using DMA[/quote]
&lt;p&gt;Do you mean that you are missing data since the CPU is blocked by the softdevice and you cannot read out the samples from the ADC fast enough over SPI? Does the ADC not provide a FIFO or something that can allow you to read larger chunks of data?&lt;/p&gt;
&lt;p&gt;The alternative is to use &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/spim.html#topic"&gt;EasyDMA list feature&lt;/a&gt;&amp;nbsp;to receive multiple samples in consecutive buffers in RAM. You would then need some mechanism to count the number of completed transfers in RAM (for instance a TIMER in Count mode where the COUNT task is triggered though PPI on the END event from SPIM peripheral.&lt;/p&gt;
&lt;p&gt;The SPI master driver supports &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.0/hardware_driver_spi_master.html#hardware_driver_spi_advanced"&gt;advanced features&lt;/a&gt; to allow you do start a transfer using PPI, and to use the EasyDMA list feature with post-incrementing of the buffer addresses. Unfortunately, we do not have any examples showing how to use these features in the examples.&lt;/p&gt;
[quote user="davidjonz2005"]I currently use ble-uart example and I have problem to send all data using nRF52832. what service do you suggest or is there any example that can help me on this issue.[/quote]
&lt;p&gt;&amp;nbsp;This should be fine, you just need to send larger packets of multiple samples, and make sure you check all error codes to prevent data loss.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sending data in BLE asynchronously</title><link>https://devzone.nordicsemi.com/thread/257806?ContentTypeID=1</link><pubDate>Wed, 01 Jul 2020 11:39:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba402d66-a981-4276-b693-9393f020b8e3</guid><dc:creator>davidjonz2005</dc:creator><description>&lt;p&gt;Thank you for your response,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I got your point about DMA and SPIM so what is your suggestion about my problem. I am new to BLE and nRF, I explain my problem below,&lt;/p&gt;
&lt;p&gt;I need sampling ADC with a minimum rate of 640 Sps and every sample contains 6 bytes of data. my samples is interrupting system uniformly so I have an interrupt every 1.5 ms(I think that I may miss some data while I am sending data over BLE so I suggest sending data using DMA). I currently use ble-uart example and I have problem to send all data using nRF52832. what service do you suggest or is there any example that can help me on this issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sending data in BLE asynchronously</title><link>https://devzone.nordicsemi.com/thread/257796?ContentTypeID=1</link><pubDate>Wed, 01 Jul 2020 11:22:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a97836d-d187-4f93-8531-0d012d6b2d7b</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Both the&amp;nbsp;&lt;a title="SPI Master Example" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.0/spi_master_example.html?cp=7_1_4_6_37"&gt;SPI Master Example&lt;/a&gt;&amp;nbsp;and the&amp;nbsp;&lt;a title="nrfx SPI Master Example" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.0/nrfx_spim_example.html?cp=7_1_4_6_38"&gt;nrfx SPI Master Example&lt;/a&gt;&amp;nbsp;utilizes SPIM peripheral with EasyDMA support. The peripheral will clock out/fill the buffer with the requested buffer length before it generates any interrupts/events.&lt;/p&gt;
&lt;p&gt;Anyways, it sounds like you just need to store the SPI data in a larger buffer and transmit a larger buffer over BLE. DMA will not help with this, as the buffer provided to the SPIM peripheral would be overwritten if you start a new transfer with the same buffer. I&amp;#39;m not sure which BLE service you use to transfer data over BLE, but you would typically receive an error code if the transmit buffers are full. You&amp;nbsp;then need to wait for an event from the softdevice telling you that a transfer completed, in order to prevent data loss.&lt;/p&gt;
&lt;p&gt;Possibly the&amp;nbsp;&lt;a title="Ring buffer library" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.0/lib_ringbuf.html?cp=7_1_3_39"&gt;Ring buffer library&lt;/a&gt;&amp;nbsp;could be useful for your application. You fill it with the SPI data in the SPI event handler and transmit a larger chunk of data over BLE when the buffer has been filled enough.&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></channel></rss>