<?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>nRF environment coding suggestions</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22959/nrf-environment-coding-suggestions</link><description>Dear all, 
 I am facing small problems, which I guess most of you faced at some moment. 
 I am trying to switch from working with ST microcontrollers to working with nRF52. Both of them are pretty similar, so that&amp;#39;s cool. On ST (and not only), I wrote</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 22 Jun 2017 10:55:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22959/nrf-environment-coding-suggestions" /><item><title>RE: nRF environment coding suggestions</title><link>https://devzone.nordicsemi.com/thread/90334?ContentTypeID=1</link><pubDate>Thu, 22 Jun 2017 10:55:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84e2c0f3-cfed-4a19-8bcc-85c861c2ef91</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;&lt;strong&gt;1)&lt;/strong&gt; If some processing is continuously being done in the main loop (for(;;) ), it will not be possible to have some power management. If you want some power management (power saving), I would recommend you to run the application &amp;quot;interrupt driven&amp;quot;. If you run the application &amp;quot;interrupt driven&amp;quot;, the chip does only need to wake up upon events, BLE events, TWI (I2C) events, and UART events, and go back to sleep (system ON) when the processing of those events is finished.&lt;/p&gt;
&lt;p&gt;If you have interrupts that require some processing time (the 1000 samples), you can push processing of those  samples to a separate interrupt, running on lower priority than UART/TWI/BLE, so that you don&amp;#39;t miss any interrupts when doing the processing, and the chip can go to sleep when the processing has finished.&lt;/p&gt;
&lt;p&gt;The following example shows how to push processing to another interrupt: &lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/ble_5F00_app_5F00_uart_5F00_test_5F00_throughput_5F00_irq.zip"&gt;ble_app_uart_test_throughput_irq.zip&lt;/a&gt; (SDK 12.0.0, S132 v.3.0.0) The relevant part is everything related to &lt;code&gt;DATA_SEND_IRQ&lt;/code&gt;. The interrupt is borrowed from an unused peripheral.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2)&lt;/strong&gt; The purpose of the drivers is to make it easier to use a given peripheral. Whether or not you want to use the drivers is up to you. The ideal thought is that it should not be necessary to modify the drivers, however, if you need/want to modify them, you are free to do so.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3)&lt;/strong&gt; When the softdevice is enabled, the LFCLK will run continuously. The &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.sds%2Fdita%2Fsoftdevices%2Fs130%2Fs130sds.html&amp;amp;cp=2_3_0_0"&gt;softdevice specification&lt;/a&gt; explains how the softdevice work.  The HFCLK will be controlled by the softdevice, so if your application needs the HFLCK, the &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v4.0.2%2Fgroup___n_r_f___s_o_c___f_u_n_c_t_i_o_n_s.html&amp;amp;cp=2_3_0_1_1_2_7_2"&gt;sd_clock_hfclk_xxx()&lt;/a&gt; API should be used.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v4.0.2%2Fgroup___n_r_f___s_o_c___f_u_n_c_t_i_o_n_s.html&amp;amp;cp=2_3_0_1_1_2_7_2_0&amp;amp;anchor=ga11d88d38ac99fb72cde74c9385d36433"&gt;sd_app_wait()&lt;/a&gt; puts the chip in system ON.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4)&lt;/strong&gt; Related to the questions above, it would not make any difference if the chip is a BLE peripheral, central, or both.&lt;/p&gt;
&lt;p&gt;The two latest versions of S140, S140 v.5.0.0-2.alpha and S140 v. 5.0.0-3-alpha, both support up to 20 concurrent connections.&lt;/p&gt;
&lt;p&gt;A range of 20 m is not so much, and it should normally be quite easy to obtain that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>