<?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>libuarte init with ANT softdevice ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/71850/libuarte-init-with-ant-softdevice</link><description>Dear Members, 
 I want to use libuarte with ANT and softdevice, 
 When I initialize libuarte, 
 The app keeps restarting by itself. 
 
 
 I commented out 
 //err_code=nrf_drv_clock_init(); 
 //nrf_drv_clock_lfclk_request(NULL); 
 //nrf_libuarte_async_enable</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 22 Feb 2021 14:29:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/71850/libuarte-init-with-ant-softdevice" /><item><title>RE: libuarte init with ANT softdevice ?</title><link>https://devzone.nordicsemi.com/thread/295637?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 14:29:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26aa30a5-3060-426e-855b-4c37a672855b</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know, really. I need to see all to get an overview. There is one thing we can try first, though. Referring to:&lt;/p&gt;
[quote user="RixtronixLAB"]&lt;p&gt;and the app gives me&amp;nbsp; :&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;rror&amp;gt; app: Fatal error&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&lt;br /&gt;arning&amp;gt; app: System reset&lt;/p&gt;[/quote]
&lt;p&gt;If you define DEBUG and DEBUG_NRF in your project settings (if you use a SES SDK project it should be enough to just select the &amp;quot;Debug&amp;quot; target), then you will get much more information in the error message. You should see where the fatal error comes from, and why. With that it should be much easier to pin-point the problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte init with ANT softdevice ?</title><link>https://devzone.nordicsemi.com/thread/295636?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 14:29:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4078c127-e220-455e-9359-e0aa2a29ff54</guid><dc:creator>RixtronixLAB</dc:creator><description>&lt;p&gt;I used timer3 and it&amp;#39;s now giving me a proper response,&lt;/p&gt;
&lt;p&gt;NRF_LIBUARTE_ASYNC_DEFINE(libuarte1, 1, 3, 2, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3); //timer0 id =2, rtc1 id =2..&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for helping, I&amp;#39;ll keep posting and share the progress....thanks again..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte init with ANT softdevice ?</title><link>https://devzone.nordicsemi.com/thread/295634?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 14:23:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15880172-4d03-4060-8086-7b893ea9e6eb</guid><dc:creator>RixtronixLAB</dc:creator><description>&lt;p&gt;is my &amp;quot;create_timers();&amp;quot; crashed with libuarte1 timer ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte init with ANT softdevice ?</title><link>https://devzone.nordicsemi.com/thread/295631?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 14:21:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f4e51ef-4753-46d0-a271-275cd3bbaee0</guid><dc:creator>RixtronixLAB</dc:creator><description>&lt;p&gt;Which part of code do you want to see ? &lt;/p&gt;
&lt;p&gt;I make a copy of main function, hang on...&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;int main(void)
{
	ret_code_t err_code;
	float convert;
	
	 // This function contains workaround for PAN_028 rev2.0A anomalies 28, 29,30 and 31.
    
   uint32_t tick;			
		
	  
    log_init();
    utils_setup();
    softdevice_setup();
	    //**Init I2C and EEPROM before ant started, in order toclear EEPROM before sensor start TEST**
	    ssd1306_init_i2c(SSD1306_CONFIG_SCL_PIN, SSD1306_CONFIG_SDA_PIN);
			eeprom_cmd_clear_distance(); 
	    //initialize time for distance saving
			m_speed_calc_data.acc_evt_time=0; 
	
    profile_setup();
	
	  create_timers();
	 
	  /* Init systick driver */
    nrf_drv_systick_init();
	 
	 app_timer_start(m_repeated_timer_id, APP_TIMER_TICKS(1000), NULL);
	   //SSD1306 Code
	    // ssd1306_init_i2c(SSD1306_CONFIG_SCL_PIN, SSD1306_CONFIG_SDA_PIN);
	   ssd1306_begin(SSD1306_SWITCHCAPVCC, SSD1306_I2C_ADDRESS, false);
	   ssd1306_clear_display(); //Rixtronix LAB
		    //nrf_delay_ms(1000);
        ssd1306_display();
	      nrf_delay_ms(500);
	      NRF_LOG_INFO(&amp;quot;--- testdrawline ---&amp;quot;);
        //
        ssd1306_draw_circle(SSD1306_LCDWIDTH / 2, SSD1306_LCDHEIGHT / 2, 30, WHITE);
	       nrf_delay_ms(1000);
        ssd1306_display();
	        nrf_delay_ms(1000);
           //convert int32_t to float
         ieee_float();	
     				nrf_delay_ms(1000); 
			
			 /**********init from libuarte*****/
			 //err_code=nrf_drv_clock_init();
			 //APP_ERROR_CHECK(err_code);
			// NRF_LOG_INFO(&amp;quot;Err_code nrf_drv_clk %u&amp;quot;,err_code);
			 
			 //nrf_drv_clock_lfclk_request(NULL);
				
				nrf_libuarte_async_config_t nrf_libuarte_async_config1 = {
            .tx_pin     = SER_APP_TX_PIN,
            .rx_pin     = SER_APP_RX_PIN,
            .baudrate   = NRF_UARTE_BAUDRATE_9600,
            .parity     = NRF_UARTE_PARITY_EXCLUDED,
            .hwfc       = NRF_UARTE_HWFC_DISABLED,
            .timeout_us = 1000,
            .int_prio   = APP_IRQ_PRIORITY_LOW
			      
    };
		err_code=nrf_libuarte_async_init(&amp;amp;libuarte1, &amp;amp;nrf_libuarte_async_config1, uart_event_handler1, (void *)&amp;amp;libuarte1);
			APP_ERROR_CHECK(err_code);
		NRF_LOG_INFO(&amp;quot;Err_code libuarte_init libuarte1 %u&amp;quot;,err_code);
  	nrf_libuarte_async_enable(&amp;amp;libuarte1);

    GPS_Init();		
		/**********init from libuarte*****/
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte init with ANT softdevice ?</title><link>https://devzone.nordicsemi.com/thread/295630?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 14:17:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5472df21-5ecb-4986-a7f8-ca74cd3abf51</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I see. There should be no difference at all. You just need to ensure that you do not try to use peripherals that are used by the SoftDevice or other libraries. If you still struggle, perhaps you can share your code so that I can see?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte init with ANT softdevice ?</title><link>https://devzone.nordicsemi.com/thread/295629?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 14:17:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94fc76b4-d727-48fb-bc13-17338c64cef1</guid><dc:creator>RixtronixLAB</dc:creator><description>&lt;p&gt;which part of application do you want to see ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte init with ANT softdevice ?</title><link>https://devzone.nordicsemi.com/thread/295626?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 14:16:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b256b90d-0f59-489f-a6ed-6d561abe7633</guid><dc:creator>RixtronixLAB</dc:creator><description>&lt;p&gt;&lt;br /&gt;rror&amp;gt; hardfault: HARD FAULT at 0x00017FB8&lt;br /&gt; &lt;br /&gt;&amp;lt;error&amp;gt; hardfault: R0: 0x20001064 R1: 0x39000000 R2: 0x00000010 R3: 0x0&lt;/p&gt;
&lt;p&gt;0000F&lt;/p&gt;
&lt;p&gt;rror&amp;gt; hardfault: R12: 0x20000E08 LR: 0x0001E39F PSR: 0x21000029&lt;br /&gt; &lt;br /&gt;&amp;lt;error&amp;gt; hardfault: Cause: Data bus error (PC value stacked for the exception ret&lt;/p&gt;
&lt;p&gt;n points to the instruction that caused the fault).&lt;/p&gt;
&lt;p&gt;rror&amp;gt; hardfault: Bus Fault Address: 0x39000000&lt;br /&gt; &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte init with ANT softdevice ?</title><link>https://devzone.nordicsemi.com/thread/295625?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 14:15:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c5b3206-cfe4-4471-b14c-b282cdd07196</guid><dc:creator>RixtronixLAB</dc:creator><description>&lt;p&gt;I&amp;#39;m using libuarte for UART1 only now,&lt;/p&gt;
&lt;p&gt;NRF_LIBUARTE_ASYNC_DEFINE(libuarte1, 1, 2, 2, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3); //timer0 id =2, rtc1 id =2&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;and the app gives me&amp;nbsp; :&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;rror&amp;gt; app: Fatal error&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&lt;br /&gt;arning&amp;gt; app: System reset&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte init with ANT softdevice ?</title><link>https://devzone.nordicsemi.com/thread/295623?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 14:12:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c42221fd-0d1e-4dd7-b2cc-7a1edac2b2fe</guid><dc:creator>RixtronixLAB</dc:creator><description>&lt;p&gt;it works well when I implement from the libuarte example, but when I merge with ANT and softdevice, it&amp;#39;s stop working....&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte init with ANT softdevice ?</title><link>https://devzone.nordicsemi.com/thread/295616?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 14:07:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50375f7e-04db-41a5-9dba-65f7a5c8993b</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It is not clear to me how your application looks, so it is difficult to suggest much.&lt;/p&gt;
&lt;p&gt;I noticed this though:&lt;/p&gt;
[quote user=""]&lt;p&gt;I commented out&lt;/p&gt;
&lt;p&gt;&amp;nbsp;//err_code=nrf_drv_clock_init();&lt;/p&gt;
&lt;p&gt;&amp;nbsp;//nrf_drv_clock_lfclk_request(NULL);&lt;/p&gt;
&lt;p&gt;//nrf_libuarte_async_enable(&amp;amp;libuarte1);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;to stabilize the application,&lt;/p&gt;[/quote]
&lt;p&gt;The first two is not directly related to the libuarte, and if you use a SoftDevice the LFCKL is allready started, so it does not matter if you use it or not. However, you need to call&amp;nbsp;nrf_libuarte_async_enable() before using it. To be honest it is not so reassuring if you comment out blindly in order to attempt to stabilize the application. May I suggest you refer to the libuarte example in the SDK? That shows you how to use it.&lt;/p&gt;
&lt;p&gt;Once you understand the example you can copy it to your application and make necessary adjustments, where we come to this:&lt;/p&gt;
[quote user=""]&lt;p&gt;Is &lt;br /&gt;NRF_LIBUARTE_ASYNC_DEFINE(libuarte, 0, 0, 0, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3);&lt;/p&gt;
&lt;p&gt;conflicting with my current UART setting for NRF_LOG in softdevice ? it&amp;#39;s using the same port UART0&lt;/p&gt;[/quote]
&lt;p&gt;Yes, you cannot use the same peripheral for two things (at the same time). The libuarte is quite resource intensive, and needs a UARTE instance two timers and and RTC, as you can see from the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/group__nrf__libuarte__async.html?cp=7_1_6_10_28_8#ga9dd1619dcfe11f532ed96e37ebd2aca4"&gt;API doc of&amp;nbsp;NRF_LIBUARTE_ASYNC_DEFINE&lt;/a&gt;. You need to ensure that there are no overlaps. When doing so, keep in mind that the SoftDevice use TIMER0 and RTC0. So that cannot be used. The app_timer use RTC1, which you typically want to use, so that should also be avoided.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte init with ANT softdevice ?</title><link>https://devzone.nordicsemi.com/thread/295609?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 14:00:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53337412-0821-45d6-914f-b16d476e53a3</guid><dc:creator>RixtronixLAB</dc:creator><description>&lt;p&gt;Video shot :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://youtu.be/V3RvezAeIs8"&gt;nRF52840 HARD FAULT Softdevice libuarte ANT&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte init with ANT softdevice ?</title><link>https://devzone.nordicsemi.com/thread/295603?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 13:48:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0161ce1-699a-4ee3-b5d3-1e1d19d36fde</guid><dc:creator>RixtronixLAB</dc:creator><description>&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/2021_2D00_02_2D00_22-21_5F00_56_5F00_58_2D00_G_5F005F00_nRF5_5F00_SDK_5F00_17.0.2_5F00_d674dde_5F00_examples_5F00_ant_5F00_experimental_5F00_ant_5F00_shared_5F00_channel_5F00_m2m_5F00_pca1.png" /&gt;&lt;/p&gt;
&lt;p&gt;SDK config&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte init with ANT softdevice ?</title><link>https://devzone.nordicsemi.com/thread/295602?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 13:47:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93fb4f70-c58d-40cf-8891-1d3bbf412e67</guid><dc:creator>RixtronixLAB</dc:creator><description>&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/2021_2D00_02_2D00_22-21_5F00_56_5F00_07_2D00_G_5F005F00_nRF5_5F00_SDK_5F00_17.0.2_5F00_d674dde_5F00_examples_5F00_ant_5F00_experimental_5F00_ant_5F00_shared_5F00_channel_5F00_m2m_5F00_pca1.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte init with ANT softdevice ?</title><link>https://devzone.nordicsemi.com/thread/295601?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 13:46:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:447dbb8b-ca23-49dd-a3a9-7f98b5ddfabf</guid><dc:creator>RixtronixLAB</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;//NRF_LIBUARTE_ASYNC_DEFINE(libuarte, 0, 0, 0, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3);
NRF_LIBUARTE_ASYNC_DEFINE(libuarte1, 1, 2, 2, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3); //timer0 id =2, rtc1 id =2
.
.
.

				nrf_libuarte_async_config_t nrf_libuarte_async_config1 = {
            .tx_pin     = SER_APP_TX_PIN,
            .rx_pin     = SER_APP_RX_PIN,
            .baudrate   = NRF_UARTE_BAUDRATE_9600,
            .parity     = NRF_UARTE_PARITY_EXCLUDED,
            .hwfc       = NRF_UARTE_HWFC_DISABLED,
            .timeout_us = 1000,
            .int_prio   = APP_IRQ_PRIORITY_LOW
			      
    };
		err_code=nrf_libuarte_async_init(&amp;amp;libuarte1, &amp;amp;nrf_libuarte_async_config1, uart_event_handler1, (void *)&amp;amp;libuarte1);
			APP_ERROR_CHECK(err_code);
		NRF_LOG_INFO(&amp;quot;Err_code libuarte_init libuarte1 %u&amp;quot;,err_code);
  	nrf_libuarte_async_enable(&amp;amp;libuarte1);

    GPS_Init();		&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte init with ANT softdevice ?</title><link>https://devzone.nordicsemi.com/thread/295450?ContentTypeID=1</link><pubDate>Sat, 20 Feb 2021 23:42:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02ceeac7-5f65-49c5-acc6-2410306c0607</guid><dc:creator>RixtronixLAB</dc:creator><description>&lt;p&gt;I get :&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;nfo&amp;gt; app: Err_code libuarte_init libuarte1 = 0&lt;br /&gt;&amp;nbsp; &amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>