<?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>my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/82011/my-program-is-getting-stuck-in-assert_nrf_callback-while-using-nrf_drv_twi_tx-function</link><description>Hi, I&amp;#39;m using nrf52832 custom board and 14.2 SDK, S132. 
 In my program I&amp;#39;m using SAADC, PWM, I2C along with softdevice and PID. my device is working fine for some time but after certain time (10-15 sec) of running it&amp;#39;s going to assert_nrf_callback because</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 30 Nov 2021 15:06:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/82011/my-program-is-getting-stuck-in-assert_nrf_callback-while-using-nrf_drv_twi_tx-function" /><item><title>RE: my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/thread/341350?ContentTypeID=1</link><pubDate>Tue, 30 Nov 2021 15:06:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac69f835-50b5-4e93-ac27-bb2de150eb25</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Then I would suggest you contact the chip vendor. They may know if this is expected behavior or not.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/thread/341348?ContentTypeID=1</link><pubDate>Tue, 30 Nov 2021 14:59:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:350a2761-a80b-42f8-8bb7-a96a1d976907</guid><dc:creator>Kapil Rawat</dc:creator><description>&lt;p&gt;Yes, I&amp;#39;m using that as a temporary solution as after NRF_DRV_TWI_EVT_DATA_NACK it&amp;#39;s error next time function is successful.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But out of 100, 3-4 times I&amp;#39;m keep getting this error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/thread/341345?ContentTypeID=1</link><pubDate>Tue, 30 Nov 2021 14:47:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87260089-d8cd-4c80-877b-fe75ac0f6fa6</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure what sure under what conditions this IC will NACK the command. Maybe there is a limitation on how frequent you can send it. I suggest you try to to set m_xfer_done=true on NRF_DRV_TWI_EVT_DATA_NACK to see if it keeps rejecting your command.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/thread/341152?ContentTypeID=1</link><pubDate>Mon, 29 Nov 2021 19:47:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a380eda5-16c5-4386-816c-b67ec3ab90c1</guid><dc:creator>Kapil Rawat</dc:creator><description>&lt;p&gt;I placed breakpoints in both of these events and device is got stuck in &lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    NRF_LOG_INFO(&amp;quot;TWI NRF_DRV_TWI_EVT_DATA_NACK\n&amp;quot;);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;After running for more than 25- 30 min.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/thread/341048?ContentTypeID=1</link><pubDate>Mon, 29 Nov 2021 11:19:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6758492-3a4e-4c9c-93d5-76a57ecf3530</guid><dc:creator>Kapil Rawat</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/82011/my-program-is-getting-stuck-in-assert_nrf_callback-while-using-nrf_drv_twi_tx-function/341044#341044"]The priority must be higher than the the app timer interrupt you are calling it from. The TWI callback will become blocked otherwise. [/quote]
