<?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 communication in a separate C file</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/25432/ble-communication-in-a-separate-c-file</link><description>I would like to separate the BLE communication from the main.c and place it to a separate file. I followed the example of the default ble_app_template as well as nordic&amp;#39;s services tutorial to create the BLE. It is working perfectly well when calling of</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 23 May 2018 08:59:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/25432/ble-communication-in-a-separate-c-file" /><item><title>RE: ble communication in a separate C file</title><link>https://devzone.nordicsemi.com/thread/132933?ContentTypeID=1</link><pubDate>Wed, 23 May 2018 08:59:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14968c55-1252-42d9-b707-6f2a8716115e</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I would recommend that you post your issue in a new thread where you describe the problem in detail, and also include your code. SDK 15 is quite different from any SDK that support nRF51 series (12.3.0 is the latest with nRF51 support). This will make it easier for other users to find the correct information for their versions if they face similar issues at a later point.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble communication in a separate C file</title><link>https://devzone.nordicsemi.com/thread/132500?ContentTypeID=1</link><pubDate>Fri, 18 May 2018 12:35:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b5c42ece-5d09-481c-83e3-e6af4918b8f6</guid><dc:creator>Kristian Hansen</dc:creator><description>&lt;p&gt;I have this problem too (with S140, SDK15.0) Did you find out what the problem was?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble communication in a separate C file</title><link>https://devzone.nordicsemi.com/thread/100240?ContentTypeID=1</link><pubDate>Thu, 28 Sep 2017 01:44:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21c1935c-5083-4806-ade1-16c6e48dcd78</guid><dc:creator>jj</dc:creator><description>&lt;p&gt;Thanks for the reply. I just uploaded the ble and main files here, please have a look. Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble communication in a separate C file</title><link>https://devzone.nordicsemi.com/thread/100241?ContentTypeID=1</link><pubDate>Wed, 27 Sep 2017 10:47:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9da237f-6221-4b14-b265-09012c6eec95</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Could you upload the ble and main files, showing exactly how you separated the BLE part in a separate file?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble communication in a separate C file</title><link>https://devzone.nordicsemi.com/thread/100239?ContentTypeID=1</link><pubDate>Tue, 26 Sep 2017 01:15:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebbc5655-ba49-4237-94f6-7c621cc7cd59</guid><dc:creator>jj</dc:creator><description>&lt;p&gt;Hi, I did tried placing the loop in both the main and separate c file but both are not working. And yes, I did debugging using J-link.
When the for loop is placed in main.c, I am able to initialise everything and return back to main but when I connect, it does not go into the on_ble_evt function case of BLE_GAP_EVT_CONNECTED to print a statement. Writing to it is not possible.
When the for loop is placed in the separate BLE communication file, the same thing happens as above, except that it is not return back to main this time. No error codes were returned anywhere.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble communication in a separate C file</title><link>https://devzone.nordicsemi.com/thread/100242?ContentTypeID=1</link><pubDate>Mon, 25 Sep 2017 14:05:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60356998-5998-49b3-af3f-9fe19056a651</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I would suggest you put the loop in main() function. It should not matter on the functionality, in what file the code is placed. Have you tried &lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/"&gt;debugging your application&lt;/a&gt;, to see if any error codes are returned anywhere?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>