<?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 hangs when UART initialized</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22807/ble-hangs-when-uart-initialized</link><description>I have reformatted the code I had added earlier. 
 Following is the sequence of code 
 uart_debug_init();

gap_params_init();
services_init();
advertising_init();
conn_params_init();
 
 Following is UART initialization code 
 uart_debug_init</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 14 Jul 2017 10:41:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22807/ble-hangs-when-uart-initialized" /><item><title>RE: ble hangs when UART initialized</title><link>https://devzone.nordicsemi.com/thread/89677?ContentTypeID=1</link><pubDate>Fri, 14 Jul 2017 10:41:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0322d2c-fac2-4815-9d86-115bf52769bd</guid><dc:creator>Melfice</dc:creator><description>&lt;p&gt;Please check if your code has run the log_init().
Also, in your sdk_config.h file, Check if NRF_LOG_DEFERRED and NRF_LOG_DEFAULT_LEVEL is set.
They should be set to 0.
The ANCS sample include LOG function and it will use UART, it initialize UART once. Then, in your code, you initialize UART again. This will cause problem.
Just some suggestions for your reference.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble hangs when UART initialized</title><link>https://devzone.nordicsemi.com/thread/89678?ContentTypeID=1</link><pubDate>Mon, 10 Jul 2017 21:36:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec80ed57-abb6-4730-85cd-08567ef09c7e</guid><dc:creator>Shreyas Shivalkar</dc:creator><description>&lt;p&gt;I am using nRF52832 (nRF52 dev board). Without the boot-loader as well the application crashes and &amp;#39;Default Handler&amp;#39; is called.&lt;/p&gt;
&lt;p&gt;Is there a way, you guys can review my code(project) to see what is going on.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble hangs when UART initialized</title><link>https://devzone.nordicsemi.com/thread/89679?ContentTypeID=1</link><pubDate>Thu, 29 Jun 2017 14:59:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15bc8755-72d2-4baf-9723-0562e8af2609</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;That looks okay, assuming you are using nRF52832?&lt;/p&gt;
&lt;p&gt;What happens if you run the application without the bootloader?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble hangs when UART initialized</title><link>https://devzone.nordicsemi.com/thread/89670?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2017 20:03:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:118f109b-cffd-43c4-a2db-692027d58940</guid><dc:creator>Shreyas Shivalkar</dc:creator><description>&lt;p&gt;Flash/RAM settings according to map file are as follows&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Total RO  Size (Code + RO Data)                53724 (  52.46kB)
Total RW  Size (RW Data + ZI Data)             11688 (  11.41kB)
Total ROM Size (Code + RO Data + RW Data)      53800 (  52.54kB)
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble hangs when UART initialized</title><link>https://devzone.nordicsemi.com/thread/89681?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2017 09:25:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a37a05c9-a5b6-4352-88c9-e7ac55869325</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;What are your flash/RAM settings? And how much flash/RAM is being used, according to the .map file?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble hangs when UART initialized</title><link>https://devzone.nordicsemi.com/thread/89676?ContentTypeID=1</link><pubDate>Mon, 26 Jun 2017 19:42:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2bbb4c33-5d22-489f-ad99-6cf7079188dd</guid><dc:creator>Shreyas Shivalkar</dc:creator><description>&lt;p&gt;No Luck yet. The application crashes and &amp;#39;Default Handler&amp;#39; is called. I am trying to figure out why and where &amp;#39;Default Handler&amp;#39; is called from.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble hangs when UART initialized</title><link>https://devzone.nordicsemi.com/thread/89675?ContentTypeID=1</link><pubDate>Mon, 26 Jun 2017 13:11:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce4e92a5-dbbe-4f43-90a9-530179965db6</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Is the problem solved?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble hangs when UART initialized</title><link>https://devzone.nordicsemi.com/thread/89673?ContentTypeID=1</link><pubDate>Fri, 23 Jun 2017 22:28:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b58706fd-ec95-4893-8ee0-cfdd4e4256ea</guid><dc:creator>Shreyas Shivalkar</dc:creator><description>&lt;p&gt;I was not sure how NRF_LOG was setup because somebody else did it, so I have disabled the NRF_LOG completely and commented out NRF_LOG statements.
Still Uart neither sends any data nor generates any error. But the application goes into default handler.&lt;/p&gt;
&lt;p&gt;Edit: After lot of debugging, I also found out that application crashed and device went into boot-loader mode.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble hangs when UART initialized</title><link>https://devzone.nordicsemi.com/thread/89674?ContentTypeID=1</link><pubDate>Thu, 22 Jun 2017 06:23:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:172daa22-7135-4523-8c9d-9cb60e83a526</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Do you have set up NRF_LOG to use UART or RTT. If NRF_LOG uses UART and you also use UART  separately, there will be problems.&lt;/p&gt;
&lt;p&gt;If you use UART separately, NRF_LOG will have to use RTT-&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble hangs when UART initialized</title><link>https://devzone.nordicsemi.com/thread/89671?ContentTypeID=1</link><pubDate>Wed, 21 Jun 2017 21:07:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68684a2f-a6b1-45ad-a9d8-e2832b144fa3</guid><dc:creator>Shreyas Shivalkar</dc:creator><description>&lt;p&gt;I have a ext 32KHz crystal on my board(Came with nRF52 module). Per your suggestions I reorganized my code.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL);
uart_debug_init();
err_code = NRF_LOG_INIT(NULL);
APP_ERROR_CHECK(err_code);
ble_stack_init();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Uart initialization and Services initialization was successful. But the application went into &lt;code&gt;Default Handler&lt;/code&gt; when I tried to send data on UART.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;while(app_uart_put(ble_tgl_status) != NRF_SUCCESS);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble hangs when UART initialized</title><link>https://devzone.nordicsemi.com/thread/89680?ContentTypeID=1</link><pubDate>Tue, 20 Jun 2017 13:09:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5c6dd23-33d6-4df9-a1e9-913e75589252</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Do I understand you correctly that the exact code does work on the nRF52-DK, but not on your custom board?  If so, remember that the examples in the SDK by default use external 32 kHz crystal.&lt;/p&gt;
&lt;p&gt;When your board fails, if you run the chip in debug mode, where does it fail&amp;#39;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble hangs when UART initialized</title><link>https://devzone.nordicsemi.com/thread/89672?ContentTypeID=1</link><pubDate>Mon, 19 Jun 2017 19:50:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd93d669-b631-416a-85b0-f2194f2ba61c</guid><dc:creator>Shreyas Shivalkar</dc:creator><description>&lt;p&gt;I tried the method you suggested. But the application still got stuck.&lt;/p&gt;
&lt;p&gt;Uart initialization was successful. But services initialization failed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble hangs when UART initialized</title><link>https://devzone.nordicsemi.com/thread/89669?ContentTypeID=1</link><pubDate>Fri, 16 Jun 2017 07:27:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25c09cc5-57c9-4cd0-ac53-0b809b7c47d1</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Could you do UART initialization before softdevice initialization (ble_stack_init() )
and check if that changes anything?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble hangs when UART initialized</title><link>https://devzone.nordicsemi.com/thread/89667?ContentTypeID=1</link><pubDate>Thu, 15 Jun 2017 21:52:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b192511-0f85-4acc-be57-c4428df407d8</guid><dc:creator>Shreyas Shivalkar</dc:creator><description>&lt;p&gt;&lt;code&gt;ble_device_info_service_ins&lt;/code&gt; is the name of my SOC. It works fine when UART code is commented out.&lt;/p&gt;
&lt;p&gt;In case of debugging, it breaks on&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;memset(&amp;amp;ble_device_info_service_ins, 0, sizeof(ble_device_info_service_ins));
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;but kind of hangs at&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ble_device_info_service_ins.conn_handle = BLE_CONN_HANDLE_INVALID;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Any thoughts?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble hangs when UART initialized</title><link>https://devzone.nordicsemi.com/thread/89665?ContentTypeID=1</link><pubDate>Thu, 15 Jun 2017 02:44:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f54c3f25-21a8-4da6-bd2e-d3facebd38d9</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;I reformatted your code for you - you have to leave a blank line between text and code.
What&amp;#39;s &amp;amp;ble_device_info_service_ins? If it&amp;#39;s an invalid memory location you&amp;#39;re getting a hardfault or memory fault.&lt;/p&gt;
&lt;p&gt;MCUs don&amp;#39;t hang. They don&amp;#39;t just stop working, the are in a handler, a fault handler or something. All you have to do is hit the &amp;#39;break&amp;#39; button on your debugger and you&amp;#39;ll see where it is.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble hangs when UART initialized</title><link>https://devzone.nordicsemi.com/thread/89666?ContentTypeID=1</link><pubDate>Thu, 15 Jun 2017 01:43:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1932350-a35c-4ef7-9102-ad09f3e2e789</guid><dc:creator>Shreyas Shivalkar</dc:creator><description>&lt;p&gt;I have checked the error code. It is 0x00 i.e. NRF_SUCCESS.&lt;/p&gt;
&lt;p&gt;in my service initialization code, code hangs at memset&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t err_code;
ble_uuid_t service_uuid;
ble_uuid128_t base_uuid = RP_BASE_UUID;

service_uuid.uuid = BLE_UUID_RP_DEVICE_INFO_SERVICE;
err_code = sd_ble_uuid_vs_add(&amp;amp;base_uuid, &amp;amp;service_uuid.type);
APP_ERROR_CHECK(err_code);

// Initialize service structure
memset(&amp;amp;ble_device_info_service_ins, 0, sizeof(ble_device_info_service_ins));
ble_device_info_service_ins.conn_handle = BLE_CONN_HANDLE_INVALID;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let me know if you have any insights.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble hangs when UART initialized</title><link>https://devzone.nordicsemi.com/thread/89668?ContentTypeID=1</link><pubDate>Thu, 15 Jun 2017 01:31:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f9091c2-c5fd-440e-a123-e4e53b4f3ac7</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;What does this&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;line of code do? If you have an error then the application isn&amp;#39;t &amp;#39;hanging&amp;#39; it&amp;#39;s going to your error handler.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>