&lt;p&gt;After setting priority to APP_IRQ_PRIORITY_LOW device is most of time device is working as expected . &lt;br /&gt;&lt;br /&gt;&amp;nbsp; &lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/82011/my-program-is-getting-stuck-in-assert_nrf_callback-while-using-nrf_drv_twi_tx-function/341044#341044"] Can you place a breakpoint in both of these events to see if they occur?[/quote]
&lt;p&gt;sure I&amp;#39;ll check it. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/thread/341044?ContentTypeID=1</link><pubDate>Mon, 29 Nov 2021 10:54:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:978650e5-0b98-45eb-8f35-b663d51286a0</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;So&amp;nbsp;m_xfer_done will never be set if you get a&amp;nbsp; NRF_DRV_TWI_EVT_ADDRESS_NACK or NRF_DRV_TWI_EVT_DATA_NACK event. Can you place a breakpoint in both of these events to see if they occur?&lt;/p&gt;
[quote userid="10479" url="~/f/nordic-q-a/82011/my-program-is-getting-stuck-in-assert_nrf_callback-while-using-nrf_drv_twi_tx-function/341042#341042"]I have set my TWI interrupt priority from APP_IRQ_PRIORITY_HIGH to APP_IRQ_PRIORITY_LOW[/quote]
&lt;p&gt;The priority must be higher than the the app timer interrupt you are calling it from. The TWI callback will become blocked otherwise. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/thread/341042?ContentTypeID=1</link><pubDate>Mon, 29 Nov 2021 10:47:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0873f655-b00d-4edd-a692-fea238eaf707</guid><dc:creator>Kapil Rawat</dc:creator><description>&lt;p&gt;I have set my TWI interrupt priority from APP_IRQ_PRIORITY_HIGH to APP_IRQ_PRIORITY_LOW but now I&amp;#39;m getting same problem randomly sometime after 10 to 60&amp;nbsp; cycles.&lt;br /&gt;please find twi_handler() callback function below:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void twi_handler(nrf_drv_twi_evt_t const * p_event, void * p_context)
{
    switch (p_event-&amp;gt;type)
    {
        case NRF_DRV_TWI_EVT_DONE:
            if (p_event-&amp;gt;xfer_desc.type == NRF_DRV_TWI_XFER_TX)
            {
                m_xfer_done = true;
            }
            if (p_event-&amp;gt;xfer_desc.type == NRF_DRV_TWI_XFER_RX)
            {
                m_read_done = true;
            }
           //NRF_LOG_INFO(&amp;quot;TWI NRF_DRV_TWI_EVT_DONE\n&amp;quot;);
           break;

        case NRF_DRV_TWI_EVT_ADDRESS_NACK:
            NRF_LOG_INFO(&amp;quot;TWI NRF_DRV_TWI_EVT_ADDRESS_NACK\n&amp;quot;);
            break;
        
        case NRF_DRV_TWI_EVT_DATA_NACK:
            NRF_LOG_INFO(&amp;quot;TWI NRF_DRV_TWI_EVT_DATA_NACK\n&amp;quot;);
            break;
        
        default:
            m_xfer_done = true;
            break;
    }
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/thread/340841?ContentTypeID=1</link><pubDate>Fri, 26 Nov 2021 08:55:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a95cdcb5-75d6-4ba6-8dec-a603e11a6977</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;OK, you are using the TWI driver in non-blocking mode. What is interrupt priority did you select for the TWI driver? Can you also show how you have implemented your twi_handler() callback?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/thread/340801?ContentTypeID=1</link><pubDate>Thu, 25 Nov 2021 19:35:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29670959-0d5d-4ad4-988c-a03ec0ad0ec8</guid><dc:creator>Kapil Rawat</dc:creator><description>&lt;p&gt;I&amp;#39;m sharing debug screenshot,&amp;nbsp; program ends up here&lt;br /&gt;&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/6242.error_5F00_2.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/thread/340761?ContentTypeID=1</link><pubDate>Thu, 25 Nov 2021 14:06:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcf9fdd0-44cb-46c6-98be-54fc3039957d</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I understand, but I would like to know where in your code the program gets stuck. Are you familiar with debugging in SES? Can you pause the debugger to see where it ends up after the error occured?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/thread/340739?ContentTypeID=1</link><pubDate>Thu, 25 Nov 2021 13:09:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c062e70f-3e20-4b5b-9791-29ea54e24993</guid><dc:creator>Kapil Rawat</dc:creator><description>&lt;p&gt;In my device there is one function which repeat itself for 40 times and each time it update it&amp;#39;s parameter.&amp;nbsp; For first 6 -10 time function working as expected but after that device not responding and&amp;nbsp; required power off to reset.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/thread/340718?ContentTypeID=1</link><pubDate>Thu, 25 Nov 2021 12:28:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64cba1b9-4636-4932-b273-6c0211e637d8</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Can you pause the debugger to see where it gets stuck?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/thread/340717?ContentTypeID=1</link><pubDate>Thu, 25 Nov 2021 12:27:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5946cda8-1d24-4ead-8025-817f16786373</guid><dc:creator>Kapil Rawat</dc:creator><description>&lt;p&gt;Yes I tried but not getting any error in debug mode. It&amp;#39;s getting stuck somewhere else.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/thread/340576?ContentTypeID=1</link><pubDate>Wed, 24 Nov 2021 14:24:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b530adf-65c1-49ce-a5ba-13734fe8682d</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Have you built the project with the &amp;quot;Debug&amp;quot; configuration?&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1637763797676v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;This should make the app_error_fault_handler() in app_error_weak.c print out a crash log with information about the error code and where it was returned.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1637763868739v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/thread/340494?ContentTypeID=1</link><pubDate>Wed, 24 Nov 2021 10:07:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecb4e3eb-1d39-4480-85fd-451efe5ccee7</guid><dc:creator>Kapil Rawat</dc:creator><description>&lt;p&gt;I&amp;#39;m using &lt;a href="https://www.analog.com/media/en/technical-documentation/data-sheets/2631fd.pdf"&gt;LTC2631&lt;/a&gt;, 12 bit DAC IC for write operation using using below code:&lt;/p&gt;
&lt;p&gt;#define LTC2631_BASE_ADDRESS&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x73&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //!&amp;lt; LTC2631 base address&amp;nbsp; //0010000&lt;br /&gt;&lt;br /&gt;#define LTC2631_DAC_ADDRESS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x30&amp;nbsp; //!&amp;lt; LTC2631 write-to-dac register&lt;br /&gt;#define LTC2631_EEPROM_ADDRESS&amp;nbsp; 0x60&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //!&amp;lt; LTC2631 write-to-eeprom register&lt;br /&gt;&lt;br /&gt;#define RDY_BIT_POS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x07&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //!&amp;lt; Position of RDY bit&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;  /* Shift parameter val to get 2 8-bits values. */
    uint8_t reg[3] = {LTC2631_DAC_ADDRESS,
                      (val&amp;gt;&amp;gt;4), (val&amp;lt;&amp;lt;4)};

    /*uint8_t reg[3] = {LTC2631_DAC_ADDRESS,
                      (0), (0)};*/
    m_xfer_done = false;
   
    ret_code_t err_code = nrf_drv_twi_tx(&amp;amp;m_twi, LTC2631_BASE_ADDRESS, reg, sizeof(reg), false);
    if (err_code != NRF_SUCCESS)
    {
      NRF_LOG_INFO(&amp;quot;error Erase bonds!&amp;quot;);
        return err_code;
    }
  
    //NRF_LOG_INFO(&amp;quot;success Erase bonds!&amp;quot;);
   
    while (m_xfer_done == false);

    return NRF_SUCCESS;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Could you please tell me if I&amp;#39;m missing something here&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/LTC2631.png" /&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/thread/340337?ContentTypeID=1</link><pubDate>Tue, 23 Nov 2021 12:51:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a77b7c07-1a9a-4d5a-9245-e44418c0a345</guid><dc:creator>Kapil Rawat</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;br /&gt;I&amp;#39;m using blocking mode. I tried to check error code but my program is getting stuck and not showing anything after that (device reset required).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my program is getting stuck in assert_nrf_callback while using nrf_drv_twi_tx function</title><link>https://devzone.nordicsemi.com/thread/340326?ContentTypeID=1</link><pubDate>Tue, 23 Nov 2021 12:09:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79169092-6244-44f5-9df8-fdeef28ed867</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Is the driver configured to operate in blocking or non-blocking mode (see &lt;span&gt;&lt;a title="Basic usage" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/hardware_driver_twi.html?cp=8_1_2_0_17_1#hardware_driver_twi_basic"&gt;Basic usage&lt;/a&gt;&lt;/span&gt;)? Also, have you checked if nrf_drv_twi_tx() returns with an error code?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>